Skip to content

Commit

Permalink
Merge pull request #593 from input-output-hk/PLT-6117
Browse files Browse the repository at this point in the history
PLT-6117 Fixed erroneous option for `marlowe-proxy` in operables.
  • Loading branch information
bwbush committed Jun 2, 2023
2 parents 9aee8ed + 058003a commit 732cb9e
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 16 deletions.
8 changes: 6 additions & 2 deletions deploy/nomadTasks.nix
Expand Up @@ -169,12 +169,13 @@ rec
env = {
HOST = "0.0.0.0";
PORT = "\${NOMAD_PORT_marlowe_load}";
QUERY_PORT = "\${NOMAD_PORT_contract_query}";
# TODO replace with a persistent volume
STORE_DIR = "/tmp/store";
HTTP_PORT = "\${NOMAD_PORT_contract_http}";
};
config.image = ociNamer oci-images.marlowe-contract;
config.ports = [ "marlowe_load" "contract_http" ];
config.ports = [ "marlowe_load" "contract_query" "contract_http" ];
service.port = "marlowe_load";
user = "0:0";
driver = "docker";
Expand All @@ -188,18 +189,21 @@ rec
env = {
HOST = "0.0.0.0";
PORT = "\${NOMAD_PORT_proxy}";
TRACED_PORT = "\${NOMAD_PORT_proxy_traced}";
TX_HOST = "localhost";
TX_PORT = "\${NOMAD_PORT_tx}";
CONTRACT_HOST = "localhost";
LOAD_PORT = "\${NOMAD_PORT_marlowe_load}";
QUERY_PORT = "\${NOMAD_PORT_contract_query}";
SYNC_HOST = "localhost";
MARLOWE_SYNC_PORT = "\${NOMAD_PORT_marlowe_sync}";
MARLOWE_HEADER_SYNC_PORT = "\${NOMAD_PORT_marlowe_header_sync}";
MARLOWE_QUERY_PORT = "\${NOMAD_PORT_marlowe_query}";
HTTP_PORT = "\${NOMAD_PORT_proxy_http}";
OTEL_SERVICE_NAME = "marlowe-proxy";
};
config.image = ociNamer oci-images.marlowe-proxy;
config.ports = [ "proxy" "proxy_http" ];
config.ports = [ "proxy" "proxy_traced" "proxy_http" ];
service.port = "proxy";
user = "0:0";
driver = "docker";
Expand Down
42 changes: 29 additions & 13 deletions deploy/operables.nix
Expand Up @@ -131,6 +131,7 @@ in
# OPTIONAL VARS #
#################
# OTEL_EXPORTER_OTLP_ENDPOINT: The url of the open telemetry collector
# OTEL_SERVICE_NAME: The name of the open telemetry service
[ -z "''${NODE_CONFIG:-}" ] && echo "NODE_CONFIG env var must be set -- aborting" && exit 1
[ -z "''${CARDANO_NODE_SOCKET_PATH:-}" ] && echo "CARDANO_NODE_SOCKET_PATH env var must be set -- aborting" && exit 1
Expand Down Expand Up @@ -170,7 +171,8 @@ in
${wait-for-socket}/bin/wait-for-socket "$CARDANO_NODE_SOCKET_PATH"
export OTEL_SERVICE_NAME=marlowe-chain-indexer
export OTEL_SERVICE_NAME="''${OTEL_SERVICE_NAME:-marlowe-chain-indexer}"
${packages.marlowe-chain-indexer}/bin/marlowe-chain-indexer \
--socket-path "$CARDANO_NODE_SOCKET_PATH" \
--database-uri "$DATABASE_URI" \
Expand Down Expand Up @@ -198,6 +200,7 @@ in
# OPTIONAL VARS #
#################
# OTEL_EXPORTER_OTLP_ENDPOINT: The url of the open telemetry collector
# OTEL_SERVICE_NAME: The name of the open telemetry service
[ -z "''${HOST:-}" ] && echo "HOST env var must be set -- aborting" && exit 1
[ -z "''${PORT:-}" ] && echo "PORT env var must be set -- aborting" && exit 1
Expand Down Expand Up @@ -227,7 +230,7 @@ in
${wait-for-socket}/bin/wait-for-socket "$CARDANO_NODE_SOCKET_PATH"
export OTEL_SERVICE_NAME=marlowe-chain-sync
export OTEL_SERVICE_NAME="''${OTEL_SERVICE_NAME:-marlowe-chain-sync}"
DATABASE_URI=${database-uri}
${packages.marlowe-chain-sync}/bin/marlowe-chain-sync \
Expand Down Expand Up @@ -257,6 +260,7 @@ in
# OPTIONAL VARS #
#################
# OTEL_EXPORTER_OTLP_ENDPOINT: The url of the open telemetry collector
# OTEL_SERVICE_NAME: The name of the open telemetry service
[ -z "''${DB_NAME:-}" ] && echo "DB_NAME env var must be set -- aborting" && exit 1
[ -z "''${DB_USER:-}" ] && echo "DB_USER env var must be set -- aborting" && exit 1
Expand Down Expand Up @@ -287,7 +291,7 @@ in
${wait-for-tcp}/bin/wait-for-tcp "$MARLOWE_CHAIN_SYNC_HOST" "$MARLOWE_CHAIN_SYNC_PORT"
export OTEL_SERVICE_NAME=marlowe-indexer
export OTEL_SERVICE_NAME="''${OTEL_SERVICE_NAME:-marlowe-indexer}"
${packages.marlowe-indexer}/bin/marlowe-indexer \
--database-uri "$DATABASE_URI" \
Expand All @@ -314,6 +318,7 @@ in
# OPTIONAL VARS #
#################
# OTEL_EXPORTER_OTLP_ENDPOINT: The url of the open telemetry collector
# OTEL_SERVICE_NAME: The name of the open telemetry service
[ -z "''${HOST:-}" ] && echo "HOST env var must be set -- aborting" && exit 1
[ -z "''${MARLOWE_SYNC_PORT:-}" ] && echo "MARLOWE_SYNC_PORT env var must be set -- aborting" && exit 1
Expand All @@ -333,7 +338,7 @@ in
[ -z "''${DB_HOST:-}" ] && echo "DB_HOST env var must be set -- aborting" && exit 1
export OTEL_SERVICE_NAME=marlowe-sync
export OTEL_SERVICE_NAME="''${OTEL_SERVICE_NAME:-marlowe-sync}"
DATABASE_URI=${database-uri}
${packages.marlowe-sync}/bin/marlowe-sync \
Expand All @@ -360,6 +365,7 @@ in
# OPTIONAL VARS #
#################
# OTEL_EXPORTER_OTLP_ENDPOINT: The url of the open telemetry collector
# OTEL_SERVICE_NAME: The name of the open telemetry service
[ -z "''${HOST:-}" ] && echo "HOST env var must be set -- aborting" && exit 1
[ -z "''${PORT:-}" ] && echo "PORT env var must be set -- aborting" && exit 1
Expand All @@ -371,7 +377,7 @@ in
${wait-for-tcp}/bin/wait-for-tcp "$MARLOWE_CHAIN_SYNC_HOST" "$MARLOWE_CHAIN_SYNC_PORT"
export OTEL_SERVICE_NAME=marlowe-tx
export OTEL_SERVICE_NAME="''${OTEL_SERVICE_NAME:-marlowe-tx}"
${packages.marlowe-tx}/bin/marlowe-tx \
--host "$HOST" \
Expand All @@ -391,26 +397,30 @@ in
#################
# REQUIRED VARS #
#################
# HOST, PORT: network binding
# HOST, PORT, QUERY_PORT: network binding
# STORE_DIR: location of the contract store directory
# HTTP_PORT: port number for the HTTP healthcheck server
#################
# OPTIONAL VARS #
#################
# OTEL_EXPORTER_OTLP_ENDPOINT: The url of the open telemetry collector
# OTEL_SERVICE_NAME: The name of the open telemetry service
[ -z "''${HOST:-}" ] && echo "HOST env var must be set -- aborting" && exit 1
[ -z "''${PORT:-}" ] && echo "PORT env var must be set -- aborting" && exit 1
[ -z "''${QUERY_PORT:-}" ] && echo "QUERY_PORT env var must be set -- aborting" && exit 1
[ -z "''${STORE_DIR:-}" ] && echo "STORE_DIR env var must be set -- aborting" && exit 1
[ -z "''${HTTP_PORT:-}" ] && echo "HTTP_PORT env var must be set -- aborting" && exit 1
mkdir -p /tmp
export OTEL_SERVICE_NAME=marlowe-contract
mkdir -p /tmp /store
export OTEL_SERVICE_NAME="''${OTEL_SERVICE_NAME:-marlowe-contract}"
${packages.marlowe-contract}/bin/marlowe-contract \
--host "$HOST" \
--port "$PORT" \
--query-port "$QUERY_PORT" \
--store-dir "$STORE_DIR" \
--http-port "$HTTP_PORT"
'';
Expand All @@ -422,23 +432,26 @@ in
#################
# REQUIRED VARS #
#################
# HOST, PORT: network binding
# HOST, PORT, TRACED_PORT: network binding
# TX_HOST, TX_PORT: connection info to marlowe-tx
# SYNC_HOST, MARLOWE_SYNC_PORT, MARLOWE_HEADER_SYNC_PORT, MARLOWE_QUERY_PORT: connection info to marlowe-sync
# CONTRACT_HOST, LOAD_PORT: connection info to marlowe-contract
# CONTRACT_HOST, LOAD_PORT, QUERY_PORT: connection info to marlowe-contract
# HTTP_PORT: port number for the HTTP healthcheck server
#################
# OPTIONAL VARS #
#################
# OTEL_EXPORTER_OTLP_ENDPOINT: The url of the open telemetry collector
# OTEL_SERVICE_NAME: The name of the open telemetry service
[ -z "''${HOST:-}" ] && echo "HOST env var must be set -- aborting" && exit 1
[ -z "''${PORT:-}" ] && echo "PORT env var must be set -- aborting" && exit 1
[ -z "''${TRACED_PORT:-}" ] && echo "TRACED_PORT env var must be set -- aborting" && exit 1
[ -z "''${TX_HOST:-}" ] && echo "TX_HOST env var must be set -- aborting" && exit 1
[ -z "''${TX_PORT:-}" ] && echo "TX_PORT env var must be set -- aborting" && exit 1
[ -z "''${CONTRACT_HOST:-}" ] && echo "CONTRACT_HOST env var must be set -- aborting" && exit 1
[ -z "''${LOAD_PORT:-}" ] && echo "LOAD_PORT env var must be set -- aborting" && exit 1
[ -z "''${QUERY_PORT:-}" ] && echo "QUERY_PORT env var must be set -- aborting" && exit 1
[ -z "''${SYNC_HOST:-}" ] && echo "SYNC_HOST env var must be set -- aborting" && exit 1
[ -z "''${MARLOWE_SYNC_PORT:-}" ] && echo "MARLOWE_SYNC_PORT env var must be set -- aborting" && exit 1
[ -z "''${MARLOWE_HEADER_SYNC_PORT:-}" ] && echo "MARLOWE_HEADER_SYNC_PORT env var must be set -- aborting" && exit 1
Expand All @@ -449,17 +462,19 @@ in
${wait-for-tcp}/bin/wait-for-tcp "$CONTRACT_HOST" "$LOAD_PORT"
${wait-for-tcp}/bin/wait-for-tcp "$SYNC_HOST" "$MARLOWE_QUERY_PORT"
export OTEL_SERVICE_NAME=marlowe-proxy
export OTEL_SERVICE_NAME="''${OTEL_SERVICE_NAME:-marlowe-proxy}"
${packages.marlowe-proxy}/bin/marlowe-proxy \
--host "$HOST" \
--port "$PORT" \
--port-traced "$TRACED_PORT" \
--marlowe-sync-host "$SYNC_HOST" \
--marlowe-sync-port "$MARLOWE_SYNC_PORT" \
--marlowe-header-port "$MARLOWE_HEADER_SYNC_PORT" \
--marlowe-query-port "$MARLOWE_QUERY_PORT" \
--marlowe-contract-host "$CONTRACT_HOST" \
--marlowe-load-host "$LOAD_PORT" \
--marlowe-load-port "$LOAD_PORT" \
--contract-query-port "$QUERY_PORT" \
--tx-host "$TX_HOST" \
--tx-command-port "$TX_PORT" \
--http-port "$HTTP_PORT"
Expand All @@ -479,14 +494,15 @@ in
# OPTIONAL VARS #
#################
# OTEL_EXPORTER_OTLP_ENDPOINT: The url of the open telemetry collector
# OTEL_SERVICE_NAME: The name of the open telemetry service
[ -z "''${PORT:-}" ] && echo "PORT env var must be set -- aborting" && exit 1
[ -z "''${RUNTIME_HOST:-}" ] && echo "RUNTIME_HOST env var must be set -- aborting" && exit 1
[ -z "''${RUNTIME_PORT:-}" ] && echo "RUNTIME_PORT env var must be set -- aborting" && exit 1
${wait-for-tcp}/bin/wait-for-tcp "$RUNTIME_HOST" "$RUNTIME_PORT"
export OTEL_SERVICE_NAME=marlowe-web-server
export OTEL_SERVICE_NAME="''${OTEL_SERVICE_NAME:-marlowe-web-server}"
${packages.marlowe-web-server}/bin/marlowe-web-server \
--http-port "$PORT" \
Expand Down
2 changes: 1 addition & 1 deletion nix/dev/compose.nix
Expand Up @@ -207,7 +207,7 @@ let
};

contract-service = dev-service {
ports = [ 3727 ];
ports = [ 3727 3728 ];
command = [
"/exec/run-marlowe-contract"
"--store-dir"
Expand Down

0 comments on commit 732cb9e

Please sign in to comment.