Skip to content

Commit

Permalink
build: move docker-compose config to project root directory
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkAfCod committed Jul 9, 2024
1 parent ecddaa5 commit d072876
Show file tree
Hide file tree
Showing 3 changed files with 266 additions and 0 deletions.
90 changes: 90 additions & 0 deletions .env.default
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# L1 network option: can be either `optimism`, `optimism-goerli`, `optimism-sepolia`, `base`, `base-goerli` or `base-sepolia`
NETWORK=optimism

# The HTTP RPC endpoint of an L1 node
L1_RPC_URL=https://eth-mainnet.g.alchemy.com/v2/<API_KEY>

# The WebSocket RPC endpoint of an L1 node
L1_WS_RPC_URL=wss://eth-mainnet.g.alchemy.com/v2/<API_KEY>

# The beacon chain RPC endpoint
L1_BEACON_RPC_URL=

# The L1 signer private key
L1_SIGNER=

# The batch inbox contract address deployed on l1
BATCH_INBOX_ADDRESS=

# JWT secret for the engine API
JWT_SECRET=bf549f5188556ce0951048ef467ec93067bc4ea21acebe46ef675cd4e8e015ff

# Execution client chain ID
L2_CHAIN_ID=

# Execution client signer private key
L2_SIGNER=

# Deployed l2 output oracle contract address
L2OO_ADDRESS=

# Deployed l2 dispute game factory contract address
L2DGF_ADDRESS=

# Execution client: can be either `op-geth` or `op-erigon`
EXECUTION_CLIENT=op-geth

# The exeuction client Auth RPC port.
EXECUTION_CLIENT_AUTH_RPC_PORT=8551

# The execution client RPC port.
EXECUTION_CLIENT_RPC_PORT=8545

# The execution client WebSocket port.
EXECUTION_CLIENT_WS_PORT=8546

# The Roll up client.
ROLLUP_CLIENT=hildr-node

# The Roll up client RPC port.
RPC_PORT=11545

# Sync mode: can be either `full` or `checkpoint`
SYNC_MODE=full

# Only for `custom` or `devnet` network.
# Specify the path to the `rollup.json` file generated by `op-node`.
# For the devnet configuration, this file should be located in the `.devnet` folder within the Optimism directory.
# OP_ROLLUP_JSON_FILEPATH=

# Only for `custom` or `devnet` network.
# Specify the path to the `genesis-l2.json` file generated by `op-node`.
# For the devnet configuration, this file should be located in the `.devnet` folder within the Optimism directory.
# OP_GENESIS_JSON_FILEPATH=

# If the OP-Challenger should be run as a service alongside Magi
# (comment out the next line if you don't want to run this service)
#RUN_OP_CHALLENGER=run-op-challenger

# OP-Challenger mode: can be `listen-only` or `listen-and-respond`
#OP_CHALLENGER_MODE=listen-only


# ----------------- Only needed with `checkpoint` sync mode -----------------
CHECKPOINT_SYNC_URL=https://opt-mainnet.g.alchemy.com/v2/<API_KEY>


# ----- Only needed with the OP-Challenger in `listen-and-respond` mode -----
#OP_CHALLENGER_SIGNER_KEY=a1742ee5f7898541224d6a91d9f3b34ad442e27bcb43223c01e47e58fc0a0c12


# --------------------- Only needed for testing locally ---------------------
L1_TEST_RPC_URL=https://eth-mainnet.g.alchemy.com/v2/<API_KEY>
L2_TEST_RPC_URL=https://opt-mainnet.g.alchemy.com/v2/<API_KEY>


# ------------------------------ Do not modify ------------------------------
COMPOSE_PROJECT_NAME=$NETWORK
COMPOSE_PROFILES=hildr-node,metrics,${EXECUTION_CLIENT}

LOG_LEVEL=DEBUG
138 changes: 138 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
---
version: "3.4"
x-logging: &logging
logging:
driver: json-file
options:
max-size: 10m
max-file: "3"

services:
hildr-node:
# image: ghcr.io/optimism-java/hildr:latest
container_name: hildr-node
build:
dockerfile: ./docker/node.dock
context: ./
profiles:
- hildr-node
restart: unless-stopped
stop_grace_period: 3m
entrypoint: /scripts/start-hildr-node.sh
depends_on:
- op-geth
env_file:
- .env
ports:
- "9200:9200"
- "${RPC_PORT}:${RPC_PORT}"
volumes:
- ./docker/:/scripts
- data:/data
- ${OP_ROLLUP_JSON_FILEPATH:-.}:/rollup.json
<<: *logging

