-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
146 lines (140 loc) · 3.56 KB
/
docker-compose.yml
File metadata and controls
146 lines (140 loc) · 3.56 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
services:
app:
build:
context: .
dockerfile: Dockerfile.ci
container_name: restaurant-app
ports:
- "8080:8080"
environment:
MONGODB_URI: mongodb://mongodb:27017
MONGODB_DATABASE: newyork
MONGODB_COLLECTION: restaurants
REDIS_HOST: redis
REDIS_PORT: 6379
ELASTICSEARCH_URI: http://elasticsearch:9200
APP_UPLOADS_DIR: /app/uploads
# Secrets injected from .env (never hardcoded — D-05)
JWT_SECRET: ${JWT_SECRET}
CONTROLLER_SIGNUP_CODE: ${CONTROLLER_SIGNUP_CODE:-}
ADMIN_SIGNUP_CODE: ${ADMIN_SIGNUP_CODE:-}
SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES_ACTIVE:-dev}
SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/restaurantdb
SPRING_DATASOURCE_USERNAME: ${POSTGRES_USER:-restaurant}
SPRING_DATASOURCE_PASSWORD: ${SPRING_DATASOURCE_PASSWORD}
volumes:
- uploads_data:/app/uploads
restart: unless-stopped
networks:
- restaurant-network
depends_on:
mongodb:
condition: service_healthy
redis:
condition: service_healthy
elasticsearch:
condition: service_healthy
postgres:
condition: service_healthy
healthcheck:
test:
["CMD", "curl", "-f", "http://localhost:8080/api/restaurants/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
deploy:
resources:
limits:
memory: 512m
mongodb:
image: mongo:7.0
container_name: mongodb
restart: unless-stopped
networks:
- restaurant-network
ports:
- "27017:27017"
environment:
MONGO_INITDB_DATABASE: newyork
volumes:
- mongodb_data:/data/db
healthcheck:
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
interval: 10s
timeout: 5s
retries: 5
deploy:
resources:
limits:
memory: 512m
redis:
image: redis:7-alpine
container_name: redis
restart: unless-stopped
networks:
- restaurant-network
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
deploy:
resources:
limits:
memory: 128m
elasticsearch:
image: elasticsearch:8.13.4
container_name: elasticsearch
restart: unless-stopped
networks:
- restaurant-network
ports:
- "9200:9200"
environment:
- discovery.type=single-node
- xpack.security.enabled=false
- ES_JAVA_OPTS=-Xms256m -Xmx256m
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:9200/_cluster/health || exit 1"]
interval: 15s
timeout: 10s
retries: 10
start_period: 60s
deploy:
resources:
limits:
memory: 512m
postgres:
image: postgres:15
container_name: postgres
restart: unless-stopped
networks:
- restaurant-network
ports:
- "5432:5432"
environment:
# Credentials injected from .env (never hardcoded — D-05)
POSTGRES_USER: ${POSTGRES_USER:-restaurant}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB:-restaurantdb}
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-restaurant} -d ${POSTGRES_DB:-restaurantdb}"]
interval: 10s
timeout: 5s
retries: 5
deploy:
resources:
limits:
memory: 256m
networks:
restaurant-network:
driver: bridge
volumes:
mongodb_data:
postgres_data:
uploads_data: