-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yaml
139 lines (127 loc) · 3.17 KB
/
docker-compose.yaml
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
#version: '3'
networks:
api_net:
driver: bridge
services:
nginx:
image: nginx:1.23.2
container_name: ${CONTAINER_NAME_NGINX}
restart: always
ports:
- ${NGINX_PORT}:80
# - "443:443"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
- refer_socket_volume:/tmp
- refer_nginx_logs:/var/log/nginx
# - /etc/letsencrypt:/etc/letsencrypt:ro
depends_on:
- refer
networks:
- api_net
stop_grace_period: 5s
db:
image: postgres:16.3
container_name: ${CONTAINER_NAME_DB}
restart: always
ports:
- ${POSTGRES_PORT}:5432
volumes:
- refer_postgres_data:/var/lib/postgresql/data
- refer_postgres_logs:/logs_postgres
shm_size: 256mb
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_MAX_CONNECTIONS=200
command:
- --log_destination=stderr
- --logging_collector=on
- --log_directory=./logs_postgres/
- --max_connections=${MAX_CONNECTION}
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}" ]
interval: 10s
timeout: 5s
retries: 5
networks:
- api_net
adminer:
container_name: ${CONTAINER_NAME_DB_ADMIN}
image: adminer:4.8.1
restart: always
ports:
- ${ADMINER_PORT}:8080
networks:
- api_net
environment:
- ADMINER_DESIGN=${ADMINER_DESIGN}
- ADMINER_DEFAULT_SERVER=${ADMINER_DEFAULT_SERVER}
depends_on:
- db
refer:
build:
dockerfile: Dockerfile
context: ./
container_name: ${CONTAINER_NAME_DB_ADMIN_API}
restart: always
image: refer:${VERSION_API}
environment:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_HOST=${POSTGRES_HOST}
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PORT=${POSTGRES_PORT}
- JWT_PRIVATE_KEY=${JWT_PRIVATE}
- JWT_PUBLIC_KEY=${JWT_PUBLIC}
command:
- /app/start.sh
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
networks:
- api_net
volumes:
- refer_socket_volume:/tmp
- refer_api_logs:/var/log/refer
env_file:
- .env
stop_grace_period: 10s
redis:
image: redis:7.4-alpine
container_name: ${CONTAINER_NAME_REDIS}
restart: always
command: >
redis-server
--requirepass ${REDIS_PASSWORD}
healthcheck:
test: [ "CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping" ]
interval: 10s
timeout: 5s
retries: 5
environment:
- REDIS_TIMEOUT=${REDIS_TIMEOUT}
- REDIS_LOGLEVEL=${REDIS_LOGLEVEL}
- REDIS_PASSWORD=${REDIS_PASSWORD}
ports:
- ${REDIS_PORT}:6379
volumes:
- refer_redis_data:/data
networks:
- api_net
volumes:
refer_postgres_data:
name: ${POSTGRES_DATA_VOLUME}
refer_postgres_logs:
name: ${POSTGRES_LOGS_VOLUME}
refer_nginx_logs:
name: ${NGINX_LOGS_VOLUME}
refer_api_logs:
name: ${API_LOGS_VOLUME}
refer_socket_volume:
name: ${SOCKET_VOLUME}
refer_redis_data:
name: ${REDIS_VOLUME}