From 29a27c7430a9ddcd74e2cba4fe686e57e736d536 Mon Sep 17 00:00:00 2001 From: Kim Fehrs <122281269+kofrdx@users.noreply.github.com> Date: Tue, 23 Apr 2024 10:23:56 +0200 Subject: [PATCH] create an optional endpoint called engine-state (#48) * create an optional endpoint called engine-state * update enabling template to use engine-state * update dockerfile * fix docker entrypoint --- Dockerfile.alpine | 2 +- conf.d/engine-state.conf.envsubst | 8 ++++++++ conf.d/nginx.conf.envsubst | 2 ++ docker-entrypoint.sh | 8 ++++++++ generate_artifact.sh | 1 + 5 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 conf.d/engine-state.conf.envsubst diff --git a/Dockerfile.alpine b/Dockerfile.alpine index 8683882..3b65096 100644 --- a/Dockerfile.alpine +++ b/Dockerfile.alpine @@ -1,7 +1,7 @@ FROM nginx:1.25-alpine LABEL maintainer="devops@radixdlt.com" -RUN apk add --no-cache --update libressl=3.7.3-r0 wget=1.21.4-r0 openssl=3.1.4-r5 && \ +RUN apk add --no-cache --update libressl=3.8.2-r0 wget=1.21.4-r0 openssl=3.1.4-r6 && \ apk del curl libcurl # good idea to persist this diff --git a/conf.d/engine-state.conf.envsubst b/conf.d/engine-state.conf.envsubst new file mode 100644 index 0000000..d768188 --- /dev/null +++ b/conf.d/engine-state.conf.envsubst @@ -0,0 +1,8 @@ +location /engine-state { + auth_basic_user_file /etc/nginx/secrets/htpasswd.admin; + auth_basic on; + proxy_pass ${DOLLAR}engine_state; + include conf.d/enable-websocket.conf; + include conf.d/enable-cors.conf; + include conf.d/enable-compression.conf; +} \ No newline at end of file diff --git a/conf.d/nginx.conf.envsubst b/conf.d/nginx.conf.envsubst index d731df0..6a6ca87 100644 --- a/conf.d/nginx.conf.envsubst +++ b/conf.d/nginx.conf.envsubst @@ -124,6 +124,7 @@ http { set ${DOLLAR}core_api http://$RADIXDLT_VALIDATOR_HOST:$RADIXDLT_CORE_API_PORT; set ${DOLLAR}system_api http://$RADIXDLT_VALIDATOR_HOST:$RADIXDLT_SYSTEM_API_PORT; set ${DOLLAR}prometheus_metrics_api http://$RADIXDLT_VALIDATOR_HOST:$RADIXDLT_PROMETHEUS_API_PORT; + set ${DOLLAR}engine_state http://$RADIXDLT_VALIDATOR_HOST:$RADIXDLT_ENGINE_STATE_PORT; set ${DOLLAR}gateway_api http://$RADIXDLT_GATEWAY_API_HOST:$RADIXDLT_GATEWAY_API_PORT; set ${DOLLAR}gateway_api_metrics http://$RADIXDLT_GATEWAY_API_HOST:$RADIXDLT_GATEWAY_METRICS_PORT; set ${DOLLAR}data_aggregator_metrics http://$RADIXDLT_DATA_AGGREGATOR_HOST:$RADIXDLT_DATA_AGGREGATOR_METRICS_PORT; @@ -132,6 +133,7 @@ http { ${INCLUDE_RADIXDLT_TRANSACTIONS_API_ENABLE} ${INCLUDE_RADIXDLT_GATEWAY_API_ENABLE} ${INCLUDE_RADIXDLT_CORE_API_ENABLE} + ${INCLUDE_RADIXDLT_ENGINE_STATE_ENABLE} # keep metrics api inclusion before system api inclusion so that metrics path takes priority for metrics basic auth settings it has ${INCLUDE_RADIXDLT_METRICS_API_ENABLE} diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index e1cae1a..ae3e228 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -48,6 +48,7 @@ set_default_rate_limits [ "$RADIXDLT_CORE_API_PORT" ] || export RADIXDLT_CORE_API_PORT=3333 [ "$RADIXDLT_SYSTEM_API_PORT" ] || export RADIXDLT_SYSTEM_API_PORT=3334 [ "$RADIXDLT_PROMETHEUS_API_PORT" ] || export RADIXDLT_PROMETHEUS_API_PORT=3335 +[ "$RADIXDLT_ENGINE_STATE_PORT" ] || export RADIXDLT_ENGINE_STATE_PORT=3336 [ "$NGINX_VALIDATOR_TCP_PORT" ] || export NGINX_VALIDATOR_TCP_PORT=30000 [ "$NGINX_CLIENT_HTTP_PORT" ] || export NGINX_CLIENT_HTTP_PORT=8080 @@ -72,6 +73,13 @@ if [[ "$RADIXDLT_TRANSACTIONS_API_ENABLE" == true || "$RADIXDLT_TRANSACTIONS_API DOLLAR='$' envsubst /etc/nginx/conf.d/${transactions_conf_file}.conf fi +[ "$RADIXDLT_ENGINE_STATE_ENABLE" ] || export RADIXDLT_ENGINE_STATE_ENABLE=false +if [[ "$RADIXDLT_ENGINE_STATE_ENABLE" == true || "$ADIXDLT_ENGINE_STATE_ENABLE" == "True" ]];then + engine_state_conf_file="engine-state" + export INCLUDE_RADIXDLT_ENGINE_STATE_ENABLE="include conf.d/${engine_state_conf_file}.conf;" + DOLLAR='$' envsubst /etc/nginx/conf.d/${engine_state_conf_file}.conf +fi + [ "$RADIXDLT_GATEWAY_API_ENABLE" ] || export RADIXDLT_GATEWAY_API_ENABLE=false if [[ "$RADIXDLT_GATEWAY_API_ENABLE" == true || "$RADIXDLT_GATEWAY_API_ENABLE" == "True" ]];then diff --git a/generate_artifact.sh b/generate_artifact.sh index 43a6f37..ebd3af9 100755 --- a/generate_artifact.sh +++ b/generate_artifact.sh @@ -4,6 +4,7 @@ export RADIXDLT_VALIDATOR_HOST=127.0.0.1 export RADIXDLT_VALIDATOR_TCP_PORT=30001 export RADIXDLT_CORE_API_PORT=3333 +export RADIXDLT_ENGINE_STATE_PORT=3336 export NGINX_VALIDATOR_TCP_PORT=30000 export NGINX_CLIENT_HTTP_PORT=8080 export NGINX_NODE_HTTP_PORT=3334