From 0a388fe4b2c9324bb7b581e2a937c6913d398bb0 Mon Sep 17 00:00:00 2001 From: Patrick Jentsch Date: Thu, 9 Jan 2020 15:13:47 +0100 Subject: [PATCH] Add reverse proxy --- docker-compose.yml | 37 ++++++++++++++----------------------- docker-entrypoint.sh | 3 +-- nopaque.env.tpl | 2 +- 3 files changed, 16 insertions(+), 26 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 5701db5d..fe089cb4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,18 +1,18 @@ version: '3' services: - # traefik: - # command: - # - "--api.insecure=true" - # - "--providers.docker=true" - # - "--providers.docker.exposedbydefault=false" - # - "--entrypoints.nopaque.address=:5000" - # image: traefik:2.0 - # ports: - # - 5000:5000 - # - 9090:8080 - # volumes: - # - /var/run/docker.sock:/var/run/docker.sock:ro + nginx-proxy: + depends_on: + - web + deploy: + placement: + constraints: + - node.role == manager + ports: + - "80:80" + image: jwilder/nginx-proxy:latest + volumes: + - /var/run/docker.sock:/tmp/docker.sock:ro web: depends_on: - db @@ -21,18 +21,9 @@ services: placement: constraints: - node.role == manager + environment: + - VIRTUAL_HOST=nopaque.localhost env_file: nopaque.env - # labels: - # - "traefik.enable=true" - # - "traefik.http.routers.nopaque.entrypoints=nopaque" - # - "traefik.http.routers.nopaque.rule=Host(`nopaque.localhost`)" - # # Use sticky sessions for load balancing - # # Socket.IO is not compatible with cookie sticky sessions which are the - # # only available option in traefik - # - "traefik.http.services.web-opaque.loadbalancer.sticky=true" - # - "traefik.http.services.web-opaque.loadbalancer.sticky.cookie.httpOnly=true" - ports: - - "5000:5000" image: gitlab.ub.uni-bielefeld.de:4567/sfb1288inf/opaque:development volumes: - /mnt/nopaque:/mnt/nopaque diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 3b334c1b..ebcfeb7e 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -6,9 +6,8 @@ echo "Waiting for redis..." wait-for-it redis:6379 --strict --timeout=0 if [ $# -eq 0 ]; then - venv/bin/python -u nopaque.py + venv/bin/python nopaque.py elif [ $1 == "flask" ]; then - echo "$@" venv/bin/python -m $@ else echo "Unknown command" diff --git a/nopaque.env.tpl b/nopaque.env.tpl index 2f2cd28d..19736f22 100644 --- a/nopaque.env.tpl +++ b/nopaque.env.tpl @@ -1,4 +1,4 @@ -### Database ### +### PostgreSQL ### POSTGRES_DB_NAME= POSTGRES_USER= POSTGRES_PASSWORD=