Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
104 lines (99 loc) · 2.67 KB
/
Copy pathdocker-compose.yml
File metadata and controls
104 lines (99 loc) · 2.67 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
services:
# PostgreSQL Database
postgres:
image: postgres:16-alpine
container_name: smartops-postgres
restart: unless-stopped
environment:
POSTGRES_USER: smartops
POSTGRES_PASSWORD: smartops_password
POSTGRES_DB: smartops
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U smartops"]
interval: 10s
timeout: 5s
retries: 5
networks:
- smartops-network
# Redis Cache
redis:
image: redis:7-alpine
container_name: smartops-redis
restart: unless-stopped
command: redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy allkeys-lru
ports:
- "6379:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- smartops-network
# NestJS API
api:
build:
context: ./apps/api
dockerfile: Dockerfile
container_name: smartops-api
restart: unless-stopped
environment:
DATABASE_URL: postgresql://smartops:smartops_password@postgres:5432/smartops?schema=public&connection_limit=10&pool_timeout=30
REDIS_HOST: redis
REDIS_PORT: 6379
REDIS_TTL: 300
PORT: 4000
NODE_ENV: ${NODE_ENV:-development}
FRONTEND_URL: http://web:3000
JWT_SECRET: ${JWT_SECRET:-your-secret-key-change-in-production}
JWT_EXPIRES_IN: 15m
JWT_REFRESH_SECRET: ${JWT_REFRESH_SECRET:-your-refresh-secret-key-change-in-production}
JWT_REFRESH_EXPIRES_IN: 7d
DB_POOL_MAX: 10
DB_POOL_IDLE_MS: 30000
DB_POOL_TIMEOUT_MS: 5000
BODY_PARSER_JSON_LIMIT: ${BODY_PARSER_JSON_LIMIT:-1mb}
BODY_PARSER_URLENCODED_LIMIT: ${BODY_PARSER_URLENCODED_LIMIT:-1mb}
ports:
- "4000:4000"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
networks:
- smartops-network
# Next.js Web Application
web:
build:
context: ./apps/web
dockerfile: Dockerfile
args:
NEXT_PUBLIC_API_URL: http://localhost:4000
NEXT_PUBLIC_APP_URL: http://localhost:3000
container_name: smartops-web
restart: unless-stopped
environment:
NEXT_PUBLIC_API_URL: http://localhost:4000
API_URL: http://api:4000
NEXT_PUBLIC_APP_URL: http://localhost:3000
NODE_ENV: production
JWT_SECRET: ${JWT_SECRET:-your-secret-key-change-in-production}
ports:
- "3000:3000"
depends_on:
- api
networks:
- smartops-network
networks:
smartops-network:
driver: bridge
volumes:
postgres_data:
redis_data: