Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
130 lines (124 loc) · 3.93 KB
/
Copy pathdocker-compose.yml
File metadata and controls
130 lines (124 loc) · 3.93 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
# Default `docker compose up` starts just the backend (needs a .env).
# `docker compose --profile local-stack up backend-local` starts the whole platform locally
# (Stellar node, contract deployer, Postgres, backend, frontend) — see
# docs/LOCAL_STACK.md (#662).
services:
backend:
build:
context: .
target: production
ports:
- "3001:3001"
env_file:
- .env
environment:
- NODE_ENV=production
- PORT=3001
- PROJECT_REGISTRY_CONTRACT_ID=${PROJECT_REGISTRY_CONTRACT_ID}
# Keep the V8 heap ceiling under the container memory limit below (#225).
- NODE_OPTIONS=--max-old-space-size=384
# Production images contain the compiled application; never bind-mount
# the host source tree into this service.
restart: unless-stopped
# Resource limits (#225). Compose v2 honours deploy.resources outside swarm,
# so these apply to a plain `docker compose up`.
deploy:
resources:
limits:
cpus: "0.5"
memory: 512M
reservations:
cpus: "0.25"
memory: 256M
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:3001/health"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
# ── Local full stack (profile: local-stack) ────────────────────────────────
stellar:
profiles: [local-stack]
image: stellar/quickstart:latest
command: ["--local", "--enable", "rpc,core,friendbot"]
ports:
- "8000:8000"
healthcheck:
test: ["CMD", "curl", "-sf", "http://localhost:8000/soroban/rpc", "-X", "POST", "-H", "Content-Type: application/json", "-d", '{"jsonrpc":"2.0","id":1,"method":"getHealth"}']
interval: 10s
timeout: 5s
retries: 30
start_period: 30s
postgres:
profiles: [local-stack]
image: postgres:16-alpine
environment:
POSTGRES_DB: heliobond_dev
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d heliobond_dev"]
interval: 5s
timeout: 3s
retries: 10
# One-shot: builds + deploys the contracts, funds accounts, writes /stack/contracts.env.
deployer:
profiles: [local-stack]
image: stellar/stellar-cli:latest
user: root
entrypoint: ["/bin/sh", "/deploy.sh"]
environment:
RPC_URL: http://stellar:8000/soroban/rpc
volumes:
- ${CONTRACTS_DIR:-../contracts}:/contracts
- ./scripts/local-stack/deploy.sh:/deploy.sh:ro
- stack:/stack
depends_on:
stellar:
condition: service_healthy
backend-local:
profiles: [local-stack]
build:
context: .
target: production
ports:
- "3001:3001"
environment:
NODE_ENV: development
PORT: "3001"
DB_HOST: postgres
DB_NAME: heliobond_dev
DB_USER: postgres
DB_PASSWORD: postgres
ADMIN_API_KEY: ${ADMIN_API_KEY:-local-admin-key}
CORS_ORIGIN: http://localhost:3000
volumes:
- stack:/stack:ro
# contracts.env (written by `deployer`) supplies the contract ids, RPC URL and admin key.
command: ["sh", "-c", "set -a; . /stack/contracts.env; set +a; exec node dist/index.js"]
depends_on:
postgres:
condition: service_healthy
deployer:
condition: service_completed_successfully
# Optional: set FRONTEND_DIR to a checkout of the frontend repo.
frontend:
profiles: [local-stack-frontend]
build:
context: ${FRONTEND_DIR:-../frontend}
ports:
- "3000:3000"
environment:
NEXT_PUBLIC_API_URL: http://localhost:3001
NEXT_PUBLIC_RPC_URL: http://localhost:8000/soroban/rpc
NEXT_PUBLIC_NETWORK_PASSPHRASE: "Standalone Network ; February 2017"
volumes:
- stack:/stack:ro
depends_on:
backend-local:
condition: service_started
volumes:
pgdata:
stack: