Use Traefik for reverse proxy! :)

This commit is contained in:
Patrick Jentsch 2020-03-30 17:27:54 +02:00
parent 9ced65f34c
commit 257549bf69
4 changed files with 44 additions and 71 deletions

View File

@ -2,24 +2,29 @@ version: '3'
services: services:
storage: storage:
command: ["-p", "-s", "storage.nopaque;/srv/nopaque/storage;no;no;no;nopaque", "-u", "nopaque;nopaque"] command:
- "-p"
- "-s"
- "storage.nopaque;/srv/nopaque/storage;no;no;no;nopaque"
- "-u"
- "nopaque;nopaque"
image: dperson/samba:latest image: dperson/samba:latest
ports: ports:
- 445:445 - "445:445"
restart: on-failure
volumes: volumes:
- /srv/nopaque/storage:/srv/nopaque/storage - "/srv/nopaque/storage:/srv/nopaque/storage"
worker: worker:
image: docker:dind image: docker:dind
ports: ports:
- 2375 - "2375"
privileged: true privileged: true
restart: on-failure
volumes: volumes:
- /mnt/nopaque:/mnt/nopaque - "/mnt/nopaque:/mnt/nopaque"
viz: viz:
environment:
- VIRTUAL_HOST=viz.localhost
image: dockersamples/visualizer:latest image: dockersamples/visualizer:latest
labels:
- "traefik.enable=true"
- "traefik.http.routers.viz.rule=Host(`viz.localhost`)"
- "traefik.http.routers.viz.entrypoints=web"
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock - "/var/run/docker.sock:/var/run/docker.sock"

View File

@ -1,71 +1,56 @@
version: '3' version: '3'
services: services:
nginx-proxy: reverse-proxy:
depends_on: image: traefik:2.2
- web command:
deploy: - "--log.level=DEBUG"
placement: - "--providers.docker=true"
constraints: - "--providers.docker.exposedbydefault=false"
- node.role == manager - "--entrypoints.web.address=:80"
ports: ports:
- "80:80" - "80:80"
# - "443:443"
image: jwilder/nginx-proxy:latest
volumes: volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro - "/var/run/docker.sock:/var/run/docker.sock:ro"
- ./nginx-proxy/conf.d/nopaque_specifics.conf:/etc/nginx/conf.d/nopaque_specifics.conf:ro
- ./nginx-proxy/vhost.d:/etc/nginx/vhost.d:ro
# - ./certs:/etc/nginx/certs
web: web:
depends_on: depends_on:
- db - db
- redis - redis
environment:
- VIRTUAL_HOST=nopaque.localhost,129.70.216.233
env_file: nopaque.env env_file: nopaque.env
image: gitlab.ub.uni-bielefeld.de:4567/sfb1288inf/opaque:development image: gitlab.ub.uni-bielefeld.de:4567/sfb1288inf/opaque:development
labels:
- "traefik.enable=true"
- "traefik.http.routers.nopaque.rule=Host(`nopaque.localhost`)"
- "traefik.http.routers.nopaque.entrypoints=web"
volumes: volumes:
- /mnt/nopaque:/mnt/nopaque - "/mnt/nopaque:/mnt/nopaque"
- ./app:/home/nopaque/app - "./app:/home/nopaque/app"
- ./logs:/home/nopaque/logs - "./logs:/home/nopaque/logs"
- ./migrations:/home/nopaque/migrations - "./migrations:/home/nopaque/migrations"
- ./tests:/home/nopaque/tests - "./tests:/home/nopaque/tests"
- ./config.py:/home/nopaque/config.py - "./config.py:/home/nopaque/config.py"
- ./docker-entrypoint.sh:/usr/local/bin/docker-entrypoint.sh - "./docker-entrypoint.sh:/usr/local/bin/docker-entrypoint.sh"
- ./nopaque.py:/home/nopaque/nopaque.py - "./nopaque.py:/home/nopaque/nopaque.py"
- ./requirements.txt:/home/nopaque/requirements.txt - "./requirements.txt:/home/nopaque/requirements.txt"
daemon: daemon:
depends_on: depends_on:
- db - db
deploy:
placement:
constraints:
- node.role == manager
env_file: nopaque.env env_file: nopaque.env
extra_hosts: extra_hosts:
- "host.docker.internal:172.17.0.1" - "host.docker.internal:172.17.0.1"
image: gitlab.ub.uni-bielefeld.de:4567/sfb1288inf/opaque_daemon:latest image: gitlab.ub.uni-bielefeld.de:4567/sfb1288inf/opaque_daemon:latest
volumes: volumes:
- /mnt/nopaque:/mnt/nopaque - "/mnt/nopaque:/mnt/nopaque"
- ./logs:/home/nopaqued/logs - "./logs:/home/nopaqued/logs"
- ../opaque_daemon/docker-entrypoint.sh:/usr/local/bin/docker-entrypoint.sh - "../opaque_daemon/docker-entrypoint.sh:/usr/local/bin/docker-entrypoint.sh"
- ../opaque_daemon/nopaqued.py:/home/nopaqued/nopaqued.py - "../opaque_daemon/nopaqued.py:/home/nopaqued/nopaqued.py"
- ../opaque_daemon/merge_corpus_files.py:/home/nopaqued/merge_corpus_files.py - "../opaque_daemon/merge_corpus_files.py:/home/nopaqued/merge_corpus_files.py"
- ../opaque_daemon/requirements.txt:/home/nopaqued/requirements.txt - "../opaque_daemon/requirements.txt:/home/nopaqued/requirements.txt"
- $HOME/.docker:/home/nopaqued/.docker - "$HOME/.docker:/home/nopaqued/.docker"
db: db:
deploy:
placement:
constraints:
- node.role == manager
env_file: nopaque.env env_file: nopaque.env
image: postgres:11 image: postgres:11
volumes: volumes:
- /srv/nopaque/database:/var/lib/postgresql/data - "/srv/nopaque/database:/var/lib/postgresql/data"
redis: redis:
deploy:
placement:
constraints:
- node.role == manager
image: redis:5 image: redis:5

View File

@ -1 +0,0 @@
client_max_body_size 1024M;

View File

@ -1,16 +0,0 @@
location /socket.io {
proxy_http_version 1.1;
proxy_buffering off;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $proxy_connection;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto;
proxy_set_header X-Forwarded-Ssl $proxy_x_forwarded_ssl;
proxy_set_header X-Forwarded-Port $proxy_x_forwarded_port;
# Mitigate httpoxy attack (see README for details)
proxy_set_header Proxy "";
proxy_pass http://opaque_web_1:5000;
}