-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
executable file
·136 lines (131 loc) · 3.49 KB
/
docker-compose.prod.yml
File metadata and controls
executable file
·136 lines (131 loc) · 3.49 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
services:
postgres:
image: postgres:15
container_name: postgres-prod
environment:
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-strongpassword}
POSTGRES_DB: ${POSTGRES_DB:-spa_comments}
POSTGRES_INITDB_ARGS: "--encoding=UTF8 --locale=C"
volumes:
- postgres_data:/var/lib/postgresql/data
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
user: postgres
deploy:
resources:
limits:
memory: 1G
networks:
- prod-network
elasticsearch:
image: elasticsearch:8.9.0
container_name: elasticsearch-prod
environment:
- discovery.type=single-node
- ES_JAVA_OPTS=-Xms512m -Xmx512m
- bootstrap.memory_lock=true
- xpack.security.enabled=true
- ELASTIC_PASSWORD=${ELASTIC_PASSWORD:-strongpassword}
- xpack.security.http.ssl.enabled=true
- xpack.security.transport.ssl.enabled=true
volumes:
- elasticsearch_data:/usr/share/elasticsearch/data
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "curl --silent --fail http://localhost:9200/_cluster/health || exit 1"]
interval: 30s
timeout: 10s
retries: 3
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
deploy:
resources:
limits:
memory: 1G
networks:
- prod-network
rabbitmq:
image: rabbitmq:3-management
container_name: rabbitmq-prod
environment:
RABBITMQ_DEFAULT_USER: ${RABBITMQ_USER:-admin}
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_PASSWORD:-strongpassword}
RABBITMQ_ERLANG_COOKIE: ${RABBITMQ_COOKIE:-unique_cookie_value}
volumes:
- rabbitmq_data:/var/lib/rabbitmq
restart: unless-stopped
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "status"]
interval: 30s
timeout: 10s
retries: 3
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
deploy:
resources:
limits:
memory: 1G
networks:
- prod-network
backend:
build:
context: ./backend
dockerfile: Dockerfile
target: production
container_name: backend-prod
depends_on:
- postgres
- rabbitmq
- elasticsearch
environment:
DATABASE_URL: postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-strongpassword}@postgres:5432/${POSTGRES_DB:-spa_comments}?sslmode=require
ELASTICSEARCH_URL: https://elastic:${ELASTIC_PASSWORD:-strongpassword}@elasticsearch:9200
RABBITMQ_HOST: rabbitmq
RABBITMQ_USER: ${RABBITMQ_USER:-admin}
RABBITMQ_PASSWORD: ${RABBITMQ_PASSWORD:-strongpassword}
NODE_ENV: production
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3001/health"]
interval: 30s
timeout: 10s
retries: 3
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
deploy:
resources:
limits:
memory: 512M
user: nestjs
networks:
- prod-network
networks:
prod-network:
driver: bridge
internal: true
volumes:
postgres_data:
external: false
elasticsearch_data:
name: spa_comments_elasticsearch_data
rabbitmq_data:
name: spa_comments_rabbitmq_data