Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
143 lines (138 loc) · 4.22 KB
/
Copy pathdocker-compose.yml
File metadata and controls
143 lines (138 loc) · 4.22 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
# docker-compose.yml
#
# Resource limits (deploy.resources.limits) below are set for local/production
# parity and to prevent an unbounded container from starving its siblings or
# OOM-killing unrelated processes on a shared CI runner or a developer machine:
#
# - backend: 0.5 vCPU / 1024 MiB — intentionally mirrors infra/variables.tf's
# backend_cpu (512 CPU units) / backend_memory (1024 MiB) defaults,
# which size the production ECS Fargate task in infra/ecs.tf. This
# lets memory-pressure bugs surface locally instead of only in prod.
# - postgres: 1 vCPU / 1 GiB — headroom for local dev workloads without being
# able to consume the whole host.
# - redis: 0.5 vCPU / 512 MiB — cache + rate-limit store; bounded to avoid
# unbounded local growth.
# - frontend: 0.25 vCPU / 256 MiB — lightweight, just Vite/Nginx serving static
# assets.
#
# If your environment needs more headroom (e.g. running the full stack plus an
# IDE and other tooling), raise the relevant `limits` values locally — see
# CONTRIBUTING.md.
services:
postgres:
image: postgres:15-alpine
restart: unless-stopped
environment:
POSTGRES_DB: future_remittance
POSTGRES_USER: future_admin
POSTGRES_PASSWORD: dev_password
ports:
- "5432:5432"
volumes:
- db_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U future_admin -d future_remittance"]
interval: 5s
timeout: 5s
retries: 10
deploy:
resources:
limits:
cpus: "1.0"
memory: 1G
reservations:
cpus: "0.25"
memory: 256M
redis:
image: redis:7-alpine
restart: unless-stopped
ports:
- "6379:6379"
healthcheck:
test: ["CMD-SHELL", "redis-cli ping"]
interval: 5s
timeout: 5s
retries: 5
deploy:
resources:
limits:
cpus: "0.5"
memory: 512M
reservations:
cpus: "0.1"
memory: 128M
backend:
build:
context: ./backend
dockerfile: Dockerfile.dev
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
ports:
- "3001:3001"
volumes:
- ./backend/src:/app/src
- ./backend/prisma:/app/prisma
deploy:
resources:
limits:
# Mirrors infra/variables.tf backend_cpu/backend_memory defaults
# (512 CPU units = 0.5 vCPU, 1024 MiB) so local memory-pressure
# behavior matches the production Fargate task.
cpus: "0.5"
memory: 1024M
reservations:
cpus: "0.25"
memory: 512M
environment:
APP_ENV: development
PORT: 3001
TZ: UTC
DATABASE_URL: postgresql://future_admin:dev_password@postgres:5432/future_remittance
REDIS_URL: redis://redis:6379
STELLAR_NETWORK: testnet
HORIZON_URL: https://horizon-testnet.stellar.org
ALLOWED_ORIGINS: http://localhost:3000
JWT_SECRET: dev-jwt-secret-change-me
STREAM_SECRET_ENCRYPTION_KEY: "0000000000000000000000000000000000000000000000000000000000000000"
FEE_BUMP_THRESHOLD_XLM: "2"
LOG_LEVEL: info
CACHE_TTL_BALANCE_S: "30"
RATE_CACHE_TTL_S: "60"
CACHE_TTL_FEE_S: "120"
RATE_LIMIT_WINDOW_MS: "60000"
RATE_LIMIT_MAX: "100"
DB_POOL_MAX: "10"
DB_SHARD_COUNT: "1"
CDN_ENABLED: "false"
command: sh -c "npx prisma migrate deploy && node --watch src/server.js"
frontend:
build:
context: ./frontend
dockerfile: Dockerfile.dev
restart: unless-stopped
depends_on:
- backend
ports:
# Local Vite (Dockerfile.dev) listens on 3000. The production
# frontend/Dockerfile nginx runtime listens on 8080 as non-root.
- "3000:3000"
volumes:
- ./frontend/src:/app/src
- ./frontend/public:/app/public
- ./frontend/index.html:/app/index.html
environment:
VITE_API_URL: http://localhost:3001
deploy:
resources:
limits:
cpus: "0.25"
memory: 256M
reservations:
cpus: "0.1"
memory: 128M
volumes:
db_data: