-
Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
180 lines (172 loc) · 6.05 KB
/
Copy pathdocker-compose.yml
File metadata and controls
180 lines (172 loc) · 6.05 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
services:
# ── Backend ────────────────────────────────────────────────────────────────
backend:
build:
context: .
dockerfile: Dockerfile.dev
container_name: workload-governor-backend
command: npx ts-node --watch src/index.ts
environment:
NODE_ENV: development
PORT: ${PORT:-3000}
DATABASE_URL: postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@postgres:5432/${POSTGRES_DB:-workload_governor}
REDIS_URL: redis://redis:6379
SOROBAN_RPC_URL: http://stellar:8000/soroban/rpc
STELLAR_NETWORK_PASSPHRASE: ${STELLAR_NETWORK_PASSPHRASE:-Standalone Network ; February 2017}
CONTRACT_ID: ${CONTRACT_ID:-}
ports:
- "${PORT:-3000}:3000"
volumes:
- ./src:/app/src:ro
- ./package.json:/app/package.json:ro
- ./tsconfig.json:/app/tsconfig.json:ro
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
stellar:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:${PORT:-3000}/health || exit 1"]
interval: 15s
timeout: 5s
retries: 5
start_period: 30s
networks:
- workload-governor-network
restart: unless-stopped
# ── PostgreSQL 15 ──────────────────────────────────────────────────────────
postgres:
image: postgres:${POSTGRES_VERSION:-16}-alpine
container_name: workload-governor-postgres
environment:
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
POSTGRES_DB: ${POSTGRES_DB:-workload_governor}
ports:
- "${POSTGRES_PORT:-5432}:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres} -d ${POSTGRES_DB:-workload_governor}"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
networks:
- workload-governor-network
restart: unless-stopped
# ── Redis 7 ────────────────────────────────────────────────────────────────
redis:
image: redis:7-alpine
container_name: workload-governor-redis
command: redis-server --appendonly yes
ports:
- "${REDIS_PORT:-6379}:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
start_period: 5s
networks:
- workload-governor-network
restart: unless-stopped
# ── Stellar Quickstart (local Soroban RPC) ────────────────────────────────
stellar:
image: stellar/quickstart:latest
container_name: workload-governor-stellar
platform: linux/amd64
command: --standalone --enable-soroban-rpc
environment:
ENABLE_LOGS: "true"
ports:
- "${STELLAR_PORT:-8000}:8000"
volumes:
- stellar_data:/opt/stellar
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:8000/health || exit 1"]
interval: 15s
timeout: 10s
retries: 10
start_period: 60s
networks:
- workload-governor-network
restart: unless-stopped
# ── pgAdmin (optional dev tool) ────────────────────────────────────────────
pgadmin:
image: dpage/pgadmin4:latest
container_name: workload-governor-pgadmin
environment:
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_EMAIL:-admin@example.com}
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_PASSWORD:-admin}
ports:
- "${PGADMIN_PORT:-5050}:80"
depends_on:
postgres:
condition: service_healthy
networks:
- workload-governor-network
profiles:
- tools
# ── Event Indexer (issue #194) ────────────────────────────────────────────
event-indexer:
build:
context: .
dockerfile: Dockerfile.dev
container_name: workload-governor-indexer
command: npx ts-node src/eventIndexer.ts
environment:
NODE_ENV: development
DATABASE_URL: postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@postgres:5432/${POSTGRES_DB:-workload_governor}
HORIZON_URL: ${HORIZON_URL:-https://horizon-testnet.stellar.org}
CONTRACT_ID: ${CONTRACT_ID:-}
volumes:
- ./src:/app/src:ro
- ./package.json:/app/package.json:ro
- ./tsconfig.json:/app/tsconfig.json:ro
depends_on:
postgres:
condition: service_healthy
networks:
- workload-governor-network
restart: unless-stopped
# Test runner service — used by:
# docker compose up --abort-on-container-exit test
# Runs the full Jest integration test suite against real Postgres + Redis.
test:
image: node:20-alpine
container_name: workload-governor-test
working_dir: /app
command: ["sh", "-c", "npm ci && npm test -- --forceExit"]
environment:
NODE_ENV: test
DATABASE_URL: postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@postgres:5432/${POSTGRES_DB:-workload_governor}
REDIS_URL: redis://redis:6379
ADMIN_TOKEN: ${ADMIN_TOKEN:-test-admin-token}
GITHUB_WEBHOOK_SECRET: ${GITHUB_WEBHOOK_SECRET:-test-secret}
volumes:
- .:/app
- /app/node_modules
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
networks:
- workload-governor-network
profiles:
- test
volumes:
postgres_data:
driver: local
redis_data:
driver: local
stellar_data:
driver: local
networks:
workload-governor-network:
driver: bridge