Docker-compose
- MySQL, Spring, NGINX, cerbot을 docker을 이용하여서 구성하였다.
- cerbot은 인증서 발급을 위한 것이다.
- NGINX를 사용하여서 리버스 프록시를 이용하여 80, 443포트를 적용하였다.
version: "3.8"
services:
app:
build: ./backend
environment:
SPRING_DATASOURCE_URL: jdbc:mysql://mysql:3306/domino?useUnicode=true&characterEncoding=utf8&serverTimezone=UTC
SPRING_DATASOURCE_USERNAME: root
SPRING_DATASOURCE_PASSWORD: koko1234
spring_jpa_defer_datasource_initialization: 1
spring_sql_init_mode: always
ports:
- "8080:8080"
depends_on:
- mysql
mysql:
image: mysql
container_name: mysql_domino
environment:
MYSQL_ROOT_PASSWORD: koko1234
MYSQL_DATABASE: domino
MYSQL_CHARACTER_SET_SERVER: utf8mb4
MYSQL_COLLATION_SERVER: utf8mb4_unicode_ci
volumes:
- mysql_data:/var/lib/mysql
ports:
- "3306:3306"
nginx:
image: nginx:latest
container_name: nginx-proxy
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
- ../certbot/conf:/etc/letsencrypt
- ../certbot/www:/var/www/certbot
restart: always
command: '/bin/sh -c ''while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g "daemon off;"'''
depends_on:
- app
certbot:
image: certbot/certbot
container_name: certbot_service
volumes:
- ../certbot/conf:/etc/letsencrypt
- ../certbot/www:/var/www/certbot
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
depends_on:
- nginx
volumes:
mysql_data:
배포하기
