From 2f729de40b1f5cd7607cb1286fcf1fced6669448 Mon Sep 17 00:00:00 2001 From: Vivek Santayana Date: Sat, 20 Aug 2022 17:25:07 +0100 Subject: [PATCH] mysql compose --- docker-compose-mysql.yml | 90 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 docker-compose-mysql.yml diff --git a/docker-compose-mysql.yml b/docker-compose-mysql.yml new file mode 100644 index 0000000..7b068d9 --- /dev/null +++ b/docker-compose-mysql.yml @@ -0,0 +1,90 @@ +version: '3.9' + +volumes: + app: + mysql: + +services: + nginx: + container_name: reftest_server + image: nginx:alpine + volumes: + - ./certbot:/etc/letsencrypt:ro + - ./nginx:/etc/nginx + - ./src/html/certbot:/usr/share/nginx/html/certbot:ro + - ./src/html/robots.txt:/usr/share/nginx/html/robots.txt:ro + - ./ref-test/app/root:/usr/share/nginx/html/root:ro + - ./ref-test/app/admin/static:/usr/share/nginx/html/admin/static:ro + - ./ref-test/app/editor/static:/usr/share/nginx/html/editor/static:ro + - ./ref-test/app/quiz/static:/usr/share/nginx/html/quiz/static:ro + - ./ref-test/app/view/static:/usr/share/nginx/html/view/static:ro + ports: + - 80:80 + - 443:443 + restart: unless-stopped + networks: + - frontend + depends_on: + - app + command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'" + + app: + container_name: reftest_app + image: reftest + build: ./ref-test + env_file: + - ./.env + ports: + - 5000 + volumes: + - app:/ref-test/data + - ./logs:/ref-test/data/logs + restart: unless-stopped + networks: + - frontend + - backend + depends_on: + postfix: + mysql: + condition: service_healthy + + postfix: + container_name: reftest_postfix + image: catatnight/postfix:latest + restart: unless-stopped + env_file: + - ./.env + ports: + - 25 + networks: + - backend + + certbot: + container_name: reftest_certbot + image: certbot/certbot + volumes: + - ./certbot:/etc/letsencrypt + - ./src/html/certbot:/var/www/html + entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'" + + mysql: + container_name: reftest_db + image: mysql:8.0 + env_file: + - ./.env + volumes: + - mysql:/var/lib/mysql + ports: + - 3306 + networks: + - backend + healthcheck: + test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"] + timeout: 10s + retries: 10 + +networks: + frontend: + external: false + backend: + external: false \ No newline at end of file