From dba5152edd6938ca0c09ae61506eb60f257c6beb Mon Sep 17 00:00:00 2001 From: Filip Gralinski Date: Tue, 17 Mar 2020 16:52:36 +0100 Subject: [PATCH] Handle https with nginx, add sample configuration file --- .gitignore | 1 + docker-compose.yml | 19 +++++++++++++++++-- nginx.conf | 29 +++++++++++++++++++++++++++++ sample.env | 10 ++++++++++ 4 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 nginx.conf create mode 100644 sample.env diff --git a/.gitignore b/.gitignore index 724a2d8..1232ddb 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ arena/t* arena/r* gonito-*.tar.gz stack.yaml.lock +.env diff --git a/docker-compose.yml b/docker-compose.yml index 665f342..d475367 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,15 @@ version: '3' services: + nginx: + image: nginx:latest + container_name: production_nginx + volumes: + - ./nginx.conf:/etc/nginx/nginx.conf + - ${NGINX_CERTIFICATE_DIR}:/etc/certs + ports: + - 443:443 + depends_on: + - gonito gonito: image: loxygen/gonito depends_on: @@ -11,8 +21,13 @@ services: - ADMINUSER=$GONITO_ADMINUSER - ADMINPASS=$GONITO_ADMINPASS - LOCATION=$GONITO_LOCATION - ports: - - "3000:3000" + - APPROOT=$GONITO_APPROOT + - LEADERBOARD_STYLE=${GONITO_LEADERBOARD_STYLE:-by-tag} + - AUTO_OPENING=${GONITO_AUTO_OPENING:-false} + expose: + - "3000" + volumes: + - "${GONITO_ARENA_VOLUME}:/gonito/arena" postgres: image: postgres environment: diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..741576b --- /dev/null +++ b/nginx.conf @@ -0,0 +1,29 @@ +events { + +} + +error_log /dev/stderr info; +error_log /dev/stderr warn; +error_log /dev/stderr error; + +http { + client_max_body_size 20m; + + upstream gonito { + server gonito:3000; + } + + server { + server_name zacna-ania; + + location / { + proxy_pass http://gonito; + proxy_redirect off; + } + + listen 443 ssl; + + ssl_certificate /etc/certs/fullchain.pem; + ssl_certificate_key /etc/certs/privkey.pem; + } +} diff --git a/sample.env b/sample.env new file mode 100644 index 0000000..4c76810 --- /dev/null +++ b/sample.env @@ -0,0 +1,10 @@ +PG_DATA_VOLUME=/home/user/pg-data +POSTGRES_PASSWORD=aC3xo2te +GONITO_ADMINUSER=admin +GONITO_ADMINPASS=Ahxuz5du +GONITO_LOCATION=test +GONITO_ARENA_VOLUME=/home/user/arena +GONITO_APPROOT=https://localhost:443 +GONITO_LEADERBOARD_STYLE=by-tag +GONITO_AUTO_OPENING=false +NGINX_CERTIFICATE_DIR=/home/user/certs