diff --git a/README.md b/README.md index ce6770d..c484b64 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ This package includes the following services: - Uses VictoriaMetrics to send performance metrics to a remote Pushgateway. - - Configuration is handled through templates in `/config/gnosis/`, and the main config file (`vmagent.yml`) is dynamically generated based on environment variables. + - Configuration is handled via the config file `/config/gnosis/vmagent.yml`, placehoders in that file are automatically picked up from the environment by vmagent. ### Configuration diff --git a/docker-compose.yml b/docker-compose.yml index 494d9ec..2fd5560 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,8 +13,8 @@ services: build: context: shutter args: - ASSETS_VERSION: shutter-gnosis-1000-set-1v2 # $NETWORK-10*$CHAIN_ID-set-$VERSION - UPSTREAM_VERSION: gnosis-v1.2.4b1 + ASSETS_VERSION: shutter-gnosis-1000-set1.3 # $NETWORK-10*$CHAIN_ID-set-$VERSION + UPSTREAM_VERSION: v1.2.5 KEYPER_CONFIG_DIR: /keyper/config SHUTTER_CHAIN_DIR: /chain STAKER_SCRIPTS_VERSION: v0.1.0 @@ -31,7 +31,7 @@ services: build: context: metrics args: - ASSETS_VERSION: shutter-gnosis-1000-set-1v2 # $NETWORK-10*$CHAIN_ID-set-$VERSION + ASSETS_VERSION: shutter-gnosis-1000-set1.3 # $NETWORK-10*$CHAIN_ID-set-$VERSION restart: on-failure environment: SHUTTER_PUSH_METRICS_ENABLED: false diff --git a/metrics/Dockerfile b/metrics/Dockerfile index 89d1b3e..a504f05 100644 --- a/metrics/Dockerfile +++ b/metrics/Dockerfile @@ -9,7 +9,6 @@ FROM victoriametrics/vmagent:v1.101.0 ARG NETWORK ENV ASSETS_DIR=/assets \ - TEMPLATE_CONFIG_FILE=/config/${NETWORK}/vmagent_template.yml \ CONFIG_FILE=/config/${NETWORK}/vmagent.yml \ USER_SETTINGS_FILE=/config/user/settings.env diff --git a/metrics/config/gnosis/vmagent_template.yml b/metrics/config/gnosis/vmagent.yml similarity index 55% rename from metrics/config/gnosis/vmagent_template.yml rename to metrics/config/gnosis/vmagent.yml index 93c87bc..0dfb031 100644 --- a/metrics/config/gnosis/vmagent_template.yml +++ b/metrics/config/gnosis/vmagent.yml @@ -6,18 +6,24 @@ scrape_configs: static_configs: - targets: ["shutter.shutter-gnosis.dappnode:9100"] labels: - instance: "%{KEYPER_NAME}" + instance: "kpr-%{KEYPER_NAME}" deployment: "%{_ASSETS_VERSION}" + deployment_type: "dappnode" + network: "%{_ASSETS_NETWORK}" - job_name: 'shuttermint' metrics_path: / static_configs: - targets: ["shutter.shutter-gnosis.dappnode:26660"] labels: - instance: "%{KEYPER_NAME}" + instance: "kpr-%{KEYPER_NAME}" deployment: "%{_ASSETS_VERSION}" + deployment_type: "dappnode" + network: "%{_ASSETS_NETWORK}" - job_name: 'vmagent' static_configs: - targets: ["localhost:8429"] labels: - instance: "%{KEYPER_NAME}" - deployment: "%{_ASSETS_VERSION}" \ No newline at end of file + instance: "kpr-%{KEYPER_NAME}" + deployment: "%{_ASSETS_VERSION}" + deployment_type: "dappnode" + network: "%{_ASSETS_NETWORK}" \ No newline at end of file diff --git a/metrics/entrypoint.sh b/metrics/entrypoint.sh index d9284e1..2eb9f9c 100755 --- a/metrics/entrypoint.sh +++ b/metrics/entrypoint.sh @@ -62,11 +62,6 @@ source_user_settings() { fi } -replace_envs_in_yaml() { - echo "[INFO | metrics] Replacing environment variables in the configuration file" - sed "s|%{KEYPER_NAME}|$KEYPER_NAME|g; s|%{_ASSETS_VERSION}|$_ASSETS_VERSION|g" "$TEMPLATE_CONFIG_FILE" >"$CONFIG_FILE" -} - update_user_settings if [ "${SHUTTER_PUSH_METRICS_ENABLED}" = "false" ]; then @@ -78,8 +73,6 @@ source_assets_envs source_user_settings -replace_envs_in_yaml - exec /vmagent-prod \ -promscrape.config="${CONFIG_FILE}" \ -remoteWrite.url="${PUSHGATEWAY_URL}" \ diff --git a/package_variants/gnosis/docker-compose.yml b/package_variants/gnosis/docker-compose.yml index e1dbd69..fadfabf 100644 --- a/package_variants/gnosis/docker-compose.yml +++ b/package_variants/gnosis/docker-compose.yml @@ -6,14 +6,13 @@ services: CHAIN_PORT: 26656 KEYPER_PORT: 23003 KEYPER_METRICS_PORT: 9100 + ports: + - "23003:23003" + - "26656:26656" + - "26660:26660" + - "9100:9100" metrics: build: args: NETWORK: gnosis - - ports: - - "23003:23003/tcp" - - "26656:26656" - - "26660:26660" - - "9100:9100" diff --git a/shutter/Dockerfile b/shutter/Dockerfile index 5d86603..c7784c9 100644 --- a/shutter/Dockerfile +++ b/shutter/Dockerfile @@ -6,7 +6,7 @@ FROM ghcr.io/shutter-network/assets:${ASSETS_VERSION} as assets RUN rsync -aq --delete /assets-source/ /assets/ ARG UPSTREAM_VERSION -FROM ghcr.io/shutter-network/rolling-shutter:${UPSTREAM_VERSION} +FROM ghcr.io/shutter-network/keyper:${UPSTREAM_VERSION} ARG NETWORK ARG KEYPER_CONFIG_DIR @@ -23,7 +23,7 @@ RUN apt-get update && \ ENV SHUTTER_GNOSIS_SM_BLOCKTIME=10 \ SHUTTER_GNOSIS_GENESIS_KEYPER=0x440Dc6F164e9241F04d282215ceF2780cd0B755e \ SHUTTER_GNOSIS_MAXTXPOINTERAGE=5 \ - SHUTTER_DATABASE_URL=postgres://postgres@db.shutter-${NETWORK}.dappnode:5432/keyper \ + SHUTTER_DATABASEURL=postgres://postgres@db.shutter-${NETWORK}.dappnode:5432/keyper \ SHUTTER_SHUTTERMINT_SHUTTERMINTURL=http://localhost:26657 \ CHAIN_LISTEN_PORT=26657 \ SHUTTER_BIN=/rolling-shutter \ @@ -52,7 +52,7 @@ COPY --from=assets ${ASSETS_DIR}/ ${ASSETS_DIR}/ # Placed here to rebuild less layers ENV CHAIN_PORT=${CHAIN_PORT} \ - SHUTTER_P2P_LISTENADDRESSES="/ip4/0.0.0.0/tcp/${KEYPER_PORT}" \ + SHUTTER_P2P_LISTENADDRESSES="/ip4/0.0.0.0/tcp/${KEYPER_PORT},/ip4/0.0.0.0/udp/${KEYPER_PORT}/quic-v1" \ NETWORK=${NETWORK} ENTRYPOINT ["supervisord", "-c", "/etc/supervisord.conf"] \ No newline at end of file diff --git a/shutter/go-shutter-settings/settings/keyper.go b/shutter/go-shutter-settings/settings/keyper.go index a0310be..0970ffc 100644 --- a/shutter/go-shutter-settings/settings/keyper.go +++ b/shutter/go-shutter-settings/settings/keyper.go @@ -8,7 +8,7 @@ import ( type KeyperConfig struct { InstanceID int `env:"_ASSETS_INSTANCE_ID"` - DatabaseURL string `env:"SHUTTER_DATABASE_URL"` + DatabaseURL string `env:"SHUTTER_DATABASEURL"` BeaconAPIURL string `env:"SHUTTER_BEACONAPIURL"` MaxNumKeysPerMessage int `env:"_ASSETS_MAX_NUM_KEYS_PER_MESSAGE"` Gnosis struct { @@ -31,8 +31,8 @@ type KeyperConfig struct { } P2P struct { P2PKey string `env:"SHUTTER_P2P_KEY"` - ListenAddresses string `env:"SHUTTER_P2P_LISTENADDRESSES"` - AdvertiseAddresses string `env:"SHUTTER_P2P_ADVERTISEADDRESSES"` + ListenAddresses []string `env:"SHUTTER_P2P_LISTENADDRESSES"` + AdvertiseAddresses []string `env:"SHUTTER_P2P_ADVERTISEADDRESSES"` CustomBootstrapAddresses []string `env:"_ASSETS_CUSTOM_BOOTSTRAP_ADDRESSES"` DiscoveryNamespace string `env:"_ASSETS_DISCOVERY_NAME_PREFIX"` } @@ -44,7 +44,7 @@ type KeyperConfig struct { DKGStartBlockDelta int `env:"_ASSETS_DKG_START_BLOCK_DELTA"` } Metrics struct { - Enabled bool `env:"SHUTTER_ENABLED"` + Enabled bool `env:"SHUTTER_METRICS_ENABLED"` } } @@ -82,4 +82,4 @@ func AddSettingsToKeyper(generatedFilePath, configFilePath, outputFilePath strin fmt.Println("Keyper TOML file modified successfully and saved to", outputFilePath) return nil -} \ No newline at end of file +} diff --git a/shutter/scripts/configure.sh b/shutter/scripts/configure.sh index d62aa04..dbb79d4 100755 --- a/shutter/scripts/configure.sh +++ b/shutter/scripts/configure.sh @@ -75,10 +75,10 @@ generate_keyper_config init_keyper_db -init_chain - configure_keyper +init_chain + configure_chain trigger_chain_start diff --git a/shutter/scripts/configure_keyper.sh b/shutter/scripts/configure_keyper.sh index fecaf01..b5c6e81 100755 --- a/shutter/scripts/configure_keyper.sh +++ b/shutter/scripts/configure_keyper.sh @@ -10,11 +10,17 @@ echo "[INFO | configure] Calculating keyper configuration values..." SUPPORTED_NETWORKS="gnosis" -export SHUTTER_P2P_ADVERTISEADDRESSES="/ip4/${_DAPPNODE_GLOBAL_PUBLIC_IP}/tcp/${KEYPER_PORT}" +# Conditionally add square brackets to SHUTTER_P2P_LISTENADDRESSES +if [[ ! "$SHUTTER_P2P_LISTENADDRESSES" =~ ^\[.*\]$ ]]; then + export SHUTTER_P2P_LISTENADDRESSES="[$SHUTTER_P2P_LISTENADDRESSES]" +fi + +export SHUTTER_P2P_ADVERTISEADDRESSES="[\"/ip4/${_DAPPNODE_GLOBAL_PUBLIC_IP}/tcp/${KEYPER_PORT}\", \"/ip4/${_DAPPNODE_GLOBAL_PUBLIC_IP}/udp/${KEYPER_PORT}/quic-v1\"]" export SHUTTER_BEACONAPIURL=$(get_beacon_api_url_from_global_env "$NETWORK" "$SUPPORTED_NETWORKS") export SHUTTER_GNOSIS_NODE_CONTRACTSURL=http://execution.gnosis.dncore.dappnode:8545 export SHUTTER_GNOSIS_NODE_ETHEREUMURL=$(get_execution_ws_url_from_global_env "$NETWORK" "$SUPPORTED_NETWORKS") export VALIDATOR_PUBLIC_KEY=$(cat "${SHUTTER_CHAIN_DIR}/config/priv_validator_pubkey.hex") +export SHUTTER_METRICS_ENABLED=${SHUTTER_PUSH_METRICS_ENABLED} echo "[INFO | configure] LISTEN: $SHUTTER_P2P_LISTENADDRESSES"