op-geth:
image: us-docker.pkg.dev/oplabs-tools-artifacts/images/op-geth:v1.101315.1
container_name: op-geth
profiles:
- op-geth
restart: unless-stopped
stop_grace_period: 3m
entrypoint: /scripts/start-op-geth.sh
env_file:
- .env
ports:
- ${EXECUTION_CLIENT_AUTH_RPC_PORT}:8551
- ${EXECUTION_CLIENT_RPC_PORT}:8545
- ${EXECUTION_CLIENT_WS_PORT}:8546
volumes:
- ./docker/:/scripts
- data:/data
- ${OP_GENESIS_JSON_FILEPATH:-.}:/genesis-l2-attached.json
<<: *logging

op-erigon:
image: testinprod/op-erigon:latest
container_name: op-erigon
profiles:
- op-erigon
restart: unless-stopped
stop_grace_period: 3m
entrypoint: /scripts/start-op-erigon.sh
env_file:
- .env
ports:
- ${EXECUTION_CLIENT_AUTH_RPC_PORT}:8551
- ${EXECUTION_CLIENT_RPC_PORT}:8545
- ${EXECUTION_CLIENT_WS_PORT}:8546
volumes:
- ./docker/:/scripts
- data:/data
<<: *logging

op-challenger:
image: merklefruit/op-challenger:latest
container_name: op-challenger
profiles:
- challenger
restart: unless-stopped
stop_grace_period: 3m
entrypoint: /scripts/start-op-challenger.sh
env_file:
- .env
ports:
- "9201:9201"
volumes:
- ./docker:/scripts
- data:/data
<<: *logging

prometheus:
image: prom/prometheus:latest
container_name: prometheus
profiles:
- metrics
ports:
- "9090:9090"
command:
- --config.file=/etc/prometheus/prometheus.yml
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
<<: *logging

node-exporter:
image: prom/node-exporter:latest
container_name: node-exporter
profiles:
- metrics
restart: unless-stopped
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
command:
- --path.procfs=/host/proc
- --path.rootfs=/rootfs
- --path.sysfs=/host/sys
- --collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)
expose:
- 9100

grafana:
image: grafana/grafana
container_name: grafana
profiles:
- metrics
ports:
- "3000:3000"
volumes:
- ./grafana/provisioning/:/etc/grafana/provisioning/:ro
environment:
- GF_SECURITY_ADMIN_USER=hildr
- GF_SECURITY_ADMIN_PASSWORD=passw0rd
- GF_DASHBOARDS_DEFAULT_HOME_DASHBOARD_PATH=/etc/grafana/provisioning/dashboards/dashboard.json

volumes:
scripts:
data:
38 changes: 38 additions & 0 deletions docker/start-op-challenger.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/sh
set -e

if [ $NETWORK = "optimism-goerli" ]
then
DISPUTE_GAME_FACTORY=0x000000000000000000000000000000000000dEaD # TODO: Update after deployment
L2_OUTPUT_ORACLE=0xE6Dfba0953616Bacab0c9A8ecb3a9BBa77FC15c0
elif [ $NETWORK = "base-goerli" ]
then
DISPUTE_GAME_FACTORY=0x000000000000000000000000000000000000dEaD # TODO: Update after deployment
L2_OUTPUT_ORACLE=0x2A35891ff30313CcFa6CE88dcf3858bb075A2298
else
echo "Network not recognized. Available options are optimism-goerli and base-goerli"
exit 1
fi

if [ $OP_CHALLENGER_MODE = "listen-only" ]
then
exec op-challenger \
--l1-ws-endpoint ${L1_WS_RPC_URL} \
--trusted-op-node-endpoint http://magi:${RPC_PORT} \
--dispute-game-factory $DISPUTE_GAME_FACTORY \
--l2-output-oracle $L2_OUTPUT_ORACLE \
--mode listen-only \
-vv
elif [ $OP_CHALLENGER_MODE = "listen-and-respond" ]
then
exec op-challenger \
--l1-ws-endpoint ${L1_WS_RPC_URL} \
--trusted-op-node-endpoint http://magi:${RPC_PORT} \
--signer-key $OP_CHALLENGER_SIGNER_KEY \
--dispute-game-factory $DISPUTE_GAME_FACTORY \
--l2-output-oracle $L2_OUTPUT_ORACLE \
--mode listen-and-respond \
-vv
else
echo "Challenger mode not recognized. Available options are listen-only and listen-and-respond"
fi

0 comments on commit d072876

Please sign in to comment.