-
Notifications
You must be signed in to change notification settings - Fork 17
Feature: Implement Stellar build and deployment files #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
vshatravenko
wants to merge
4
commits into
master
Choose a base branch
from
feature/stellar
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| FROM debian:stretch | ||
|
|
||
| ENV STELLAR_CORE_VERSION 13.2.0-1260-e45018ea | ||
| ENV HORIZON_VERSION 1.5.0 | ||
|
|
||
| EXPOSE 5432 | ||
| EXPOSE 8000 | ||
| EXPOSE 11625 | ||
| EXPOSE 11626 | ||
|
|
||
| RUN apt-get update \ | ||
| && apt-get install -y wget curl git libpq-dev libsqlite3-dev libsasl2-dev postgresql-client sudo vim zlib1g-dev jq netcat \ | ||
| && apt-get clean | ||
|
|
||
| # stellar-core | ||
| RUN wget -O stellar-core.deb https://s3.amazonaws.com/stellar.org/releases/stellar-core/stellar-core-${STELLAR_CORE_VERSION}_amd64.deb \ | ||
| && dpkg -i stellar-core.deb \ | ||
| && rm stellar-core.deb | ||
|
|
||
| # horizon | ||
| 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 \ | ||
| && tar -zxvf horizon.tar.gz \ | ||
| && mv /horizon-v${HORIZON_VERSION}-linux-amd64/horizon /usr/local/bin \ | ||
| && chmod +x /usr/local/bin/horizon \ | ||
| && rm -rf horizon.tar.gz /horizon-v${HORIZON_VERSION}-linux-amd64 | ||
|
|
||
| RUN ["mkdir", "-p", "/opt/stellar"] | ||
|
|
||
| RUN useradd --uid 10011001 --home-dir /home/stellar --no-log-init stellar \ | ||
| && mkdir -p /home/stellar \ | ||
| && chown -R stellar:stellar /home/stellar | ||
|
|
||
| RUN ["ln", "-s", "/opt/stellar", "/stellar"] | ||
| RUN ["ln", "-s", "/opt/stellar/core/etc/stellar-core.cfg", "/stellar-core.cfg"] | ||
| # RUN ["ln", "-s", "/opt/stellar/horizon/etc/horizon.env", "/horizon.env"] | ||
|
|
||
| ADD scripts/docker-entrypoint.sh / | ||
|
|
||
| ENTRYPOINT ["/docker-entrypoint.sh"] | ||
|
|
||
| CMD ["/usr/local/bin/stellar-core", "run", "--conf", "/stellar-core.cfg"] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # Stellar | ||
|
|
||
| ## Start the cryptonode | ||
|
|
||
| ```shell | ||
| docker-compose up -Vd *mainnet or testnet*` | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| [Stellar Horizon API reference](https://developers.stellar.org/api/introduction/) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 13.2.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| # This is an example config for setting up a validator. | ||
| # see https://www.stellar.org/developers/stellar-core/software/admin.html | ||
| # for how to properly configure your environment | ||
|
|
||
| # run `stellar-core gen-seed` to generate a public key and secret seed. | ||
| # Let us know the public key so we can add you to the validator list. | ||
| # set NODE_SEED below to the secret seed generated above. | ||
|
|
||
| # uncomment those two lines if you are running a validator node | ||
| # NODE_SEED="S123456ABCDE" | ||
| # NODE_IS_VALIDATOR=true | ||
|
|
||
| DATABASE="postgresql://dbname=stellar user=stellar password=changeme host=stellar-core-postgres" | ||
|
|
||
| #FAILURE_SAFETY is minimum number of nodes that are allowed to fail before you no longer have quorum | ||
| FAILURE_SAFETY=1 | ||
|
|
||
| # number of ledgers to synchronize (time in seconds divided by 5) | ||
| # NB: full validators should run with CATCHUP_COMPLETE=true instead | ||
| CATCHUP_RECENT=60480 | ||
|
|
||
| NETWORK_PASSPHRASE="Public Global Stellar Network ; September 2015" | ||
|
|
||
| # Populate NODE_NAMES, KNOW_PEERS, QUORUM and HISTORY sections with information | ||
| # on other validators | ||
| # for example https://github.com/stellar/docs/blob/master/validators.md | ||
| # or from https://dashboard.stellar.org/ | ||
| NODE_NAMES=[ | ||
| "GDIQKLQVOCD5UD6MUI5D5PTPVX7WTP5TAPP5OBMOLENBBD5KG434KYQ2 stronghold1", | ||
| "GAOO3LWBC4XF6VWRP5ESJ6IBHAISVJMSBTALHOQM2EZG7Q477UWA6L7U eno", | ||
| "GCJCSMSPIWKKPR7WEPIQG63PDF7JGGEENRC33OKVBSPUDIRL6ZZ5M7OO tempo.eu.com", | ||
| "GC5SXLNAM3C4NMGK2PXK4R34B5GNZ47FYQ24ZIBFDFOCU6D4KBN4POAE satoshipay", | ||
| "GD7FVHL2KUTUYNOJFRUUDJPDRO2MAZJ5KP6EBCU6LKXHYGZDUFBNHXQI umbrel", | ||
| "GCGB2S2KGYARPVIA37HYZXVRM2YZUEXA6S33ZU5BUDC6THSB62LZSTYH sdf_watcher1", | ||
| "GCM6QMP3DLRPTAZW2UZPCPX2LF3SXWXKPMP3GKFZBDSF3QZGV2G5QSTK sdf_watcher2", | ||
| "GABMKJM6I25XI4K7U6XWMULOUQIQ27BCTMLS6BYYSOWKTBUXVRJSXHYQ sdf_watcher3", | ||
| ] | ||
|
|
||
| KNOWN_PEERS=[ | ||
| "core-live-a.stellar.org:11625", | ||
| "core-live-b.stellar.org:11625", | ||
| "core-live-c.stellar.org:11625", | ||
| "validator1.stellar.stronghold.co", | ||
| "stellar.256kw.com", | ||
| "stellar1.tempo.eu.com", | ||
| "stellar.satoshipay.io" | ||
| ] | ||
|
|
||
| # full validators (with history archive) | ||
| [QUORUM_SET] | ||
| VALIDATORS=[ | ||
| "$sdf_watcher1", "$sdf_watcher2", "$sdf_watcher3" | ||
| ] | ||
|
|
||
| # other validators that you want to include | ||
| # for best result, use a number of validators | ||
| # that can be expressed as 3f+1 (4, 7, 10 ,...) | ||
| [QUORUM_SET.basic] | ||
| VALIDATORS=[ | ||
| "$stronghold1", "$eno", "$tempo.eu.com", "$satoshipay" | ||
| ] | ||
|
|
||
| # History archives | ||
|
|
||
| # Stellar.org history store | ||
| [HISTORY.sdf1] | ||
| get="curl -sf http://history.stellar.org/prd/core-live/core_live_001/{0} -o {1}" | ||
|
|
||
| [HISTORY.sdf2] | ||
| get="curl -sf http://history.stellar.org/prd/core-live/core_live_002/{0} -o {1}" | ||
|
|
||
| [HISTORY.sdf3] | ||
| get="curl -sf http://history.stellar.org/prd/core-live/core_live_003/{0} -o {1}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| HTTP_PORT=11626 | ||
| PUBLIC_HTTP_PORT=true | ||
| LOG_FILE_PATH="" | ||
|
|
||
| NETWORK_PASSPHRASE="Test SDF Network ; September 2015" | ||
| KNOWN_CURSORS=["HORIZON"] | ||
| DATABASE="postgresql://dbname=stellar user=stellar password=changeme host=stellar-core-postgres" | ||
| UNSAFE_QUORUM=true | ||
| FAILURE_SAFETY=1 | ||
| CATCHUP_RECENT=100 | ||
|
|
||
| [HISTORY.cache] | ||
| get="cp /opt/stellar/history-cache/{0} {1}" | ||
|
|
||
| [[HOME_DOMAINS]] | ||
| HOME_DOMAIN="testnet.stellar.org" | ||
| QUALITY="HIGH" | ||
|
|
||
| [[VALIDATORS]] | ||
| NAME="sdf_testnet_1" | ||
| HOME_DOMAIN="testnet.stellar.org" | ||
| PUBLIC_KEY="GDKXE2OZMJIPOSLNA6N6F2BVCI3O777I2OOC4BV7VOYUEHYX7RTRYA7Y" | ||
| ADDRESS="core-testnet1.stellar.org" | ||
| HISTORY="curl -sf http://history.stellar.org/prd/core-testnet/core_testnet_001/{0} -o {1}" | ||
|
|
||
| [[VALIDATORS]] | ||
| NAME="sdf_testnet_2" | ||
| HOME_DOMAIN="testnet.stellar.org" | ||
| PUBLIC_KEY="GCUCJTIYXSOXKBSNFGNFWW5MUQ54HKRPGJUTQFJ5RQXZXNOLNXYDHRAP" | ||
| ADDRESS="core-testnet2.stellar.org" | ||
| HISTORY="curl -sf http://history.stellar.org/prd/core-testnet/core_testnet_002/{0} -o {1}" | ||
|
|
||
| [[VALIDATORS]] | ||
| NAME="sdf_testnet_3" | ||
| HOME_DOMAIN="testnet.stellar.org" | ||
| PUBLIC_KEY="GC2V2EFSXN6SQTWVYA5EPJPBWWIMSD2XQNKUOHGEKB535AQE2I6IXV2Z" | ||
| ADDRESS="core-testnet3.stellar.org" | ||
| HISTORY="curl -sf http://history.stellar.org/prd/core-testnet/core_testnet_003/{0} -o {1}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| version: '3.6' | ||
|
|
||
| services: | ||
| stellar-core-postgres: | ||
| image: postgres:9 | ||
| restart: on-failure | ||
| volumes: | ||
| - postgres_data:/var/lib/postgresql/data | ||
| environment: | ||
| - POSTGRES_DB=stellar | ||
| - POSTGRES_USER=stellar | ||
| - POSTGRES_PASSWORD=changeme | ||
|
|
||
| stellar-core-testnet: | ||
| image: quay.io/openware/stellar:13.2.0 | ||
| restart: always | ||
| volumes: | ||
| - ./config/stellar-core-testnet.cfg:/stellar-core.cfg | ||
| - ./data/testnet:/data | ||
| environment: | ||
| INITIALIZE_DB: "true" | ||
| INITIALIZE_HISTORY_ARCHIVES: "true" | ||
| ports: | ||
| - 127.0.0.1:11625:11625 | ||
| - 127.0.0.1:11626:11626 | ||
|
|
||
| stellar-core-pubnet: | ||
| image: quay.io/openware/stellar:13.2.0 | ||
| restart: always | ||
| volumes: | ||
| - ./config/stellar-core-pubnet.cfg:/stellar-core.cfg | ||
| - ./data/pubnet:/data | ||
| environment:$ | ||
| INITIALIZE_DB: "true"$ | ||
| INITIALIZE_HISTORY_ARCHIVES: "true"$ | ||
| ports: | ||
| - 127.0.0.1:11625:11625 | ||
| - 127.0.0.1:11626:11626 | ||
|
|
||
| volumes: | ||
| postgres_data: | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -ue | ||
|
|
||
| function stellar_core_init_db() { | ||
| if [ -z ${INITIALIZE_DB:-} ] || [ "${INITIALIZE_DB}" != "true" ]; then | ||
| echo "Not initializing DB (set INITIALIZE_DB=true if you want to initialize it)." | ||
| return 0 | ||
| fi | ||
|
|
||
| local DB_INITIALIZED="/data/.db-initialized" | ||
|
|
||
| if [ -f $DB_INITIALIZED ]; then | ||
| echo "Core db has already been initialized." | ||
| return 0 | ||
| fi | ||
|
|
||
| echo "Initializing core db..." | ||
|
|
||
| stellar-core new-db --conf /stellar-core.cfg | ||
|
|
||
| echo "Finished initializing core db" | ||
|
|
||
| touch $DB_INITIALIZED | ||
| } | ||
|
|
||
| function stellar_core_init_history_archives() { | ||
| if [ -z ${INITIALIZE_HISTORY_ARCHIVES:-} ] || [ "${INITIALIZE_HISTORY_ARCHIVES}" != "true" ]; then | ||
| echo "Not initializing history archives (set INITIALIZE_HISTORY_ARCHIVES=true if you want to initialize them)." | ||
| return 0 | ||
| fi | ||
|
|
||
| for HISTORY_ARCHIVE in $(echo $HISTORY | jq -r 'to_entries[] | select (.value.put?) | .key'); do | ||
| local HISTORY_ARCHIVE_INITIALIZED="/data/.history-archive-${HISTORY_ARCHIVE}-initialized" | ||
|
|
||
| if [ -f $HISTORY_ARCHIVE_INITIALIZED ]; then | ||
| echo "History archive ${HISTORY_ARCHIVE} has already been initialized." | ||
| continue | ||
| fi | ||
|
|
||
| echo "Initializing history archive ${HISTORY_ARCHIVE}..." | ||
|
|
||
| stellar-core new-hist $HISTORY_ARCHIVE --conf /stellar-core.cfg | ||
|
|
||
| echo "Finished initializing history archive ${HISTORY_ARCHIVE}." | ||
|
|
||
| touch $HISTORY_ARCHIVE_INITIALIZED | ||
| done | ||
| } | ||
|
|
||
| stellar_core_init_db | ||
| stellar_core_init_history_archives | ||
|
|
||
| exec "$@" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.