From a8a07527e47626c47c624c2b0aa69a943cd20bdf Mon Sep 17 00:00:00 2001 From: "shiqi.zheng@algorand.com" Date: Wed, 15 Mar 2023 13:05:57 -0400 Subject: [PATCH 01/10] template override --- docker/files/run/run.sh | 16 ++++++++++++---- docker/files/run/template.json | 29 ++++++++++++++--------------- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/docker/files/run/run.sh b/docker/files/run/run.sh index bd4e79fe04..0bc6d11f25 100755 --- a/docker/files/run/run.sh +++ b/docker/files/run/run.sh @@ -35,8 +35,12 @@ function start_public_network() { catchup & fi - # redirect output to stdout - algod -o + if [ "$PEER_ADDRESS" != "" ]; then + algod -o -p $PEER_ADDRESS + else + # redirect output to stdout + algod -o + fi } function configure_data_dir() { @@ -142,8 +146,12 @@ function start_private_network() { function start_new_private_network() { local TEMPLATE="template.json" - if [ "$DEV_MODE" = "1" ]; then - TEMPLATE="devmode_template.json" + if [ -f "/etc/algorand/template.json" ]; then + cp /etc/algorand/template.json template.json + else + if [ "$DEV_MODE" = "1" ]; then + TEMPLATE="devmode_template.json" + fi fi sed -i "s/NUM_ROUNDS/${NUM_ROUNDS:-30000}/" "/node/run/$TEMPLATE" goal network create --noclean -n dockernet -r "${ALGORAND_DATA}/.." -t "/node/run/$TEMPLATE" diff --git a/docker/files/run/template.json b/docker/files/run/template.json index 6e3f3cfe9c..d250201932 100644 --- a/docker/files/run/template.json +++ b/docker/files/run/template.json @@ -1,12 +1,13 @@ { "Genesis": { - "NetworkName": "", + "ConsensusProtocol": "future", + "NetworkName": "followermodenet", "FirstPartKeyRound": 0, "LastPartKeyRound": NUM_ROUNDS, "Wallets": [ { "Name": "Wallet1", - "Stake": 10, + "Stake": 40, "Online": true }, { @@ -16,19 +17,16 @@ }, { "Name": "Wallet3", - "Stake": 40, - "Online": false - }, - { - "Name": "Wallet4", - "Stake": 10, - "Online": false + "Stake": 20, + "Online": true } - ] + ], + "DevMode": true }, "Nodes": [ { - "Name": "data", + "Name": "R1", + "IsRelay": true, "Wallets": [ { "Name": "Wallet1", @@ -41,12 +39,13 @@ { "Name": "Wallet3", "ParticipationOnly": false - }, - { - "Name": "Wallet4", - "ParticipationOnly": false } ] + }, + { + "Name": "data", + "IsRelay": false, + "ConfigJSONOverride": "{\"EnableFollowMode\":true}" } ] } From 5d385a4d06b03246b4d4204c9a99dd2c89a78ac1 Mon Sep 17 00:00:00 2001 From: "shiqi.zheng@algorand.com" Date: Wed, 15 Mar 2023 13:07:08 -0400 Subject: [PATCH 02/10] template override --- docker/files/run/template.json | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/docker/files/run/template.json b/docker/files/run/template.json index d250201932..6e3f3cfe9c 100644 --- a/docker/files/run/template.json +++ b/docker/files/run/template.json @@ -1,13 +1,12 @@ { "Genesis": { - "ConsensusProtocol": "future", - "NetworkName": "followermodenet", + "NetworkName": "", "FirstPartKeyRound": 0, "LastPartKeyRound": NUM_ROUNDS, "Wallets": [ { "Name": "Wallet1", - "Stake": 40, + "Stake": 10, "Online": true }, { @@ -17,16 +16,19 @@ }, { "Name": "Wallet3", - "Stake": 20, - "Online": true + "Stake": 40, + "Online": false + }, + { + "Name": "Wallet4", + "Stake": 10, + "Online": false } - ], - "DevMode": true + ] }, "Nodes": [ { - "Name": "R1", - "IsRelay": true, + "Name": "data", "Wallets": [ { "Name": "Wallet1", @@ -39,13 +41,12 @@ { "Name": "Wallet3", "ParticipationOnly": false + }, + { + "Name": "Wallet4", + "ParticipationOnly": false } ] - }, - { - "Name": "data", - "IsRelay": false, - "ConfigJSONOverride": "{\"EnableFollowMode\":true}" } ] } From b930714e6b48d73d41294a5c8c61c4aada61b3e8 Mon Sep 17 00:00:00 2001 From: "shiqi.zheng@algorand.com" Date: Wed, 15 Mar 2023 15:22:21 -0400 Subject: [PATCH 03/10] follower + devmode for private network, update template --- docker/files/run/followermode_template.json | 51 +++++++++++++++++++++ docker/files/run/run.sh | 8 +++- 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 docker/files/run/followermode_template.json diff --git a/docker/files/run/followermode_template.json b/docker/files/run/followermode_template.json new file mode 100644 index 0000000000..ed074587e7 --- /dev/null +++ b/docker/files/run/followermode_template.json @@ -0,0 +1,51 @@ +{ + "Genesis": { + "ConsensusProtocol": "future", + "NetworkName": "followermodenet", + "FirstPartKeyRound": 0, + "LastPartKeyRound": NUM_ROUNDS, + "Wallets": [ + { + "Name": "Wallet1", + "Stake": 40, + "Online": true + }, + { + "Name": "Wallet2", + "Stake": 40, + "Online": true + }, + { + "Name": "Wallet3", + "Stake": 20, + "Online": true + } + ], + "DevMode": true + }, + "Nodes": [ + { + "Name": "data", + "IsRelay": true, + "Wallets": [ + { + "Name": "Wallet1", + "ParticipationOnly": false + }, + { + "Name": "Wallet2", + "ParticipationOnly": false + }, + { + "Name": "Wallet3", + "ParticipationOnly": false + } + ] + }, + { + "Name": "follower", + "IsRelay": false, + "ConfigJSONOverride": "{\"EnableFollowMode\":true,\"EndpointAddress\":\"0.0.0.0:8081\"}" + } + ] +} diff --git a/docker/files/run/run.sh b/docker/files/run/run.sh index 0bc6d11f25..cdc4b62372 100755 --- a/docker/files/run/run.sh +++ b/docker/files/run/run.sh @@ -63,7 +63,13 @@ function configure_data_dir() { # check for token overrides if [ "$TOKEN" != "" ]; then + # set token for relay node echo "$TOKEN" >algod.token + # set token for follower node + if [ -d "${ALGORAND_DATA}/../follower/" ]; then + printf "follower dir!" + echo "$TOKEN" >"${ALGORAND_DATA}/../follower/algod.token" + fi fi if [ "$ADMIN_TOKEN" != "" ]; then echo "$ADMIN_TOKEN" >algod.admin.token @@ -147,7 +153,7 @@ function start_private_network() { function start_new_private_network() { local TEMPLATE="template.json" if [ -f "/etc/algorand/template.json" ]; then - cp /etc/algorand/template.json template.json + cp /etc/algorand/template.json "/node/run/$TEMPLATE" else if [ "$DEV_MODE" = "1" ]; then TEMPLATE="devmode_template.json" From 6e37b4d7bfbce9f1cf058044cd5f4a3574560392 Mon Sep 17 00:00:00 2001 From: "shiqi.zheng@algorand.com" Date: Wed, 15 Mar 2023 17:03:19 -0400 Subject: [PATCH 04/10] rm a print --- docker/files/run/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/files/run/run.sh b/docker/files/run/run.sh index cdc4b62372..bb570f615a 100755 --- a/docker/files/run/run.sh +++ b/docker/files/run/run.sh @@ -36,6 +36,7 @@ function start_public_network() { fi if [ "$PEER_ADDRESS" != "" ]; then + printf "$PEER_ADDRESS" algod -o -p $PEER_ADDRESS else # redirect output to stdout @@ -67,7 +68,6 @@ function configure_data_dir() { echo "$TOKEN" >algod.token # set token for follower node if [ -d "${ALGORAND_DATA}/../follower/" ]; then - printf "follower dir!" echo "$TOKEN" >"${ALGORAND_DATA}/../follower/algod.token" fi fi From 8ba4c899cd0b937062ccbfcf63f61a7edf9482b0 Mon Sep 17 00:00:00 2001 From: "shiqi.zheng@algorand.com" Date: Wed, 15 Mar 2023 17:15:50 -0400 Subject: [PATCH 05/10] update readme --- docker/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/README.md b/docker/README.md index 5db6b20a1d..ae1e50b1ed 100644 --- a/docker/README.md +++ b/docker/README.md @@ -31,6 +31,7 @@ The following environment variables can be supplied. Except when noted, it is po | ADMIN_TOKEN | If set, overrides the REST API admin token. | | KMD_TOKEN | If set along with `START_KMD`, override the KMD REST API token. | | START_KMD | When set to 1, start kmd service with no timeout. THIS SHOULD NOT BE USED IN PRODUCTION. | +| PEER_ADDRESS | If set, override phonebook with peer ip:port | ### Special Files @@ -42,8 +43,7 @@ Configuration can be modified by specifying certain files. These can be changed | /etc/algorand/algod.token | Override default randomized REST API token. | | /etc/algorand/algod.admin.token | Override default randomized REST API admin token. | | /etc/algorand/logging.config | Use a custom [logging.config](https://developer.algorand.org/docs/run-a-node/reference/telemetry-config/#configuration) file for configuring telemetry. | - -TODO: `/etc/algorand/template.json` for overriding the private network topology. + | /etc/algorand/template.json | Override default private network topology. | ## Example Configuration From 3ec183a9733785ec35ef9da4cfa2dc997109f7f5 Mon Sep 17 00:00:00 2001 From: "shiqi.zheng@algorand.com" Date: Thu, 16 Mar 2023 11:22:14 -0400 Subject: [PATCH 06/10] updates --- docker/README.md | 2 +- docker/files/run/run.sh | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/docker/README.md b/docker/README.md index ae1e50b1ed..3632932564 100644 --- a/docker/README.md +++ b/docker/README.md @@ -43,7 +43,7 @@ Configuration can be modified by specifying certain files. These can be changed | /etc/algorand/algod.token | Override default randomized REST API token. | | /etc/algorand/algod.admin.token | Override default randomized REST API admin token. | | /etc/algorand/logging.config | Use a custom [logging.config](https://developer.algorand.org/docs/run-a-node/reference/telemetry-config/#configuration) file for configuring telemetry. | - | /etc/algorand/template.json | Override default private network topology. | + | /etc/algorand/template.json | Override default private network topology. One of the nodes in the template must be named "data".| ## Example Configuration diff --git a/docker/files/run/run.sh b/docker/files/run/run.sh index bb570f615a..f9caa98818 100755 --- a/docker/files/run/run.sh +++ b/docker/files/run/run.sh @@ -64,12 +64,9 @@ function configure_data_dir() { # check for token overrides if [ "$TOKEN" != "" ]; then - # set token for relay node - echo "$TOKEN" >algod.token - # set token for follower node - if [ -d "${ALGORAND_DATA}/../follower/" ]; then - echo "$TOKEN" >"${ALGORAND_DATA}/../follower/algod.token" - fi + for dir in ${ALGORAND_DATA}/../*/; do + echo "$TOKEN" > "$dir/algod.token" + done fi if [ "$ADMIN_TOKEN" != "" ]; then echo "$ADMIN_TOKEN" >algod.admin.token From 7a3825ac09055c229304398179af764410d58c2f Mon Sep 17 00:00:00 2001 From: "shiqi.zheng@algorand.com" Date: Thu, 16 Mar 2023 11:55:22 -0400 Subject: [PATCH 07/10] update readme --- docker/README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/docker/README.md b/docker/README.md index 3632932564..637a92dfaf 100644 --- a/docker/README.md +++ b/docker/README.md @@ -20,18 +20,18 @@ By default the following config.json overrides are applied: The following environment variables can be supplied. Except when noted, it is possible to reconfigure deployments even after the data directory has been initialized. -| Variable | Description | -| -------- | ----------- | +| Variable | Description | +| -------- |-----------------------------------------------------------------------------------------------------------------------------------------------------| | NETWORK | Leave blank for a private network, otherwise specify one of mainnet, betanet, testnet, or devnet. Only used during a data directory initialization. | -| FAST_CATCHUP | If set to 1 on a public network, attempt to start fast-catchup during initial config. | -| TELEMETRY_NAME| If set on a public network, telemetry is reported with this name. | -| DEV_MODE | If set to 1 on a private network, enable dev mode. Only used during data directory initialization. | -| NUM_ROUNDS | If set on a private network, override default of 30000 participation keys. | -| TOKEN | If set, overrides the REST API token. | -| ADMIN_TOKEN | If set, overrides the REST API admin token. | -| KMD_TOKEN | If set along with `START_KMD`, override the KMD REST API token. | -| START_KMD | When set to 1, start kmd service with no timeout. THIS SHOULD NOT BE USED IN PRODUCTION. | -| PEER_ADDRESS | If set, override phonebook with peer ip:port | +| FAST_CATCHUP | If set to 1 on a public network, attempt to start fast-catchup during initial config. | +| TELEMETRY_NAME| If set on a public network, telemetry is reported with this name. | +| DEV_MODE | If set to 1 on a private network, enable dev mode. Only used during data directory initialization. | +| NUM_ROUNDS | If set on a private network, override default of 30000 participation keys. | +| TOKEN | If set, overrides the REST API token. | +| ADMIN_TOKEN | If set, overrides the REST API admin token. | +| KMD_TOKEN | If set along with `START_KMD`, override the KMD REST API token. | +| START_KMD | When set to 1, start kmd service with no timeout. THIS SHOULD NOT BE USED IN PRODUCTION. | +| PEER_ADDRESS | If set, override phonebook with peer ip:port (or semicolon separated list: ip:port;ip:port;ip:port...) | ### Special Files From aa67135493167b7fce4e88c338f0806bde5c570a Mon Sep 17 00:00:00 2001 From: "shiqi.zheng@algorand.com" Date: Tue, 28 Mar 2023 13:41:38 -0400 Subject: [PATCH 08/10] md format --- docker/README.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docker/README.md b/docker/README.md index 637a92dfaf..490375f805 100644 --- a/docker/README.md +++ b/docker/README.md @@ -20,18 +20,18 @@ By default the following config.json overrides are applied: The following environment variables can be supplied. Except when noted, it is possible to reconfigure deployments even after the data directory has been initialized. -| Variable | Description | -| -------- |-----------------------------------------------------------------------------------------------------------------------------------------------------| -| NETWORK | Leave blank for a private network, otherwise specify one of mainnet, betanet, testnet, or devnet. Only used during a data directory initialization. | -| FAST_CATCHUP | If set to 1 on a public network, attempt to start fast-catchup during initial config. | -| TELEMETRY_NAME| If set on a public network, telemetry is reported with this name. | -| DEV_MODE | If set to 1 on a private network, enable dev mode. Only used during data directory initialization. | -| NUM_ROUNDS | If set on a private network, override default of 30000 participation keys. | -| TOKEN | If set, overrides the REST API token. | -| ADMIN_TOKEN | If set, overrides the REST API admin token. | -| KMD_TOKEN | If set along with `START_KMD`, override the KMD REST API token. | -| START_KMD | When set to 1, start kmd service with no timeout. THIS SHOULD NOT BE USED IN PRODUCTION. | -| PEER_ADDRESS | If set, override phonebook with peer ip:port (or semicolon separated list: ip:port;ip:port;ip:port...) | +| Variable | Description | +| -------- | ----------- | +| NETWORK | Leave blank for a private network, otherwise specify one of mainnet, betanet, testnet, or devnet. Only used during a data directory initialization. | +| FAST_CATCHUP | If set to 1 on a public network, attempt to start fast-catchup during initial config. | +| TELEMETRY_NAME | If set on a public network, telemetry is reported with this name. | +| DEV_MODE | If set to 1 on a private network, enable dev mode. Only used during data directory initialization. | +| NUM_ROUNDS | If set on a private network, override default of 30000 participation keys. | +| TOKEN | If set, overrides the REST API token. | +| ADMIN_TOKEN | If set, overrides the REST API admin token. | +| KMD_TOKEN | If set along with `START_KMD`, override the KMD REST API token. | +| START_KMD | When set to 1, start kmd service with no timeout. THIS SHOULD NOT BE USED IN PRODUCTION. | +| PEER_ADDRESS | If set, override phonebook with peer ip:port (or semicolon separated list: ip:port;ip:port;ip:port...) | ### Special Files From fb4eecac7989fd232789626f5775410391bcd69d Mon Sep 17 00:00:00 2001 From: "shiqi.zheng@algorand.com" Date: Tue, 28 Mar 2023 13:42:31 -0400 Subject: [PATCH 09/10] format --- docker/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/README.md b/docker/README.md index 490375f805..39aed724d0 100644 --- a/docker/README.md +++ b/docker/README.md @@ -20,7 +20,7 @@ By default the following config.json overrides are applied: The following environment variables can be supplied. Except when noted, it is possible to reconfigure deployments even after the data directory has been initialized. -| Variable | Description | +| Variable | Description | | -------- | ----------- | | NETWORK | Leave blank for a private network, otherwise specify one of mainnet, betanet, testnet, or devnet. Only used during a data directory initialization. | | FAST_CATCHUP | If set to 1 on a public network, attempt to start fast-catchup during initial config. | From f8d8afa7da9c4bff3bca98496c7e66507a0bd61a Mon Sep 17 00:00:00 2001 From: "shiqi.zheng@algorand.com" Date: Tue, 28 Mar 2023 13:43:05 -0400 Subject: [PATCH 10/10] format --- docker/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/README.md b/docker/README.md index 39aed724d0..0ea18b0c55 100644 --- a/docker/README.md +++ b/docker/README.md @@ -20,7 +20,7 @@ By default the following config.json overrides are applied: The following environment variables can be supplied. Except when noted, it is possible to reconfigure deployments even after the data directory has been initialized. -| Variable | Description | +| Variable | Description | | -------- | ----------- | | NETWORK | Leave blank for a private network, otherwise specify one of mainnet, betanet, testnet, or devnet. Only used during a data directory initialization. | | FAST_CATCHUP | If set to 1 on a public network, attempt to start fast-catchup during initial config. |