-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.staging.yml
More file actions
150 lines (140 loc) · 4.14 KB
/
docker-compose.staging.yml
File metadata and controls
150 lines (140 loc) · 4.14 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
version: '3.8'
# SprintForge Staging Environment - Home Server
# Designed for sprint demos and internal testing
# Uses Cloudflare Tunnel for secure public access
services:
# PostgreSQL Database (Persistent)
postgres:
image: postgres:15-alpine
container_name: sprintforge-staging-db
restart: unless-stopped
environment:
POSTGRES_DB: sprintforge_staging
POSTGRES_USER: sprintforge
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-staging_password_change_me}
PGDATA: /var/lib/postgresql/data/pgdata
volumes:
- ./data/postgres-staging:/var/lib/postgresql/data
networks:
- staging_network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U sprintforge"]
interval: 10s
timeout: 5s
retries: 5
# Redis Cache
redis:
image: redis:7-alpine
container_name: sprintforge-staging-redis
restart: unless-stopped
volumes:
- ./data/redis-staging:/data
networks:
- staging_network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 5
# FastAPI Backend
backend:
build:
context: ./backend
dockerfile: Dockerfile.staging
container_name: sprintforge-staging-backend
restart: unless-stopped
environment:
- DATABASE_URL=postgresql+asyncpg://sprintforge:${POSTGRES_PASSWORD:-staging_password_change_me}@postgres:5432/sprintforge_staging
- REDIS_URL=redis://redis:6379
- SECRET_KEY=${SECRET_KEY:-staging-secret-key-change-in-production}
- ENVIRONMENT=staging
- DEBUG=false
- LOG_LEVEL=info
- CORS_ORIGINS=["http://localhost:8080","http://localhost:3000"]
volumes:
- ./backend/uploads-staging:/app/uploads
- ./backend/logs:/app/logs
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
networks:
- staging_network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
# Next.js Frontend
frontend:
build:
context: ./frontend
dockerfile: Dockerfile.staging
container_name: sprintforge-staging-frontend
restart: unless-stopped
environment:
- NEXT_PUBLIC_API_URL=http://47.88.89.175:8080/api/v1
- NEXTAUTH_URL=http://47.88.89.175:8080
- NEXTAUTH_SECRET=${NEXTAUTH_SECRET:-staging-nextauth-secret}
- NODE_ENV=production
depends_on:
- backend
networks:
- staging_network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000"]
interval: 30s
timeout: 10s
retries: 3
# Nginx Reverse Proxy
nginx:
image: nginx:alpine
container_name: sprintforge-staging-nginx
restart: unless-stopped
ports:
- "8080:80" # Internal port (Cloudflare Tunnel will connect here)
volumes:
- ./deployment/nginx-staging.conf:/etc/nginx/nginx.conf:ro
- ./deployment/nginx-logs:/var/log/nginx
depends_on:
- backend
- frontend
networks:
- staging_network
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost/health"]
interval: 30s
timeout: 10s
retries: 3
# Cloudflare Tunnel (Optional - comment out if using different access method)
cloudflared:
image: cloudflare/cloudflared:latest
container_name: sprintforge-cloudflared
restart: unless-stopped
command: tunnel --no-autoupdate run --token ${CLOUDFLARE_TUNNEL_TOKEN}
networks:
- staging_network
depends_on:
- nginx
# Watchtower (Auto-update containers when images change)
watchtower:
image: containrrr/watchtower
container_name: sprintforge-watchtower
restart: unless-stopped
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
- WATCHTOWER_CLEANUP=true
- WATCHTOWER_INCLUDE_STOPPED=false
- WATCHTOWER_SCHEDULE=0 0 2 * * * # 2 AM daily
command: sprintforge-staging-backend sprintforge-staging-frontend
networks:
staging_network:
driver: bridge
name: sprintforge_staging
volumes:
postgres_staging_data:
redis_staging_data:
backend_staging_uploads: