Skip to content

Commit

Permalink
create an optional endpoint called engine-state (#48)
Browse files Browse the repository at this point in the history
* create an optional endpoint called engine-state

* update enabling template to use engine-state

* update dockerfile

* fix docker entrypoint
  • Loading branch information
Kim Fehrs authored Apr 23, 2024
1 parent d3de2b1 commit 29a27c7
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM nginx:1.25-alpine
LABEL maintainer="[email protected]"

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
Expand Down
8 changes: 8 additions & 0 deletions conf.d/engine-state.conf.envsubst
Original file line number Diff line number Diff line change
@@ -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;
}
2 changes: 2 additions & 0 deletions conf.d/nginx.conf.envsubst
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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}
Expand Down
8 changes: 8 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -72,6 +73,13 @@ if [[ "$RADIXDLT_TRANSACTIONS_API_ENABLE" == true || "$RADIXDLT_TRANSACTIONS_API
DOLLAR='$' envsubst </etc/nginx/conf.d/${transactions_conf_file}.conf.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.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
Expand Down
1 change: 1 addition & 0 deletions generate_artifact.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 29a27c7

Please sign in to comment.