Migrate to traefik and rename i18n to translate

This commit is contained in:
Livvy Mackintosh 2017-10-08 22:24:18 +02:00
parent 049ca29e77
commit 7adc91b8b4
2 changed files with 114 additions and 57 deletions

View File

@ -1,10 +1,18 @@
version: "3" version: "3.3"
services: services:
map: map:
restart: always
build: . build: .
links: links:
- db:db - db:db
- cache:cache - cache:cache
networks:
- web
labels:
- "traefik.backend=app"
- "traefik.frontend.rule=Host:map.ojuso.org"
- "traefik.frontend.priority=5"
- "traefik.frontend.passHostHeader=true"
volumes: volumes:
- ./apps:/app/apps - ./apps:/app/apps
- ./ojusomap:/app/ojusomap - ./ojusomap:/app/ojusomap
@ -15,7 +23,10 @@ services:
command: /bin/sh -c "python3 manage.py migrate && DEBUG=1 python3 manage.py collectstatic --noinput && gunicorn --bind 0.0.0.0:8000 ojusomap.wsgi" command: /bin/sh -c "python3 manage.py migrate && DEBUG=1 python3 manage.py collectstatic --noinput && gunicorn --bind 0.0.0.0:8000 ojusomap.wsgi"
db: db:
restart: always
image: mdillon/postgis:9.6-alpine image: mdillon/postgis:9.6-alpine
networks:
- web
volumes: volumes:
- /containers/db:/var/lib/postgresql/data - /containers/db:/var/lib/postgresql/data
- ./support/postgres/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d - ./support/postgres/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
@ -24,46 +35,21 @@ services:
env_file: env_file:
- ./environment - ./environment
web:
image: nginx:alpine
volumes:
- ./support/nginx/nginx.template:/etc/nginx/conf.d/nginx.template
- ./support/nginx/directives:/etc/nginx/directives
- /containers/tls/acme:/web/acme
- /containers/tls/certs:/web/certs
- /var/discourse/shared/standalone/nginx.http.sock:/web/run/discourse.sock
- /containers/map/gunicorn.sock:/web/run/gunicorn.sock
- /containers/map/static:/web/static
- weblate-data:/web/weblate/data:ro
ports:
- "80:80"
- "443:443"
links:
- forum:forum
- map:map
- weblate:weblate
env_file:
- ./environment
command: /bin/sh -c "cat /etc/nginx/conf.d/nginx.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"
forum:
image: local_discourse/app
restart: always
hostname: discourse
env_file:
- ./environment
volumes:
- /var/discourse/shared/standalone:/shared
- /var/discourse/shared/standalone/log/var-log:/var/log
command: /sbin/boot
weblate: weblate:
image: weblate/weblate image: weblate/weblate
links: links:
- db:database - db:database
- cache - cache
networks:
- web
labels:
- "traefik.backend=weblate"
- "traefik.frontend.rule=Host:translate.ojuso.org"
- "traefik.frontend.priority=5"
- "traefik.frontend.passHostHeader=true"
volumes: volumes:
- weblate-data:/app/data - weblate-data:/app/data
env_file: env_file:
- ./environment - ./environment
environment: environment:
@ -74,6 +60,57 @@ services:
cache: cache:
image: memcached:1.4 image: memcached:1.4
restart: always restart: always
networks:
- web
jenkins:
image: jenkins:alpine
restart: always
networks:
- web
labels:
- "traefik.backend=jenkins"
- "traefik.frontend.rule=Host:jenkins.ojuso.org"
- "traefik.frontend.priority=5"
- "traefik.frontend.passHostHeader=true"
volumes:
- /containers/jenkins:/var/jenkins_home
- /var/run/docker.sock:/var/run/docker.sock
static:
image: nginx:alpine
restart: always
labels:
- "traefik.backend=static"
- "traefik.frontend.rule=Host:map.ojuso.org;PathPrefixStrip:/static/"
- "traefik.frontend.priority=10"
networks:
- web
volumes:
- /containers/map/static:/usr/share/nginx/html:ro
weblate_static:
image: nginx:alpine
restart: always
depends_on:
- weblate
labels:
- "traefik.backend=weblate_static"
- "traefik.frontend.rule=Host:translate.ojuso.org;PathPrefixStrip:/static/"
- "traefik.frontend.priority=10"
networks:
- web
volumes:
- type: bind
source: /var/lib/docker/volumes/ojusomap_weblate-data/_data/static
target: /usr/share/nginx/html
read_only: true
networks:
web:
external:
name: traefik_webgateway
volumes: volumes:
weblate-data: weblate-data:
weblate-static:

View File

@ -40,29 +40,29 @@ server {
} }
server { #server {
listen 443 ssl http2; # listen 443 ssl http2;
listen [::]:443 ssl http2; # listen [::]:443 ssl http2;
server_name forum.ojuso.org; # server_name forum.ojuso.org;
#
ssl_certificate /web/certs/forum.ojuso.org/fullchain.pem; # ssl_certificate /web/certs/forum.ojuso.org/fullchain.pem;
ssl_certificate_key /web/certs/forum.ojuso.org/privkey.pem; # ssl_certificate_key /web/certs/forum.ojuso.org/privkey.pem;
ssl_dhparam /web/certs/dhparam.pem; # ssl_dhparam /web/certs/dhparam.pem;
ssl_trusted_certificate /web/certs/map.ojuso.org/chain.pem; # ssl_trusted_certificate /web/certs/map.ojuso.org/chain.pem;
#
include directives/*; # include directives/*;
#
http2_idle_timeout 5m; # http2_idle_timeout 5m;
#
location / { # location / {
proxy_pass http://unix:/web/run/discourse.sock:; # proxy_pass http://unix:/web/run/discourse.sock:;
proxy_set_header Host $http_host; # proxy_set_header Host $http_host;
proxy_http_version 1.1; # proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https; # proxy_set_header X-Forwarded-Proto https;
} # }
#
} #}
server { server {
listen 443 ssl http2; listen 443 ssl http2;
@ -78,6 +78,26 @@ server {
http2_idle_timeout 5m; http2_idle_timeout 5m;
location / {
return 301 https://translate.ojuso.org$request_uri;
}
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name translate.ojuso.org;
ssl_certificate /web/certs/translate.ojuso.org/fullchain.pem;
ssl_certificate_key /web/certs/translate.ojuso.org/privkey.pem;
ssl_dhparam /web/certs/dhparam.pem;
ssl_trusted_certificate /web/certs/translate.ojuso.org/chain.pem;
include directives/*;
http2_idle_timeout 5m;
root /web/weblate/data/static; root /web/weblate/data/static;
location /favicon.ico { location /favicon.ico {