From dc64b051f721270b4057fbecf6a2135e249279af Mon Sep 17 00:00:00 2001 From: Will Winder Date: Fri, 21 Apr 2023 07:19:56 -0400 Subject: [PATCH] docker: add profile support and improved endpoint access. --- docker/README.md | 17 +++++++++-------- docker/files/run/run.sh | 9 ++++++++- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/docker/README.md b/docker/README.md index 0df4408a3e..db0aac7980 100644 --- a/docker/README.md +++ b/docker/README.md @@ -10,11 +10,11 @@ There are a number of special files and environment variables used to control ho ### Default Configuration -By default the following config.json overrides are applied: +The following config.json overrides are applied: -| Setting | Value | -| ------- | ----- | -| EndpointAddress | 0.0.0.0:8080 | +| Setting | Value | Description | +| ------- | ----- | ----------- | +| EndpointAddress | 0.0.0.0:8080 | Ensure the API is accessible from outside of the container. | ### Environment Variables @@ -23,14 +23,15 @@ The following environment variables can be supplied. Except when noted, it is po | 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. | +| PROFILE | If set, initializes the config.json file according to the given profile. | | 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. | +| START_KMD | When set to 1, start kmd service with no timeout. THIS SHOULD NOT BE USED IN PRODUCTION. | +| FAST_CATCHUP | If set to 1 on a public network, attempt to start fast-catchup during initial config. | | 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. | +| TELEMETRY_NAME | If set on a public network, telemetry is reported with this name. | +| NUM_ROUNDS | If set on a private network, override default of 30000 participation keys. | | PEER_ADDRESS | If set, override phonebook with peer ip:port (or semicolon separated list: ip:port;ip:port;ip:port...) | ### Special Files diff --git a/docker/files/run/run.sh b/docker/files/run/run.sh index 9ea28be4bc..0244f0ff23 100755 --- a/docker/files/run/run.sh +++ b/docker/files/run/run.sh @@ -54,7 +54,6 @@ function start_public_network() { function configure_data_dir() { cd "$ALGORAND_DATA" - algocfg -d . set -p EndpointAddress -v "0.0.0.0:${ALGOD_PORT}" # check for config file overrides. if [ -f "/etc/algorand/config.json" ]; then @@ -70,6 +69,14 @@ function configure_data_dir() { cp /etc/algorand/logging.config logging.config fi + # initialize config with profile. + if [ "$PROFILE" != "" ]; then + algocfg profile set --yes -d "$ALGORAND_DATA" "$PROFILE" + fi + + # call after copying config.json to make sure the port is exposed. + algocfg -d . set -p EndpointAddress -v "0.0.0.0:${ALGOD_PORT}" + # check for token overrides if [ "$TOKEN" != "" ]; then for dir in ${ALGORAND_DATA}/../*/; do