From 3b6ed865c97fe8d1596f8e6b691549d7a6f66fcb Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Mon, 23 Dec 2019 23:17:05 +0100 Subject: [PATCH] adding mysql docker-compose.yml --- README.md | 2 +- .../with-mysql/docker-compose.yml | 43 +++++++++++ docker/docker-compose/with-mysql/nginx.conf | 76 +++++++++++++++++++ 3 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 docker/docker-compose/with-mysql/docker-compose.yml create mode 100644 docker/docker-compose/with-mysql/nginx.conf diff --git a/README.md b/README.md index 407f796d..4dfbefb4 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![npm version](https://badge.fury.io/js/pigallery2.svg)](https://badge.fury.io/js/pigallery2) [![Build Status](https://travis-ci.org/bpatrik/pigallery2.svg?branch=master)](https://travis-ci.org/bpatrik/pigallery2) [![Heroku](https://heroku-badge.herokuapp.com/?app=pigallery2&style=flat)](https://pigallery2.herokuapp.com) -![](https://github.com/bpatrik/pigallery2/workflows/docker-buildx/badge.svg) +[![Docker build](https://github.com/bpatrik/pigallery2/workflows/docker-buildx/badge.svg)](https://github.com/bpatrik/pigallery2/actions) [![dependencies Status](https://david-dm.org/bpatrik/pigallery2/status.svg)](https://david-dm.org/bpatrik/pigallery2) [![devDependencies Status](https://david-dm.org/bpatrik/pigallery2/dev-status.svg)](https://david-dm.org/bpatrik/pigallery2?type=dev) diff --git a/docker/docker-compose/with-mysql/docker-compose.yml b/docker/docker-compose/with-mysql/docker-compose.yml new file mode 100644 index 00000000..fe848595 --- /dev/null +++ b/docker/docker-compose/with-mysql/docker-compose.yml @@ -0,0 +1,43 @@ +version: '3' +services: + pigallery-db: + container_name: pigallery-db + image: mariadb + volumes: + - db-data:/var/lib/mysql + environment: + - MYSQL_ROOT_PASSWORD=putsomethinginherethatyouwouldlikeasthepassword + - MYSQL_USER=pigallery2 + - MYSQL_PASSWORD=pigallery2_pass + - MYSQL_DATABASE=pigallery2 + + nginx: + image: nginx:latest + container_name: production_nginx + volumes: + - ./nginx.conf:/etc/nginx/nginx.conf + - ./nginx/error.log:/etc/nginx/error_log.log + - ./nginx/cache/:/etc/nginx/cache + - /etc/letsencrypt/:/etc/letsencrypt/ + ports: + - 80:80 + - 443:443 + restart: always + + pigallery2: + image: bpatrik/pigallery2:nightly-stretch + command: --Server-Database-mysql-host=pigallery-db --Server-Database-mysql-username=pigallery2 --Server-Database-mysql-password=pigallery2_pass--Server-Database-mysql-database=pigallery2 + container_name: pigallery2 + environment: + - NODE_ENV=production + volumes: + - ./pigallery2/config:/app/data/config + - db-data:/app/data/db + - ./pigallery2/images:/app/data/images + - ./pigallery2/tmp:/app/data/tmp + expose: + - "80" + restart: always + +volumes: + db-data: diff --git a/docker/docker-compose/with-mysql/nginx.conf b/docker/docker-compose/with-mysql/nginx.conf new file mode 100644 index 00000000..6dc96b7c --- /dev/null +++ b/docker/docker-compose/with-mysql/nginx.conf @@ -0,0 +1,76 @@ +events { + +} + +http { + + ## + # Basic Settings + ## + + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 65; + types_hash_max_size 2048; + + include /etc/nginx/mime.types; + default_type application/octet-stream; + + ## + # SSL Settings + ## + + ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE + ssl_prefer_server_ciphers on; + + ## + # Logging Settings + ## + + access_log /var/log/nginx/access.log; + error_log /var/log/nginx/error.log; + + ## + # Gzip Settings + ## + + gzip on; + + + ## + # Virtual Host Configs + ## + + server { + listen 80 default_server; + listen [::]:80 default_server; + + server_name yourdomain.com www.yourdomain.com; + return 301 https://$server_name$request_uri; + } + + server { + server_name yourdomain.com; + + gzip on; + + + location / { + proxy_pass http://pigallery2:80; # forwarding to the other container, named 'pigallery2' + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection 'upgrade'; + proxy_set_header Host $host; + proxy_cache_bypass $http_upgrade; + } + + + listen 443 ssl default_server; + listen [::]:443 ssl default_server; + + ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem; + include /etc/letsencrypt/options-ssl-nginx.conf; + } +}