-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose.yaml
More file actions
139 lines (131 loc) · 2.91 KB
/
compose.yaml
File metadata and controls
139 lines (131 loc) · 2.91 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
services:
api:
profiles: ['prod']
platform: linux/amd64
image: ${DOCKER_USERNAME}/${PACKAGE_NAME}:${PACKAGE_VERSION}
container_name: ${PACKAGE_NAME}_api
restart: always
env_file:
- .env
environment:
NODE_ENV: production
DATABASE_URL: postgresql://postgres:postgres@db:5432/${PACKAGE_NAME}_db
REDIS_HOST: redis-master
REDIS_PORT: 6379
BASE_URL: http://0.0.0.0:3000
PORT: 3000
ports:
- '3000:3000'
- '1025:1025'
- '143:143'
depends_on:
db:
condition: service_healthy
redis-master:
condition: service_healthy
command: >
sh -c "
echo '🏁 Waiting for DB...';
sleep 5;
npx prisma migrate deploy;
echo '🚀 Starting app...';
pnpm start
"
volumes:
- files-data:/app/uploads
- temp-data:/app/tmp
- logs-data:/app/logs
healthcheck:
test: ['CMD', 'curl', '-f', 'http://0.0.0.0:3000/health']
interval: 30s
timeout: 10s
retries: 5
db:
profiles: ['dev', 'prod']
image: postgres:17
container_name: ${PACKAGE_NAME}_db
restart: always
user: postgres
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: ${PACKAGE_NAME}_db
volumes:
- db_data:/var/lib/postgresql/data
ports:
- '127.0.0.1:5433:5432'
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U postgres']
interval: 10s
timeout: 5s
retries: 5
pgadmin:
image: dpage/pgadmin4
container_name: ${PACKAGE_NAME}_pgadmin
restart: always
profiles: ['prod']
environment:
- PGADMIN_DEFAULT_EMAIL=${SUPER_ADMIN_EMAIL}
- PGADMIN_DEFAULT_PASSWORD=${SUPER_ADMIN_PASS}
- SCRIPT_NAME=/pgadmin
ports:
- '8123:80'
depends_on:
db:
condition: service_healthy
api:
condition: service_healthy
redis-master:
profiles: ['dev', 'prod']
image: redis
container_name: ${PACKAGE_NAME}_redis-master
command:
[
'redis-server',
'--appendonly',
'yes',
'--bind',
'0.0.0.0',
'--protected-mode',
'no',
]
ports:
- '22376:6379'
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
interval: 5s
timeout: 3s
retries: 5
restart: always
redis-replica:
profiles: ['prod']
image: redis
container_name: ${PACKAGE_NAME}_redis-replica
command:
[
'redis-server',
'--replicaof',
'redis-master',
'6379',
'--bind',
'0.0.0.0',
'--protected-mode',
'no',
]
ports:
- '22377:6379'
depends_on:
- redis-master
restart: always
volumes:
db_data:
files-data:
temp-data:
logs-data:
caddy_data:
caddy_config:
networks:
default:
name: ${PACKAGE_NAME}_network
labels:
- 'project=${PACKAGE_NAME}'