Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,11 @@ The image also exposes a few other ports that most developers do not need, but a
| 5432 | postgresql | database access port |
| 6060 | horizon | admin port |
| 6061 | stellar-rpc | admin port |
| 11625 | stellar-core | peer node port |
| 11626 | stellar-core | main http port |
| 11625 | stellar-core (validator) | peer node port |
| 11626 | stellar-core (validator) | main http port |
| 11925 | stellar-core (watcher) | peer node port |
| 11926 | stellar-core (watcher) | main http port |
| 11927 | stellar-core (watcher) | query http port |
| 11725 | stellar-core (horizon) | peer node port |
| 11726 | stellar-core (horizon) | main http port |
| 11825 | stellar-core (stellar-rpc) | peer node port |
Expand Down
5 changes: 5 additions & 0 deletions common/core-watcher/bin/start
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

echo "starting core..."
set -e
exec /usr/bin/stellar-core --conf "/opt/stellar/core-watcher/etc/stellar-core.cfg" run
32 changes: 32 additions & 0 deletions common/core-watcher/etc/stellar-core.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
HTTP_QUERY_PORT=11927
HTTP_PORT=11926
PUBLIC_HTTP_PORT=true
PEER_PORT=11925
ARTIFICIALLY_ACCELERATE_TIME_FOR_TESTING=true # TODO: move to network based files

# Keep 10-60 mins of ledgers depending on ledger close times of 1-5s available
# on the query port.
# TODO: QUERY_SNAPSHOT_LEDGERS=720
QUERY_SNAPSHOT_LEDGERS=10

NETWORK_PASSPHRASE="__NETWORK__"
NODE_IS_VALIDATOR=false

DATABASE="sqlite3://:memory:"

COMMANDS=["ll?level=info"]

UNSAFE_QUORUM=true
FAILURE_SAFETY=0

PREFERRED_PEER_KEYS=["$local_core"]
PREFERRED_PEERS_ONLY=true

[[VALIDATORS]]
NAME="local_core"
HOME_DOMAIN="core.local"
# From "SDQVDISRYN2JXBS7ICL7QJAEKB3HWBJFP2QECXG7GZICAHBK4UNJCWK2"
PUBLIC_KEY="GCTI6HMWRH2QGMFKWVU5M5ZSOTKL7P7JAHZDMJJBKDHGWTEC4CJ7O3DU"
ADDRESS="localhost:11625"
QUALITY="MEDIUM"
HISTORY="curl -sf http://localhost:1570/{0} -o {1}"
5 changes: 5 additions & 0 deletions common/nginx/etc/conf.d/stellar-core-watcher.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
location /query/ {
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:11927/;
proxy_redirect off;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[program:stellar-core-watcher]
user=stellar
directory=/opt/stellar/core-watcher
command=/opt/stellar/core-watcher/bin/start
autostart=false
autorestart=true
priority=21
20 changes: 20 additions & 0 deletions start
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export STELLAR_HOME="/opt/stellar"
export PGHOME="$STELLAR_HOME/postgresql"
export SUPHOME="$STELLAR_HOME/supervisor"
export COREHOME="$STELLAR_HOME/core"
export COREWATCHERHOME="$STELLAR_HOME/core-watcher"
export HZHOME="$STELLAR_HOME/horizon"
export FBHOME="$STELLAR_HOME/friendbot"
export LABHOME="$STELLAR_HOME/lab"
Expand Down Expand Up @@ -96,6 +97,7 @@ function start() {
validate_after_copy_defaults
init_db
init_stellar_core
init_stellar_core_watcher
init_friendbot
init_horizon
copy_pgpass
Expand Down Expand Up @@ -324,6 +326,13 @@ function copy_defaults() {
$CP /opt/stellar-default/$NETWORK/core/ $COREHOME
fi

if [ -d $COREWATCHERHOME/etc ]; then
echo "stellar-core(watcher): config directory exists, skipping copy"
else
$CP /opt/stellar-default/common/core-watcher/ $COREWATCHERHOME
# TODO: $CP /opt/stellar-default/$NETWORK/core-watcher/ $COREWATCHERHOME
fi

if [ -d $HZHOME/etc ]; then
echo "horizon: config directory exists, skipping copy"
else
Expand Down Expand Up @@ -456,6 +465,16 @@ function init_stellar_core() {
popd
}

function init_stellar_core_watcher() {
if [ "$ENABLE_CORE" != "true" ]; then
return 0
fi
pushd $COREWATCHERHOME
run_silent "chown-core" chown -R stellar:stellar .
perl -pi -e "s/__NETWORK__/$NETWORK_PASSPHRASE/g" etc/stellar-core.cfg
popd
}

function init_friendbot() {
pushd $FBHOME

Expand Down Expand Up @@ -639,6 +658,7 @@ function start_optional_services() {
if [ "$ENABLE_CORE" == "true" ]; then
supervisorctl start postgresql
supervisorctl start stellar-core
supervisorctl start stellar-core-watcher
fi

if [ "$ENABLE_HORIZON" == "true" ]; then
Expand Down
Loading