-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
120 lines (115 loc) · 4.76 KB
/
Copy pathdocker-compose.yml
File metadata and controls
120 lines (115 loc) · 4.76 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
# Prova backend — full stack in Docker.
#
# Local dev (Postgres container): docker compose up --build
# └─ docker-compose.override.yml is auto-merged and adds a local Postgres + points the app at it.
#
# Managed / external DB (Supabase): docker compose -f docker-compose.yml up --build
# └─ set DATABASE_URL (+ DB_SIMPLE_PROTOCOL=true for a transaction-mode pooler like Supabase).
#
# The API and the on-chain indexer run as separate roles (RUN_MODE) from the SAME image, so the
# stateless API scales horizontally without spawning duplicate indexers. Redis is the shared
# idempotency lock. The ZK prover binary is built once (prover-init) and shared via a volume, so the
# API image stays small.
name: prova-backend
services:
redis:
image: redis:7-alpine
ports:
- '${REDIS_PORT:-6379}:6379'
volumes:
- redisdata:/data
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
interval: 5s
timeout: 5s
retries: 5
restart: unless-stopped
# One-shot: publish the prover binary into a shared volume for the API/indexer to exec.
prover-init:
build:
context: ../circuits/prover
volumes:
- prover-bin:/shared
restart: 'no'
api:
build:
context: ..
dockerfile: backend/Dockerfile
# Pass through EVERY var the user has set in .env (SMTP_*, KYC_*, POOL_*, COMPLIANCE_TOKEN,
# ANCHOR_*, MAINTENANCE_*, …) so new config never silently fails to reach the container just
# because docker-compose.yml wasn't updated. The explicit `environment:` block below only
# supplies container-specific defaults (e.g. PORT, RUN_MODE) and still overrides env_file values.
#
# `required: false` because .env is gitignored — it holds secrets. A fresh clone and CI have no
# such file, and without this the whole compose file fails to even parse there.
env_file:
- path: .env
required: false
environment:
RUN_MODE: api
PORT: '8080'
APP_ENV: ${APP_ENV:-development}
DATABASE_URL: ${DATABASE_URL:-}
DB_SIMPLE_PROTOCOL: ${DB_SIMPLE_PROTOCOL:-false}
REDIS_URL: ${REDIS_URL:-redis://redis:6379/0}
STELLAR_NETWORK: ${STELLAR_NETWORK:-testnet}
SOROBAN_RPC_URL: ${SOROBAN_RPC_URL:-https://soroban-testnet.stellar.org}
CONTRACT_ID: ${CONTRACT_ID:-}
PROVER_BIN: /opt/prover/prova-prover
# Transfer relayer: in Docker set RELAYER_KEY to the funded Stellar SECRET seed (S…) so the
# bundled `stellar` CLI signs with it directly (no keystore/identity needed).
RELAYER_KEY: ${RELAYER_KEY:-}
STELLAR_BIN: stellar
ANCHOR_SEED: ${ANCHOR_SEED:-}
AUTH_MODE: ${AUTH_MODE:-development}
DEV_OTP: ${DEV_OTP:-000000}
ports:
- '${API_PORT:-8080}:8080'
volumes:
- prover-bin:/opt/prover:ro
depends_on:
redis:
condition: service_started
prover-init:
condition: service_completed_successfully
restart: unless-stopped
indexer:
build:
context: ..
dockerfile: backend/Dockerfile
env_file:
- path: .env
required: false
environment:
RUN_MODE: indexer
APP_ENV: ${APP_ENV:-development}
DATABASE_URL: ${DATABASE_URL:-}
DB_SIMPLE_PROTOCOL: ${DB_SIMPLE_PROTOCOL:-false}
STELLAR_NETWORK: ${STELLAR_NETWORK:-testnet}
SOROBAN_RPC_URL: ${SOROBAN_RPC_URL:-https://soroban-testnet.stellar.org}
CONTRACT_ID: ${CONTRACT_ID:-}
# Nothing in this role actually uses Redis — it backs the rate limiter and transfer
# idempotency, and the indexer serves no HTTP. But without the URL it dials localhost, fails,
# and logs "redis unavailable" on every boot, which is a red herring for anyone debugging a
# stuck fold. Point it at the real one so the warning means something when it appears.
REDIS_URL: ${REDIS_URL:-redis://redis:6379/0}
# The folder runs in THIS role (see cmd/api/main.go — it starts under RunsIndexer), and every
# fold is a ZK proof, so the indexer needs the prover just as much as the API does.
#
# Without it the failure is silent and total: deposits land in the contract's queue, the folder
# wakes every 8 s, cannot produce a proof, and no note is ever folded into the Merkle tree. The
# tree stays empty, /pool/path returns nothing, and every send fails — while the API looks
# perfectly healthy, because the API's own copy of the prover is present and unused for this.
PROVER_BIN: /opt/prover/prova-prover
volumes:
- prover-bin:/opt/prover:ro
depends_on:
redis:
condition: service_started
# Wait for the binary to exist rather than racing it into the volume.
prover-init:
condition: service_completed_successfully
restart: unless-stopped
volumes:
prover-bin:
redisdata: