stack updates

This commit is contained in:
Thomas E Lackey 2024-03-21 02:10:37 -05:00
parent 78219c0e04
commit 76821f00a0
6 changed files with 111 additions and 15 deletions

View File

@ -13,7 +13,7 @@ services:
CERC_NITRO_CHAIN_URL: ${CERC_NITRO_CHAIN_URL:-ws://fixturenet-eth-geth-1:8546}
CERC_NITRO_PK: ${CERC_NITRO_PK_ALICE:-f36f6dd450892224ee113899195ef922a4795d41c32cafb386d9aab6e0b7b0c6}
CERC_NITRO_CHAIN_PK: ${CERC_NITRO_CHAIN_PK_ALICE:-888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218}
CERC_NITRO_USE_DURABLE_STORE: ${CERC_NITRO_USE_DURABLE_STORE:-true}
CERC_NITRO_USE_DURABLE_STORE: ${CERC_NITRO_USE_DURABLE_STORE:-false}
CERC_NITRO_DURABLE_STORE_FOLDER: ${CERC_NITRO_DURABLE_STORE_FOLDER:-/app/data/nitro-store}
CERC_NITRO_MSG_PORT: ${CERC_NITRO_MSG_PORT_ALICE:-3006}
CERC_NITRO_WS_MSG_PORT: ${CERC_NITRO_WS_MSG_PORT_ALICE:-5006}
@ -23,6 +23,9 @@ services:
CERC_VPA_ADDRESS: ${CERC_VPA_ADDRESS}
CERC_CA_ADDRESS: ${CERC_CA_ADDRESS}
CERC_NITRO_UI_PORT: ${CERC_NITRO_UI_PORT_ALICE:-4106}
CERC_NITRO_AUTH_UI_PORT: ${CERC_NITRO_AUTH_UI_PORT_ALICE:-4206}
CERC_NITRO_AUTH_ON: false
CERC_NITRO_AUTH_RPC_PORT: 4006
entrypoint: ["bash", "-c", "/app/run-nitro-node.sh"]
volumes:
- go_nitro_data_alice:/app/data
@ -39,6 +42,8 @@ services:
- "4006:4006"
- "5006:5006"
- "4106:4106"
- "4206:4206"
- "4216:4216"
go-nitro-bob:
image: cerc/go-nitro:local
@ -52,7 +57,7 @@ services:
CERC_NITRO_CHAIN_URL: ${CERC_NITRO_CHAIN_URL:-ws://fixturenet-eth-geth-1:8546}
CERC_NITRO_PK: ${CERC_NITRO_PK_BOB:-801c8f30853ed4cbfa130298def86c441c00f4a2eefc6e8fc835ae253ad91d7f}
CERC_NITRO_CHAIN_PK: ${CERC_NITRO_CHAIN_PK_BOB:-570b909da9669b2f35a0b1ac70b8358516d55ae1b5b3710e95e9a94395090597}
CERC_NITRO_USE_DURABLE_STORE: ${CERC_NITRO_USE_DURABLE_STORE:-true}
CERC_NITRO_USE_DURABLE_STORE: ${CERC_NITRO_USE_DURABLE_STORE:-false}
CERC_NITRO_DURABLE_STORE_FOLDER: ${CERC_NITRO_DURABLE_STORE_FOLDER:-/app/data/nitro-store}
CERC_NITRO_MSG_PORT: ${CERC_NITRO_MSG_PORT_BOB:-3007}
CERC_NITRO_WS_MSG_PORT: ${CERC_NITRO_WS_MSG_PORT_BOB:-5007}
@ -62,6 +67,9 @@ services:
CERC_VPA_ADDRESS: ${CERC_VPA_ADDRESS}
CERC_CA_ADDRESS: ${CERC_CA_ADDRESS}
CERC_NITRO_UI_PORT: ${CERC_NITRO_UI_PORT_BOB:-4107}
CERC_NITRO_AUTH_UI_PORT: ${CERC_NITRO_AUTH_UI_PORT_BOB:-4207}
CERC_NITRO_AUTH_ON: true
CERC_NITRO_AUTH_RPC_PORT: 4007
entrypoint: ["bash", "-c", "/app/run-nitro-node.sh"]
volumes:
- go_nitro_data_bob:/app/data
@ -78,13 +86,15 @@ services:
- "4007:4007"
- "5007:5007"
- "4107:4107"
- "4207:4207"
- "4217:4217"
nitro-rpc-client:
image: cerc/nitro-rpc-client:local
hostname: nitro-rpc-client
restart: always
environment:
CERC_NITRO_RPC_FUND_AMOUNT: ${CERC_NITRO_RPC_FUND_AMOUNT:-2000000}
CERC_NITRO_RPC_FUND_AMOUNT: ${CERC_NITRO_RPC_FUND_AMOUNT:-0}
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}
@ -94,6 +104,17 @@ services:
- ../config/nitro-rpc-client/start.sh:/app/start.sh
command: ["/app/start.sh"]
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
volumes:
go_nitro_data_alice:
go_nitro_data_bob:

View File

@ -0,0 +1,57 @@
server {
listen 80;
listen [::]:80;
server_name localhost;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location / {
proxy_buffering off;
proxy_pass http://go-nitro-alice:4206;
}
### geth
location ~ ^/eth/?([^/]*)$ {
set $apiKey $1;
if ($apiKey = '') {
set $apiKey $http_X_API_KEY;
}
auth_request /auth;
proxy_buffering off;
rewrite /.*$ / break;
proxy_pass http://fixturenet-eth-geth-1:8545;
}
## lighthouse
location /beacon/ {
set $apiKey $http_X_API_KEY;
auth_request /auth;
proxy_buffering off;
proxy_pass http://fixturenet-eth-lighthouse-1:8001/;
}
## payments
location /pay {
proxy_buffering off;
proxy_pass http://go-nitro-bob:8547/pay;
}
location = /auth {
internal;
proxy_buffering off;
resolver 127.0.0.11 ipv6=off;
proxy_pass http://go-nitro-bob:8547/auth/$apiKey;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Original-URI $request_uri;
proxy_set_header X-Original-Remote-Addr $remote_addr;
proxy_set_header X-Original-Host $host;
}
location = /stub_status {
stub_status;
}
}

View File

@ -47,13 +47,27 @@ while true; do
sleep $retry_interval
done
if [[ -n "$CERC_NITRO_UI_PORT" ]] && [[ -d "ui" ]]; then
for f in `ls ui/assets/*.js`; do
sed -i "s/\"CERC_RUNTIME_ENV_RPC_HOST\"/\"localhost:${CERC_NITRO_RPC_PORT}\"/g" "$f"
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_TARGET_URL\"#\"http://localhost:5678\"#g" "$f"
done
http-server -p $CERC_NITRO_UI_PORT ui &
http-server -p $CERC_NITRO_UI_PORT /app-node/packages/nitro-gui/dist &
fi
if [[ -n "$CERC_NITRO_AUTH_UI_PORT" ]] && [[ -d "/app-node/packages/nitro-auth-gui/dist" ]]; then
for f in `ls /app-node/packages/nitro-auth-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_TARGET_URL\"#\"http://localhost:5678\"#g" "$f"
done
http-server -p $CERC_NITRO_AUTH_UI_PORT /app-node/packages/nitro-auth-gui/dist &
fi
if [[ "$CERC_NITRO_AUTH_ON" == "true" ]] && [[ -d "/app-node/packages/nitro-auth/dist" ]]; then
bash -c "sleep 10 && cd /app-node/packages/nitro-auth && yarn start" &
fi
cd /app
./nitro \
-chainurl ${CERC_NITRO_CHAIN_URL} \
-msgport ${CERC_NITRO_MSG_PORT} \

View File

@ -8,13 +8,20 @@ COPY . .
RUN go build -v -o nitro .
# Reduce image size
FROM node:18-bullseye-slim as builder-ui
FROM node:18-bullseye-slim as builder-node
RUN apt-get update
RUN apt-get install -y make
WORKDIR /app
COPY . .
RUN find . -name 'node_modules' | xargs -n1 rm -rf
RUN find . -name 'dist' | xargs -n1 rm -rf
RUN yarn
RUN VITE_RPC_HOST=CERC_RUNTIME_ENV_RPC_HOST make ui/build
WORKDIR /app/packages/nitro-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-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
RUN yarn build
FROM node:18-bullseye-slim
RUN apt-get update
@ -23,4 +30,4 @@ RUN rm -rf /var/lib/apt/lists/*
RUN npm install -g http-server
WORKDIR /app
COPY --from=builder /app/nitro .
COPY --from=builder-ui /app/packages/nitro-gui/dist /app/ui
COPY --from=builder-node /app /app-node

View File

@ -4,7 +4,6 @@ description: "Ethereum Fixturenet"
repos:
- git.vdb.to/cerc-io/go-ethereum@v1.11.6-statediff-v5
- git.vdb.to/cerc-io/lighthouse
- github.com/dboreham/foundry
containers:
- cerc/go-ethereum
- cerc/lighthouse
@ -12,7 +11,5 @@ containers:
- cerc/fixturenet-eth-genesis
- cerc/fixturenet-eth-geth
- cerc/fixturenet-eth-lighthouse
- cerc/foundry
pods:
- fixturenet-eth
- foundry

View File

@ -6,7 +6,7 @@ repos:
- git.vdb.to/cerc-io/go-ethereum@v1.11.6-statediff-v5
- git.vdb.to/cerc-io/lighthouse
# nitro repo
- github.com/cerc-io/go-nitro@v0.1.2-ts-port-0.1.9
- github.com/cerc-io/go-nitro@telackey/update
containers:
# fixturenet images
- cerc/go-ethereum