forked from cerc-io/stack-orchestrator
Swap caddy for nginx
This commit is contained in:
parent
f20dcb8457
commit
80b299c1e5
@ -94,7 +94,7 @@ services:
|
|||||||
hostname: nitro-rpc-client
|
hostname: nitro-rpc-client
|
||||||
restart: always
|
restart: always
|
||||||
environment:
|
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_HOST_ALICE: ${CERC_NITRO_RPC_HOST_ALICE:-go-nitro-alice}
|
||||||
CERC_NITRO_RPC_PORT_ALICE: ${CERC_NITRO_RPC_PORT_ALICE:-4006}
|
CERC_NITRO_RPC_PORT_ALICE: ${CERC_NITRO_RPC_PORT_ALICE:-4006}
|
||||||
CERC_NITRO_USE_TLS: ${CERC_NITRO_USE_TLS:-false}
|
CERC_NITRO_USE_TLS: ${CERC_NITRO_USE_TLS:-false}
|
||||||
@ -104,13 +104,24 @@ services:
|
|||||||
- ../config/nitro-rpc-client/start.sh:/app/start.sh
|
- ../config/nitro-rpc-client/start.sh:/app/start.sh
|
||||||
command: ["/app/start.sh"]
|
command: ["/app/start.sh"]
|
||||||
|
|
||||||
nitro-nginx:
|
#nitro-nginx:
|
||||||
image: nginx:1.23-alpine
|
# 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
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- ../config/go-nitro-auth/nginx:/etc/nginx/conf.d
|
- ../config/go-nitro-auth/caddy/Caddyfile:/etc/caddy/Caddyfile
|
||||||
ports:
|
ports:
|
||||||
- 5678:80
|
- "5678:80"
|
||||||
depends_on:
|
depends_on:
|
||||||
- go-nitro-alice
|
- go-nitro-alice
|
||||||
- go-nitro-bob
|
- go-nitro-bob
|
||||||
|
38
stack_orchestrator/data/config/go-nitro-auth/caddy/Caddyfile
Normal file
38
stack_orchestrator/data/config/go-nitro-auth/caddy/Caddyfile
Normal 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
|
||||||
|
}
|
||||||
|
}
|
@ -34,10 +34,10 @@ server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
## payments
|
## payments
|
||||||
location /pay {
|
location /pay {
|
||||||
proxy_buffering off;
|
proxy_buffering off;
|
||||||
proxy_pass http://go-nitro-bob:8547/pay;
|
proxy_pass http://go-nitro-bob:8547/pay;
|
||||||
}
|
}
|
||||||
|
|
||||||
location = /auth {
|
location = /auth {
|
||||||
internal;
|
internal;
|
||||||
|
@ -49,7 +49,7 @@ done
|
|||||||
|
|
||||||
if [[ -n "$CERC_NITRO_UI_PORT" ]] && [[ -d "/app-node/packages/nitro-gui/dist" ]]; then
|
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
|
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"
|
sed -i "s#\"CERC_RUNTIME_ENV_TARGET_URL\"#\"http://localhost:5678\"#g" "$f"
|
||||||
done
|
done
|
||||||
http-server -p $CERC_NITRO_UI_PORT /app-node/packages/nitro-gui/dist &
|
http-server -p $CERC_NITRO_UI_PORT /app-node/packages/nitro-gui/dist &
|
||||||
|
@ -17,7 +17,7 @@ RUN find . -name 'node_modules' | xargs -n1 rm -rf
|
|||||||
RUN find . -name 'dist' | xargs -n1 rm -rf
|
RUN find . -name 'dist' | xargs -n1 rm -rf
|
||||||
RUN yarn
|
RUN yarn
|
||||||
WORKDIR /app/packages/nitro-gui
|
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
|
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
|
RUN VITE_RPC_URL=CERC_RUNTIME_ENV_RPC_URL VITE_TARGET_URL=CERC_RUNTIME_ENV_TARGET_URL yarn build
|
||||||
WORKDIR /app/packages/nitro-auth
|
WORKDIR /app/packages/nitro-auth
|
||||||
|
Loading…
Reference in New Issue
Block a user