-
Notifications
You must be signed in to change notification settings - Fork 114
Expand file tree
/
Copy pathdocker-compose.mainnet.yml
More file actions
142 lines (133 loc) · 5.71 KB
/
Copy pathdocker-compose.mainnet.yml
File metadata and controls
142 lines (133 loc) · 5.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
services:
snapchain:
image: farcasterxyz/snapchain:latest
pull_policy: always
# build: # For testing
# context: .
# dockerfile: Dockerfile
init: true # Auto-reap zombie processes and forward process signals
environment:
RUST_BACKTRACE: "full"
# Onchain-config controls. On by default — set ONCHAIN_CONFIG_ENABLED=false
# to opt out and make the config written below win verbatim. Declared here
# (not only interpolated inside the entrypoint text) so both override
# paths work: export in the host shell / .env, or set the values directly
# on these lines. Interpolating ${VAR:-} in the entrypoint alone would
# bake an empty assignment at compose-parse time that silently overrides
# an environment: entry.
ONCHAIN_CONFIG_ENABLED: "${ONCHAIN_CONFIG_ENABLED:-}"
ONCHAIN_CONFIG_REGISTRY: "${ONCHAIN_CONFIG_REGISTRY:-}"
ONCHAIN_CONFIG_RPC_URL: "${ONCHAIN_CONFIG_RPC_URL:-}"
# Validators whose bootstrap peers are private addresses the registry's
# public list can't carry (e.g. VPC-internal) set this to true to keep a
# non-empty local gossip.bootstrap_peers through the merge;
# validator_sets and direct_peers stay registry-managed either way.
ONCHAIN_CONFIG_ACCEPT_LOCAL_BOOTSTRAP_PEERS: "${ONCHAIN_CONFIG_ACCEPT_LOCAL_BOOTSTRAP_PEERS:-}"
entrypoint:
- "/bin/bash"
- "-c"
- |
#!/bin/bash
set -euo pipefail
cat > config.toml <<EOF
rpc_address="0.0.0.0:3383"
http_address="0.0.0.0:3381"
rocksdb_dir=".rocks"
fc_network="Mainnet"
read_node = true
[statsd]
prefix="snapchain"
addr="statsd:8125"
use_tags=true
[gossip]
address="/ip4/0.0.0.0/udp/3382/quic-v1"
bootstrap_peers = "/ip4/54.236.164.51/udp/3382/quic-v1, /ip4/54.87.204.167/udp/3382/quic-v1, /ip4/44.197.255.20/udp/3382/quic-v1, /ip4/54.157.62.17/udp/3382/quic-v1, /ip4/34.195.157.114/udp/3382/quic-v1, /ip4/107.20.169.236/udp/3382/quic-v1, /ip4/35.212.102.55/udp/3382/quic-v1, /ip4/35.157.151.56/udp/3382/quic-v1, /ip4/108.132.114.186/udp/3382/quic-v1"
[consensus]
shard_ids = [1,2]
num_shards = 2
[snapshot]
endpoint_url = "https://e1f9f185c6e63471dd39f96abd3413c4.r2.cloudflarestorage.com"
load_db_from_snapshot=true
EOF
# Append validator sets from the dedicated validators.toml file.
# See validators.toml for the full history of validator changes and operator details.
cat /app/validators.toml >> config.toml
# Merge registry-managed validator config. On by default; no-op on
# read nodes, and ONCHAIN_CONFIG_ENABLED=false opts out entirely (see
# the script header — the ONCHAIN_CONFIG_* controls come from the
# environment: block above). Running this as a validator wants
# ONCHAIN_CONFIG_RPC_URL: the heredoc above writes no l1_rpc_url, so
# fc's mainnet fallback has nothing to read and the pull fails
# (loudly) every boot, leaving the static config in charge until it
# is set.
# The -x guard keeps `docker compose pull && up` safe while the pinned
# :latest image predates the script (compose files ship on main,
# images on release tags): with the feature on by default, an old
# image just boots its static config. Only an EXPLICIT enable refuses
# on a missing script — an operator who asked for the pull must not
# silently boot on potentially stale static config.
if [ -x /app/apply-onchain-config.sh ]; then
ONCHAIN_CONFIG_CACHE=/app/.onchain-config/config.mainnet.toml \
/app/apply-onchain-config.sh config.toml || exit 1
elif [ "$${ONCHAIN_CONFIG_ENABLED:-}" = "true" ] || [ "$${ONCHAIN_CONFIG_ENABLED:-}" = "1" ]; then
echo "ONCHAIN_CONFIG_ENABLED is set but this image has no /app/apply-onchain-config.sh; refusing to boot" >&2
exit 1
fi
exec $0 $@ # Now run the original command
command: [ "./snapchain", "--config-path", "config.toml" ]
restart: always
ports:
- "3381:3381/tcp"
- "3382:3382/udp"
- "3383:3383/tcp"
volumes:
- .rocks:/app/.rocks
- .rocks.snapshot:/app/.rocks.snapshot
- .onchain-config:/app/.onchain-config
- ./validators.toml:/app/validators.toml:ro
networks:
- snapchain
ulimits:
nofile:
soft: 65535
hard: 65535
# Start this if you want perf metrics for your hubble node. Remember to start `grafana` as well.
statsd:
image: graphiteapp/graphite-statsd:1.1.10-5
restart: unless-stopped
healthcheck:
test: ["CMD", "nc", "-zv", "localhost", "8126"]
interval: 30s
timeout: 5s
retries: 3
start_period: 1m
ports:
# - '80:80' # Graphite web
# - '2003:2003' # Carbon line receiver
# - '2004:2004' # Carbon pickle receiver
# - '7002:7002' # Carbon cache query
- '${STATSD_PUBLISH:-8125}:8125/udp' # StatsD
- '${STATSD_ADMIN_PUBLISH:-8126}:8126' # StatsD admin
networks:
- snapchain
# Start this if you want to see perf metrics for your hubble node. Remember to start `statsd` as well.
grafana:
image: grafana/grafana:10.0.3
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "localhost:3000/api/health"]
interval: 30s
timeout: 5s
retries: 3
start_period: 1m
# Mount the grafana config file
volumes:
- ./grafana/grafana.ini:/etc/grafana/grafana.ini
- ./grafana/data:/var/lib/grafana # Persistent Grafana data
ports:
- '3000:3000' # Grafana web
networks:
- snapchain
networks:
snapchain:
driver: bridge