Swap caddy for nginx

This commit is contained in:
Thomas E Lackey 2024-03-22 17:10:23 -05:00
parent f20dcb8457
commit 80b299c1e5
5 changed files with 60 additions and 11 deletions

View File

@ -94,7 +94,7 @@ services:
hostname: nitro-rpc-client
restart: always
environment:
CERC_NITRO_RPC_FUND_AMOUNT: ${CERC_NITRO_RPC_FUND_AMOUNT:-0}
CERC_NITRO_RPC_FUND_AMOUNT: ${CERC_NITRO_RPC_FUND_AMOUNT:-2000000}
CERC_NITRO_RPC_HOST_ALICE: ${CERC_NITRO_RPC_HOST_ALICE:-go-nitro-alice}
CERC_NITRO_RPC_PORT_ALICE: ${CERC_NITRO_RPC_PORT_ALICE:-4006}
CERC_NITRO_USE_TLS: ${CERC_NITRO_USE_TLS:-false}
@ -104,13 +104,24 @@ services:
- ../config/nitro-rpc-client/start.sh:/app/start.sh
command: ["/app/start.sh"]
nitro-nginx:
image: nginx:1.23-alpine
#nitro-nginx:
# image: nginx:1.23-alpine
# restart: always
# volumes:
# - ../config/go-nitro-auth/nginx:/etc/nginx/conf.d
# ports:
# - 5678:80
# depends_on:
# - go-nitro-alice
# - go-nitro-bob
nitro-caddy:
image: caddy:2-alpine
restart: always
volumes:
- ../config/go-nitro-auth/nginx:/etc/nginx/conf.d
- ../config/go-nitro-auth/caddy/Caddyfile:/etc/caddy/Caddyfile
ports:
- 5678:80
- "5678:80"
depends_on:
- go-nitro-alice
- go-nitro-bob

View File

@ -0,0 +1,38 @@
:80 {
handle /pay* {
reverse_proxy http://go-nitro-bob:8547
}
@eth-key-in-header {
path_regexp /eth/?$
header X-Api-Key *
}
handle @eth-key-in-header {
forward_auth go-nitro-bob:8547 {
uri /auth/{header.x-api-key}
}
rewrite * /
reverse_proxy http://fixturenet-eth-geth-1:8545
}
@eth-key-in-path {
path_regexp apikey eth/(.+)$
}
handle @eth-key-in-path {
forward_auth go-nitro-bob:8547 {
uri /auth/{re.apikey.1}
}
rewrite * /
reverse_proxy http://fixturenet-eth-geth-1:8545
}
handle /eth* {
respond "401 Unauthorized" 401
}
handle {
reverse_proxy http://go-nitro-alice:4206
}
}

View File

@ -49,7 +49,7 @@ done
if [[ -n "$CERC_NITRO_UI_PORT" ]] && [[ -d "/app-node/packages/nitro-gui/dist" ]]; then
for f in `ls /app-node/packages/nitro-gui/dist/assets/*.js`; do
sed -i "s#\"CERC_RUNTIME_ENV_RPC_URL\"#\"http://localhost:${CERC_NITRO_RPC_PORT}\"#g" "$f"
sed -i "s#\"CERC_RUNTIME_ENV_RPC_HOST\"#\"localhost:${CERC_NITRO_RPC_PORT}\"#g" "$f"
sed -i "s#\"CERC_RUNTIME_ENV_TARGET_URL\"#\"http://localhost:5678\"#g" "$f"
done
http-server -p $CERC_NITRO_UI_PORT /app-node/packages/nitro-gui/dist &

View File

@ -17,7 +17,7 @@ RUN find . -name 'node_modules' | xargs -n1 rm -rf
RUN find . -name 'dist' | xargs -n1 rm -rf
RUN yarn
WORKDIR /app/packages/nitro-gui
RUN VITE_RPC_URL=CERC_RUNTIME_ENV_RPC_URL VITE_TARGET_URL=CERC_RUNTIME_ENV_TARGET_URL yarn build
RUN VITE_RPC_HOST=CERC_RUNTIME_ENV_RPC_HOST yarn build
WORKDIR /app/packages/nitro-auth-gui
RUN VITE_RPC_URL=CERC_RUNTIME_ENV_RPC_URL VITE_TARGET_URL=CERC_RUNTIME_ENV_TARGET_URL yarn build
WORKDIR /app/packages/nitro-auth