From 7cce68959ffc6178a784ce3d2ec1282578823898 Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Thu, 4 Apr 2024 22:55:45 -0500 Subject: [PATCH] relay --- .../data/compose/docker-compose-go-nitro-auth.yml | 3 +++ .../data/config/go-nitro/run-nitro-node.sh | 10 ++++++++++ .../data/container-build/cerc-go-nitro/Dockerfile | 2 ++ 3 files changed, 15 insertions(+) diff --git a/stack_orchestrator/data/compose/docker-compose-go-nitro-auth.yml b/stack_orchestrator/data/compose/docker-compose-go-nitro-auth.yml index 1431a55d..7fa6a90f 100644 --- a/stack_orchestrator/data/compose/docker-compose-go-nitro-auth.yml +++ b/stack_orchestrator/data/compose/docker-compose-go-nitro-auth.yml @@ -76,6 +76,7 @@ services: CERC_NA_ADDRESS: ${CERC_NA_ADDRESS} CERC_VPA_ADDRESS: ${CERC_VPA_ADDRESS} CERC_CA_ADDRESS: ${CERC_CA_ADDRESS} + CERC_NITRO_RELAY_ON: true env_file: - ../config/go-nitro-auth/bootnode.env entrypoint: [ "bash", "-c", "/app/run-nitro-node.sh" ] @@ -89,6 +90,8 @@ services: timeout: 5s retries: 100 start_period: 100s + ports: + - "9090" nitro-caddy: image: caddy:2-alpine diff --git a/stack_orchestrator/data/config/go-nitro/run-nitro-node.sh b/stack_orchestrator/data/config/go-nitro/run-nitro-node.sh index d3ac4525..f0febfb4 100755 --- a/stack_orchestrator/data/config/go-nitro/run-nitro-node.sh +++ b/stack_orchestrator/data/config/go-nitro/run-nitro-node.sh @@ -77,6 +77,16 @@ if [[ "$CERC_NITRO_AUTH_ON" == "true" ]] && [[ -d "/app-node/packages/nitro-auth bash -c "sleep 6 && cd /app-node/packages/nitro-auth && yarn start" & fi +if [[ "$CERC_NITRO_RELAY_ON" == "true" ]]; then + if [[ ! -f "/app/deployment/relay-node.json" ]]; then + node /usr/local/lib/node_modules/@cerc-io/peer/dist/cli/create-peer.js \ + -f /app/deployment/relay-node.json + fi + DEBUG='laconic:*' node /usr/local/lib/node_modules/@cerc-io/peer/dist/cli/relay.js \ + --host 0.0.0.0 \ + -f /app/deployment/relay-node.json & +fi + if [[ -z "$CERC_CHAIN_START_BLOCK" ]]; then if [[ ! -f "/app/deployment/chainstartblock.json" ]]; then curl --location "$(echo $CERC_NITRO_CHAIN_URL | sed 's/^ws/http/' | sed 's#/ws/#/#')" \ diff --git a/stack_orchestrator/data/container-build/cerc-go-nitro/Dockerfile b/stack_orchestrator/data/container-build/cerc-go-nitro/Dockerfile index 9c89c383..9057d3b0 100644 --- a/stack_orchestrator/data/container-build/cerc-go-nitro/Dockerfile +++ b/stack_orchestrator/data/container-build/cerc-go-nitro/Dockerfile @@ -30,6 +30,8 @@ RUN apt-get update RUN apt-get install -y ca-certificates jq netcat make curl wget RUN rm -rf /var/lib/apt/lists/* RUN npm install -g http-server +RUN npm config set @cerc-io:registry https://git.vdb.to/api/packages/cerc-io/npm/ +RUN npm install -g @cerc-io/peer WORKDIR /app COPY --from=builder /app/nitro . COPY --from=builder-node /app /app-node \ No newline at end of file