-
Notifications
You must be signed in to change notification settings - Fork 128
Expand file tree
/
Copy pathdocker-compose.dev.yml
More file actions
153 lines (146 loc) · 5.34 KB
/
docker-compose.dev.yml
File metadata and controls
153 lines (146 loc) · 5.34 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
version: '3.8'
# ─────────────────────────────────────────────────────────────────────────────
# MyFans — Local Development Stack
#
# Quick start:
# cp .env.dev.example .env.dev # fill in JWT_SECRET at minimum
# docker compose --profile dev up
#
# Useful commands:
# docker compose --profile dev up -d # start in background
# docker compose --profile dev logs -f # tail all logs
# docker compose --profile dev down -v # stop and remove volumes
# docker compose --profile dev run --rm seed # re-run demo seed
#
# Services:
# postgres — PostgreSQL 15 (port 5432)
# redis — Redis 7 in-memory cache (port 6379)
# backend — NestJS API with hot-reload (port 3001)
# seed — one-shot demo data seeder (runs after migrations)
#
# Health endpoints (once backend is up):
# GET http://localhost:3001/v1/health
# GET http://localhost:3001/v1/health/detailed
# GET http://localhost:3001/v1/health/db
# GET http://localhost:3001/v1/health/redis
# ─────────────────────────────────────────────────────────────────────────────
env_file:
- .env.dev
services:
# ── PostgreSQL ──────────────────────────────────────────────────────────────
postgres:
image: postgres:15-alpine
container_name: myfans-db-dev
profiles: [dev]
environment:
POSTGRES_USER: ${DB_USER:-postgres}
POSTGRES_PASSWORD: ${DB_PASSWORD:-postgres}
POSTGRES_DB: ${DB_NAME:-myfans}
ports:
- "5432:5432"
volumes:
- postgres_dev_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-postgres}"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
# ── Redis ───────────────────────────────────────────────────────────────────
redis:
image: redis:7-alpine
container_name: myfans-redis-dev
profiles: [dev]
ports:
- "6379:6379"
volumes:
- redis_dev_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
# ── Backend (NestJS hot-reload) ─────────────────────────────────────────────
backend:
build:
context: ./backend
dockerfile: Dockerfile.dev
container_name: myfans-backend-dev
profiles: [dev]
environment:
NODE_ENV: development
DB_HOST: postgres
DB_PORT: ${DB_PORT:-5432}
DB_USER: ${DB_USER:-postgres}
DB_PASSWORD: ${DB_PASSWORD:-postgres}
DB_NAME: ${DB_NAME:-myfans}
REDIS_HOST: redis
REDIS_PORT: 6379
JWT_SECRET: ${JWT_SECRET}
PORT: ${PORT:-3001}
STELLAR_NETWORK: ${STELLAR_NETWORK:-testnet}
SOROBAN_RPC_URL: ${SOROBAN_RPC_URL:-https://soroban-testnet.stellar.org}
SOROBAN_RPC_TIMEOUT: ${SOROBAN_RPC_TIMEOUT:-5000}
STARTUP_MODE: ${STARTUP_MODE:-degraded}
STARTUP_PROBE_DB: "true"
STARTUP_PROBE_RPC: "false"
CORS_ALLOWED_ORIGINS: ${CORS_ALLOWED_ORIGINS:-http://localhost:3000,http://localhost:3001}
FEATURE_SOROBAN_POLLER: ${FEATURE_SOROBAN_POLLER:-false}
ports:
- "${PORT:-3001}:${PORT:-3001}"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
volumes:
- ./backend:/app
- /app/node_modules
command: npm run start:dev
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:${PORT:-3001}/v1/health || exit 1"]
interval: 15s
timeout: 5s
start_period: 45s
retries: 5
restart: unless-stopped
# ── Demo seed (one-shot) ────────────────────────────────────────────────────
# Runs migrations then seeds demo creator accounts.
# Re-run manually: docker compose --profile dev run --rm seed
seed:
build:
context: ./backend
dockerfile: Dockerfile.dev
container_name: myfans-seed-dev
profiles: [dev]
environment:
NODE_ENV: development
DB_HOST: postgres
DB_PORT: ${DB_PORT:-5432}
DB_USER: ${DB_USER:-postgres}
DB_PASSWORD: ${DB_PASSWORD:-postgres}
DB_NAME: ${DB_NAME:-myfans}
depends_on:
postgres:
condition: service_healthy
backend:
condition: service_healthy
volumes:
- ./backend:/app
- /app/node_modules
# Run migrations first, then seed demo data
command: >
sh -c "
echo '[seed] running migrations...' &&
npm run migration:run &&
echo '[seed] seeding demo creators...' &&
npm run seed:demo &&
echo '[seed] done'
"
restart: "no"
volumes:
postgres_dev_data:
name: myfans_postgres_dev_data
redis_dev_data:
name: myfans_redis_dev_data