-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathdocker-compose.fake.yml
More file actions
142 lines (131 loc) · 6.22 KB
/
Copy pathdocker-compose.fake.yml
File metadata and controls
142 lines (131 loc) · 6.22 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
# Integration mini-stack (issue #54, tier 3).
#
# Runs the REAL dashboard + the REAL docker-control/-proxy socket proxies against CONTROLLABLE
# fake monerod/Tari, with lightweight p2pool/xmrig-proxy containers the dashboard can actually
# stop/start. This reproduces the runtime control plane end-to-end — sync-hold/release (#35) and
# node-down → reject → readmit (#31) — deterministically, in CI, with no real chain or test box.
#
# Driven by run-mini-stack.sh. The dashboard and the fakes share one image (the dashboard's,
# which already has mining_dashboard + grpc installed, so fake_tari can use the vendored stubs).
name: pithead-itest
x-fake-image: &fake_image pithead-dashboard:itest
networks:
itestnet:
driver: bridge
volumes:
dashboard_data:
dashboard_stats:
services:
# The real dashboard, pointed at the fakes and the socket proxies. Fast loop + short debounce
# so scenarios converge in seconds. Binds 127.0.0.1:8000 inside the container; the runner
# reads /api/state via `compose exec`, so no published port is needed.
dashboard:
build: ../../../build/dashboard
image: *fake_image
container_name: itest-dashboard
networks: [itestnet]
# Mirror production's immutable rootfs (#377): the mini-stack e2e then proves the REAL dashboard
# code runs — writes history, drops markers, serves /api/state — with its rootfs read-only and
# only /tmp + the volumes writable.
read_only: true
tmpfs:
- /tmp:size=64m,mode=1777
volumes:
- dashboard_data:/data
- dashboard_stats:/app/stats:ro
environment:
HOST_IP: "127.0.0.1"
TZ: "Etc/UTC"
MONERO_RPC_URL: "http://fake-monerod:18081"
MONERO_NODE_USERNAME: ""
MONERO_NODE_PASSWORD: ""
MONERO_NODE_HOST: "fake-monerod"
# Must equal MONERO_NODE_HOST so the dashboard takes the "local" RPC-driven path
# (mining_dashboard.collector.logs.get_monero_sync_status) instead of the "remote" path,
# which never probes reachability and makes monerod-down/#31/#564 a silent no-op — the
# fake-monerod container below was wired at the network level but never actually read for
# node-health without this.
LOCAL_MONERO_HOST: "fake-monerod"
MONERO_PRUNE: "true"
TARI_GRPC_ADDRESS: "fake-tari:18142"
DOCKER_PROXY_URL: "tcp://docker-proxy:2375"
DOCKER_CONTROL_URL: "tcp://docker-control:2375"
# Namespaced container names so the mini-stack never collides with — or controls — a real
# deployment's p2pool/xmrig-proxy on the same host.
SYNC_GATE_CONTAINERS: "itest-p2pool,itest-xmrig-proxy"
REJECT_WORKERS_CONTAINER: "itest-xmrig-proxy"
# Overridable (scenario 11, #562) since it's baked in at container boot — a live toggle
# isn't possible, so that scenario recreates the stack with TARI_REQUIRED=false.
TARI_REQUIRED: "${TARI_REQUIRED:-true}"
XVB_ENABLED: "false"
XVB_POOL_URL: ""
XVB_DONOR_ID: ""
P2POOL_URL: "itest-p2pool:3333"
MONERO_WALLET_ADDRESS: "49iTestWalletPlaceholderXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
PROXY_HOST: "xmrig-proxy"
PROXY_API_PORT: "3344"
PROXY_AUTH_TOKEN: "itest"
UPDATE_INTERVAL: "2"
NODE_DOWN_AFTER_SEC: "4"
NODE_RECOVERY_AFTER_SEC: "3"
# Healthchecks.io dead-man's switch (#79), pointed at the fake receiver so the e2e proves the
# REAL loop fires a heartbeat over a real HTTP call (not a mock). The ping URL is the on switch;
# the first ping fires immediately (throttle starts unarmed). There's no Tor container here, so
# blank the shared TOR_SOCKS_PROXY — the client then pings the fake receiver directly.
HEALTHCHECKS_PING_URL: "http://fake-hc:9000/ph"
TOR_SOCKS_PROXY: ""
depends_on: [fake-monerod, fake-tari, docker-control, docker-proxy, p2pool, xmrig-proxy, fake-hc]
fake-monerod:
image: *fake_image
container_name: itest-fake-monerod
networks: [itestnet]
entrypoint: []
# Boot mid-sync so the dashboard holds the miner; the runner flips it to synced/down.
command: ["python3", "/fakes/fake_monerod.py", "--port", "18081", "--mode", "syncing"]
ports: ["28081:18081"] # 28081 on the host (avoids a real monerod's 18081), → 18081 inside
volumes: ["../fakes:/fakes:ro"]
fake-tari:
image: *fake_image
container_name: itest-fake-tari
networks: [itestnet]
entrypoint: []
command: ["python3", "/fakes/fake_tari.py", "--grpc-port", "18142", "--control-port", "18152", "--mode", "syncing"]
ports: ["28152:18152"] # HTTP control side-channel on host 28152
volumes: ["../fakes:/fakes:ro"]
# Stand-ins for the miner containers: real, named containers the dashboard genuinely
# stops/starts via docker-control. They just idle.
p2pool:
image: busybox:1.36
container_name: itest-p2pool
networks: [itestnet]
command: ["sh", "-c", "while true; do sleep 30; done"]
xmrig-proxy:
image: busybox:1.36
container_name: itest-xmrig-proxy
networks: [itestnet]
command: ["sh", "-c", "while true; do sleep 30; done"]
# Fake Healthchecks.io ping receiver (#79 e2e): records each ping path to a file the runner greps
# via `compose exec`. Logs to /tmp (world-writable — the image runs non-root, uid 1000 #255, so a
# root-owned named volume wouldn't be writable). Shares the dashboard image; stdlib-only, no deps.
fake-hc:
image: *fake_image
container_name: itest-fake-hc
networks: [itestnet]
entrypoint: []
command: ["python3", "/fakes/fake_hc.py", "--port", "9000", "--log", "/tmp/pings.log"]
volumes:
- "../fakes:/fakes:ro"
# Read-only socket proxy (stats/logs) — mirrors the production docker-proxy.
docker-proxy:
image: tecnativa/docker-socket-proxy:v0.4.2
container_name: itest-docker-proxy
networks: [itestnet]
environment: ["CONTAINERS=1", "LOGS=1"]
volumes: ["/var/run/docker.sock:/var/run/docker.sock:ro"]
# Write proxy scoped to start/stop only — mirrors the production docker-control.
docker-control:
image: tecnativa/docker-socket-proxy:v0.4.2
container_name: itest-docker-control
networks: [itestnet]
environment: ["POST=1", "ALLOW_START=1", "ALLOW_STOP=1"]
volumes: ["/var/run/docker.sock:/var/run/docker.sock:ro"]