Skip to content

Commit c8c4a6e

Browse files
committed
Feature: Implement Stellar build and deployment files
1 parent 9c11d83 commit c8c4a6e

File tree

7 files changed

+256
-0
lines changed

7 files changed

+256
-0
lines changed

stellar/Dockerfile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
FROM debian:stretch
2+
3+
ENV STELLAR_CORE_VERSION 13.2.0-1260-e45018ea
4+
ENV HORIZON_VERSION 1.5.0
5+
6+
EXPOSE 5432
7+
EXPOSE 8000
8+
EXPOSE 11625
9+
EXPOSE 11626
10+
11+
RUN apt-get update \
12+
&& apt-get install -y wget curl git libpq-dev libsqlite3-dev libsasl2-dev postgresql-client sudo vim zlib1g-dev jq netcat \
13+
&& apt-get clean
14+
15+
# stellar-core
16+
RUN wget -O stellar-core.deb https://s3.amazonaws.com/stellar.org/releases/stellar-core/stellar-core-${STELLAR_CORE_VERSION}_amd64.deb \
17+
&& dpkg -i stellar-core.deb \
18+
&& rm stellar-core.deb
19+
20+
# horizon
21+
RUN wget -O horizon.tar.gz https://github.com/stellar/go/releases/download/horizon-v${HORIZON_VERSION}/horizon-v${HORIZON_VERSION}-linux-amd64.tar.gz \
22+
&& tar -zxvf horizon.tar.gz \
23+
&& mv /horizon-v${HORIZON_VERSION}-linux-amd64/horizon /usr/local/bin \
24+
&& chmod +x /usr/local/bin/horizon \
25+
&& rm -rf horizon.tar.gz /horizon-v${HORIZON_VERSION}-linux-amd64
26+
27+
RUN ["mkdir", "-p", "/opt/stellar"]
28+
29+
RUN useradd --uid 10011001 --home-dir /home/stellar --no-log-init stellar \
30+
&& mkdir -p /home/stellar \
31+
&& chown -R stellar:stellar /home/stellar
32+
33+
RUN ["ln", "-s", "/opt/stellar", "/stellar"]
34+
RUN ["ln", "-s", "/opt/stellar/core/etc/stellar-core.cfg", "/stellar-core.cfg"]
35+
# RUN ["ln", "-s", "/opt/stellar/horizon/etc/horizon.env", "/horizon.env"]
36+
37+
ADD scripts/docker-entrypoint.sh /
38+
39+
ENTRYPOINT ["/docker-entrypoint.sh"]
40+
41+
CMD ["/usr/local/bin/stellar-core", "run", "--conf", "/stellar-core.cfg"]

