Repository navigation
Expand file tree
/
Copy pathdocker-compose.dev.yml
More file actions
150 lines (142 loc) · 5.37 KB
/
Copy pathdocker-compose.dev.yml
File metadata and controls
150 lines (142 loc) · 5.37 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
143
144
145
146
147
148
149
150
# docker-compose.dev.yml — #1663 Local development environment.
#
# Brings up a complete local QuorumProof stack:
#
# stellar-standalone — Stellar quickstart node (port 8000, Soroban RPC enabled)
# postgres — PostgreSQL 16 for the API server (port 5432)
# api-server — TypeScript API server with src/ mounted for live reload (port 3000)
# frontend — Vite/React frontend with src/ mounted for HMR (port 5173)
#
# Quick start:
# docker compose -f docker-compose.dev.yml up
#
# Start just the dependencies (Stellar + Postgres) and run services locally:
# docker compose -f docker-compose.dev.yml up stellar-standalone postgres -d
#
# Notes:
# - The frontend service builds from frontend/Dockerfile.dev. If that file
# is missing, build it first:
# docker build -t quorumproof-frontend-dev -f frontend/Dockerfile.dev frontend/
# - The api-server service builds from api-server/Dockerfile (production
# Dockerfile) and mounts ./api-server/src for live reload via nodemon.
# Ensure your api-server package.json has a "dev" script that uses nodemon
# or tsx watch, e.g.: "dev": "nodemon --exec tsx src/index.ts"
# - Never commit real secrets into this file. The Postgres password is read
# from the git-ignored .env file (POSTGRES_PASSWORD). Generate a random
# value on first run, e.g.:
# echo "POSTGRES_PASSWORD=$(openssl rand -hex 16)" >> .env
# The compose file fails fast if POSTGRES_PASSWORD is not set.
version: "3.8"
services:
# ── Stellar standalone node ────────────────────────────────────────────────
# Runs a full Stellar + Soroban RPC node locally.
# Soroban RPC is reachable at http://localhost:8000/soroban/rpc (matches
# the [standalone] rpc_url in environments.toml).
stellar-standalone:
image: stellar/quickstart:testing
ports:
- "8000:8000"
environment:
NETWORK: standalone
ENABLE_SOROBAN_RPC: "true"
USE_DEFAULT_PEER_PORT: "true"
networks:
- dev
healthcheck:
test:
- "CMD"
- "wget"
- "-qO-"
- "http://localhost:8000/soroban/rpc"
interval: 10s
timeout: 5s
retries: 15
start_period: 30s
restart: unless-stopped
# ── PostgreSQL 16 ──────────────────────────────────────────────────────────
postgres:
image: postgres:16-alpine
ports:
- "5432:5432"
environment:
POSTGRES_DB: quorumproof
POSTGRES_USER: qp
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD must be set in .env}
volumes:
- postgres-data:/var/lib/postgresql/data
networks:
- dev
healthcheck:
test: ["CMD-SHELL", "pg_isready -U qp -d quorumproof"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
restart: unless-stopped
# ── API server ─────────────────────────────────────────────────────────────
# Built from api-server/Dockerfile (production Dockerfile).
# ./api-server/src is mounted into the container so source edits are visible
# without rebuilding the image — requires the api-server to run via a file
# watcher (e.g. nodemon/tsx watch) in dev mode.
api-server:
build:
context: ./api-server
dockerfile: Dockerfile
ports:
- "3000:3000"
env_file:
- .env
environment:
NODE_ENV: development
PORT: 3000
# Point the API server at the local standalone Stellar node
STELLAR_NETWORK: standalone
STELLAR_RPC_URL: http://stellar-standalone:8000/soroban/rpc
# Point at the local Postgres instance
DATABASE_URL: postgres://qp:${POSTGRES_PASSWORD}@postgres:5432/quorumproof
volumes:
# Mount source for live reload (works with nodemon / tsx watch)
- ./api-server/src:/app/src
depends_on:
stellar-standalone:
condition: service_healthy
postgres:
condition: service_healthy
networks:
- dev
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:3000/health"]
interval: 15s
timeout: 5s
retries: 5
start_period: 20s
restart: unless-stopped
# ── Frontend ───────────────────────────────────────────────────────────────
# Built from frontend/Dockerfile.dev for hot-module-replacement (HMR).
# ./frontend/src is mounted so edits appear instantly in the browser.
#
# If you prefer to build the image manually:
# docker build -t quorumproof-frontend-dev -f frontend/Dockerfile.dev frontend/
frontend:
build:
context: ./frontend
dockerfile: Dockerfile.dev
ports:
- "5173:5173"
environment:
VITE_STELLAR_NETWORK: standalone
VITE_STELLAR_RPC_URL: http://localhost:8000/soroban/rpc
volumes:
# Mount source for Vite HMR
- ./frontend/src:/app/src
depends_on:
- api-server
networks:
- dev
restart: unless-stopped
networks:
dev:
driver: bridge
volumes:
# Postgres data persisted across container restarts
postgres-data: