-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompose.yaml
144 lines (138 loc) · 4.03 KB
/
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
139
140
141
142
143
144
services:
mysql:
image: mysql:8.0
restart: always
container_name: mysql
logging:
driver: awslogs
options:
awslogs-region: ${AWS_REGION}
awslogs-group: ${AWS_LOG_GROUP}
awslogs-stream: mysql
networks:
- backend
volumes:
- mysql-data:/var/lib/mysql:rw
- ./sql/:/docker-entrypoint-initdb.d/:ro
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
- --skip-character-set-client-handshake
healthcheck:
test: mysqladmin ping --host=mysql --user=${MYSQL_USER} --password=${MYSQL_PASSWORD} || exit 1
interval: 30s
timeout: 5s
retries: 3
start_period: 3m
start_interval: 5s
spring:
image: goldentrash/gdsc-internal:latest
container_name: spring-app
restart: always
logging:
driver: awslogs
options:
awslogs-region: ${AWS_REGION}
awslogs-group: ${AWS_LOG_GROUP}
awslogs-stream: spring
awslogs-datetime-format: "^%Y-%m-%dT%H:%M:%S"
networks:
- frontend
- backend
depends_on:
mysql:
condition: service_healthy
environment:
SPRING_DATASOURCE_URL: jdbc:mysql://mysql:3306/${MYSQL_DATABASE}
SPRING_DATASOURCE_USERNAME: ${MYSQL_USER}
SPRING_DATASOURCE_PASSWORD: ${MYSQL_PASSWORD}
GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID}
GOOGLE_CLIENT_SECRET: ${GOOGLE_CLIENT_SECRET}
GMAIL_USERNAME: ${GMAIL_USERNAME}
GMAIL_APP_PASSWORD: ${GMAIL_APP_PASSWORD}
DISCORD_WEBHOOK_URL: ${DISCORD_WEBHOOK_URL}
JWT_SECRET: ${JWT_SECRET}
JWT_EXPIRATION: ${JWT_EXPIRATION}
healthcheck:
test: curl --fail --silent --show-error http://spring:8080/actuator/health || exit 1
interval: 30s
timeout: 5s
retries: 3
start_period: 3m
start_interval: 5s
nginx:
image: nginx:latest
container_name: nginx
restart: always
logging:
driver: awslogs
options:
awslogs-region: ${AWS_REGION}
awslogs-group: ${AWS_LOG_GROUP}
awslogs-stream: nginx
ports:
- "0.0.0.0:80:80/tcp"
- "0.0.0.0:443:443/tcp"
networks:
- frontend
depends_on:
spring:
condition: service_healthy
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- ./certbot/data/:/var/www/certbot/:ro
- ./certbot/conf/:/etc/letsencrypt/:ro
healthcheck:
test: curl --fail --silent --show-error http://nginx/health || exit 1
interval: 30s
timeout: 5s
retries: 3
start_period: 3m
start_interval: 5s
certbot:
image: certbot/certbot:latest
container_name: certbot
restart: always
logging:
driver: awslogs
options:
awslogs-region: ${AWS_REGION}
awslogs-group: ${AWS_LOG_GROUP}
awslogs-stream: certbot
awslogs-multiline-pattern: "^Saving debug log to"
depends_on:
nginx:
condition: service_healthy
volumes:
- ./certbot/data:/var/www/certbot/:rw
- ./certbot/conf:/etc/letsencrypt/:rw
# If your nginx server has not yet been issued an SSL certificate, run the command below
# docker compose run --rm certbot certonly --webroot --webroot-path /var/www/certbot/ -d api.gdsc-konkuk.dev
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12d & wait $${!}; done;'"
autoheal:
image: willfarrell/autoheal:latest
container_name: autoheal
restart: always
logging:
driver: awslogs
options:
awslogs-region: ${AWS_REGION}
awslogs-group: ${AWS_LOG_GROUP}
awslogs-stream: autoheal
awslogs-multiline-pattern: "^AUTOHEAL_CONTAINER_LABEL"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
AUTOHEAL_CONTAINER_LABEL: all
AUTOHEAL_INTERVAL: 30
volumes:
mysql-data:
networks:
frontend:
backend:
internal: true