stellar/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Stellar
2+
3+
## Start the cryptonode
4+
5+
```shell
6+
docker-compose up -Vd *mainnet or testnet*`
7+
```
8+
9+
## Usage
10+
11+
[Stellar Horizon API reference](https://developers.stellar.org/api/introduction/)

stellar/VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
13.2.0
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# This is an example config for setting up a validator.
2+
# see https://www.stellar.org/developers/stellar-core/software/admin.html
3+
# for how to properly configure your environment
4+
5+
# run `stellar-core gen-seed` to generate a public key and secret seed.
6+
# Let us know the public key so we can add you to the validator list.
7+
# set NODE_SEED below to the secret seed generated above.
8+
9+
# uncomment those two lines if you are running a validator node
10+
# NODE_SEED="S123456ABCDE"
11+
# NODE_IS_VALIDATOR=true
12+
13+
DATABASE="postgresql://dbname=stellar user=stellar password=changeme host=stellar-core-postgres"
14+
15+
#FAILURE_SAFETY is minimum number of nodes that are allowed to fail before you no longer have quorum
16+
FAILURE_SAFETY=1
17+
18+
# number of ledgers to synchronize (time in seconds divided by 5)
19+
# NB: full validators should run with CATCHUP_COMPLETE=true instead
20+
CATCHUP_RECENT=60480
21+
22+
NETWORK_PASSPHRASE="Public Global Stellar Network ; September 2015"
23+
24+
# Populate NODE_NAMES, KNOW_PEERS, QUORUM and HISTORY sections with information
25+
# on other validators
26+
# for example https://github.com/stellar/docs/blob/master/validators.md
27+
# or from https://dashboard.stellar.org/
28+
NODE_NAMES=[
29+
"GDIQKLQVOCD5UD6MUI5D5PTPVX7WTP5TAPP5OBMOLENBBD5KG434KYQ2 stronghold1",
30+
"GAOO3LWBC4XF6VWRP5ESJ6IBHAISVJMSBTALHOQM2EZG7Q477UWA6L7U eno",
31+
"GCJCSMSPIWKKPR7WEPIQG63PDF7JGGEENRC33OKVBSPUDIRL6ZZ5M7OO tempo.eu.com",
32+
"GC5SXLNAM3C4NMGK2PXK4R34B5GNZ47FYQ24ZIBFDFOCU6D4KBN4POAE satoshipay",
33+
"GD7FVHL2KUTUYNOJFRUUDJPDRO2MAZJ5KP6EBCU6LKXHYGZDUFBNHXQI umbrel",
34+
"GCGB2S2KGYARPVIA37HYZXVRM2YZUEXA6S33ZU5BUDC6THSB62LZSTYH sdf_watcher1",
35+
"GCM6QMP3DLRPTAZW2UZPCPX2LF3SXWXKPMP3GKFZBDSF3QZGV2G5QSTK sdf_watcher2",
36+
"GABMKJM6I25XI4K7U6XWMULOUQIQ27BCTMLS6BYYSOWKTBUXVRJSXHYQ sdf_watcher3",
37+
]
38+
39+
KNOWN_PEERS=[
40+
"core-live-a.stellar.org:11625",
41+
"core-live-b.stellar.org:11625",
42+
"core-live-c.stellar.org:11625",
43+
"validator1.stellar.stronghold.co",
44+
"stellar.256kw.com",
45+
"stellar1.tempo.eu.com",
46+
"stellar.satoshipay.io"
47+
]
48+
49+
# full validators (with history archive)
50+
[QUORUM_SET]
51+
VALIDATORS=[
52+
"$sdf_watcher1", "$sdf_watcher2", "$sdf_watcher3"
53+
]
54+
55+
# other validators that you want to include
56+
# for best result, use a number of validators
57+
# that can be expressed as 3f+1 (4, 7, 10 ,...)
58+
[QUORUM_SET.basic]
59+
VALIDATORS=[
60+
"$stronghold1", "$eno", "$tempo.eu.com", "$satoshipay"
61+
]
62+
63+
# History archives
64+
65+
# Stellar.org history store
66+
[HISTORY.sdf1]
67+
get="curl -sf http://history.stellar.org/prd/core-live/core_live_001/{0} -o {1}"
68+
69+
[HISTORY.sdf2]
70+
get="curl -sf http://history.stellar.org/prd/core-live/core_live_002/{0} -o {1}"
71+
72+
[HISTORY.sdf3]
73+
get="curl -sf http://history.stellar.org/prd/core-live/core_live_003/{0} -o {1}"
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
HTTP_PORT=11626
2+
PUBLIC_HTTP_PORT=true
3+
LOG_FILE_PATH=""
4+
5+
NETWORK_PASSPHRASE="Test SDF Network ; September 2015"
6+
KNOWN_CURSORS=["HORIZON"]
7+
DATABASE="postgresql://dbname=stellar user=stellar password=changeme host=stellar-core-postgres"
8+
UNSAFE_QUORUM=true
9+
FAILURE_SAFETY=1
10+
CATCHUP_RECENT=100
11+
12+
[HISTORY.cache]
13+
get="cp /opt/stellar/history-cache/{0} {1}"
14+
15+
[[HOME_DOMAINS]]
16+
HOME_DOMAIN="testnet.stellar.org"
17+
QUALITY="HIGH"
18+
19+
[[VALIDATORS]]
20+
NAME="sdf_testnet_1"
21+
HOME_DOMAIN="testnet.stellar.org"
22+
PUBLIC_KEY="GDKXE2OZMJIPOSLNA6N6F2BVCI3O777I2OOC4BV7VOYUEHYX7RTRYA7Y"
23+
ADDRESS="core-testnet1.stellar.org"
24+
HISTORY="curl -sf http://history.stellar.org/prd/core-testnet/core_testnet_001/{0} -o {1}"
25+
26+
[[VALIDATORS]]
27+
NAME="sdf_testnet_2"
28+
HOME_DOMAIN="testnet.stellar.org"
29+
PUBLIC_KEY="GCUCJTIYXSOXKBSNFGNFWW5MUQ54HKRPGJUTQFJ5RQXZXNOLNXYDHRAP"
30+
ADDRESS="core-testnet2.stellar.org"
31+
HISTORY="curl -sf http://history.stellar.org/prd/core-testnet/core_testnet_002/{0} -o {1}"
32+
33+
[[VALIDATORS]]
34+
NAME="sdf_testnet_3"
35+
HOME_DOMAIN="testnet.stellar.org"
36+
PUBLIC_KEY="GC2V2EFSXN6SQTWVYA5EPJPBWWIMSD2XQNKUOHGEKB535AQE2I6IXV2Z"
37+
ADDRESS="core-testnet3.stellar.org"
38+
HISTORY="curl -sf http://history.stellar.org/prd/core-testnet/core_testnet_003/{0} -o {1}"

stellar/docker-compose.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
version: '3.6'
2+
3+
services:
4+
stellar-core-postgres:
5+
image: postgres:9
6+
restart: on-failure
7+
volumes:
8+
- postgres_data:/var/lib/postgresql/data
9+
environment:
10+
- POSTGRES_DB=stellar
11+
- POSTGRES_USER=stellar
12+
- POSTGRES_PASSWORD=changeme
13+
14+
stellar-core-testnet:
15+
image: quay.io/openware/stellar:13.2.0
16+
restart: always
17+
volumes:
18+
- ./config/stellar-core-testnet.cfg:/stellar-core.cfg
19+
- ./data/testnet:/data
20+
environment:
21+
INITIALIZE_DB: "true"
22+
INITIALIZE_HISTORY_ARCHIVES: "true"
23+
ports:
24+
- 127.0.0.1:11625:11625
25+
- 127.0.0.1:11626:11626
26+
27+
stellar-core-pubnet:
28+
image: quay.io/openware/stellar:13.2.0
29+
restart: always
30+
volumes:
31+
- ./config/stellar-core-pubnet.cfg:/stellar-core.cfg
32+
- ./data/pubnet:/data
33+
ports:
34+
- 127.0.0.1:11625:11625
35+
- 127.0.0.1:11626:11626
36+
37+
volumes:
38+
postgres_data:
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/usr/bin/env bash
2+
3+
set -ue
4+
5+
function stellar_core_init_db() {
6+
if [ -z ${INITIALIZE_DB:-} ] || [ "${INITIALIZE_DB}" != "true" ]; then
7+
echo "Not initializing DB (set INITIALIZE_DB=true if you want to initialize it)."
8+
return 0
9+
fi
10+
11+
local DB_INITIALIZED="/data/.db-initialized"
12+
13+
if [ -f $DB_INITIALIZED ]; then
14+
echo "Core db has already been initialized."
15+
return 0
16+
fi
17+
18+
echo "Initializing core db..."
19+
20+
stellar-core new-db --conf /stellar-core.cfg
21+
22+
echo "Finished initializing core db"
23+
24+
touch $DB_INITIALIZED
25+
}
26+
27+
function stellar_core_init_history_archives() {
28+
if [ -z ${INITIALIZE_HISTORY_ARCHIVES:-} ] || [ "${INITIALIZE_HISTORY_ARCHIVES}" != "true" ]; then
29+
echo "Not initializing history archives (set INITIALIZE_HISTORY_ARCHIVES=true if you want to initialize them)."
30+
return 0
31+
fi
32+
33+
for HISTORY_ARCHIVE in $(echo $HISTORY | jq -r 'to_entries[] | select (.value.put?) | .key'); do
34+
local HISTORY_ARCHIVE_INITIALIZED="/data/.history-archive-${HISTORY_ARCHIVE}-initialized"
35+
36+
if [ -f $HISTORY_ARCHIVE_INITIALIZED ]; then
37+
echo "History archive ${HISTORY_ARCHIVE} has already been initialized."
38+
continue
39+
fi
40+
41+
echo "Initializing history archive ${HISTORY_ARCHIVE}..."
42+
43+
stellar-core new-hist $HISTORY_ARCHIVE --conf /stellar-core.cfg
44+
45+
echo "Finished initializing history archive ${HISTORY_ARCHIVE}."
46+
47+
touch $HISTORY_ARCHIVE_INITIALIZED
48+
done
49+
}
50+
51+
stellar_core_init_db
52+
stellar_core_init_history_archives
53+
54+
exec "$@"

0 commit comments

Comments
 (0)