mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-23 01:57:03 +03:00
86faba37d9
* Update traefik doc links * Update traefik doc. Use correct anchor
109 lines
2.7 KiB
YAML
109 lines
2.7 KiB
YAML
log:
|
|
level: INFO
|
|
|
|
entryPoints:
|
|
web:
|
|
# http
|
|
address: ':80'
|
|
http:
|
|
# https://doc.traefik.io/traefik/routing/entrypoints/#entrypoint
|
|
redirections:
|
|
entryPoint:
|
|
to: web-secure
|
|
|
|
web-secure:
|
|
# https
|
|
address: ':443'
|
|
{%- if cookiecutter.use_celery == 'y' %}
|
|
|
|
flower:
|
|
address: ':5555'
|
|
{%- endif %}
|
|
|
|
certificatesResolvers:
|
|
letsencrypt:
|
|
# https://doc.traefik.io/traefik/https/acme/#lets-encrypt
|
|
acme:
|
|
email: '{{ cookiecutter.email }}'
|
|
storage: /etc/traefik/acme/acme.json
|
|
# https://doc.traefik.io/traefik/https/acme/#httpchallenge
|
|
httpChallenge:
|
|
entryPoint: web
|
|
|
|
http:
|
|
routers:
|
|
web-secure-router:
|
|
{%- if cookiecutter.domain_name.count('.') == 1 %}
|
|
rule: 'Host(`{{ cookiecutter.domain_name }}`) || Host(`www.{{ cookiecutter.domain_name }}`)'
|
|
{%- else %}
|
|
rule: 'Host(`{{ cookiecutter.domain_name }}`)'
|
|
{%- endif %}
|
|
entryPoints:
|
|
- web-secure
|
|
middlewares:
|
|
- csrf
|
|
service: django
|
|
tls:
|
|
# https://doc.traefik.io/traefik/routing/routers/#certresolver
|
|
certResolver: letsencrypt
|
|
{%- if cookiecutter.use_celery == 'y' %}
|
|
|
|
flower-secure-router:
|
|
rule: 'Host(`{{ cookiecutter.domain_name }}`)'
|
|
entryPoints:
|
|
- flower
|
|
service: flower
|
|
tls:
|
|
# https://doc.traefik.io/traefik/master/routing/routers/#certresolver
|
|
certResolver: letsencrypt
|
|
{%- endif %}
|
|
{%- if cookiecutter.cloud_provider == 'None' %}
|
|
|
|
web-media-router:
|
|
{%- if cookiecutter.domain_name.count('.') == 1 %}
|
|
rule: '(Host(`{{ cookiecutter.domain_name }}`) || Host(`www.{{ cookiecutter.domain_name }}`)) && PathPrefix(`/media/`)'
|
|
{%- else %}
|
|
rule: 'Host(`{{ cookiecutter.domain_name }}`) && PathPrefix(`/media/`)'
|
|
{%- endif %}
|
|
entryPoints:
|
|
- web-secure
|
|
middlewares:
|
|
- csrf
|
|
service: django-media
|
|
tls:
|
|
certResolver: letsencrypt
|
|
{%- endif %}
|
|
|
|
middlewares:
|
|
csrf:
|
|
# https://doc.traefik.io/traefik/master/middlewares/http/headers/#hostsproxyheaders
|
|
# https://docs.djangoproject.com/en/dev/ref/csrf/#ajax
|
|
headers:
|
|
hostsProxyHeaders: ['X-CSRFToken']
|
|
|
|
services:
|
|
django:
|
|
loadBalancer:
|
|
servers:
|
|
- url: http://django:5000
|
|
{%- if cookiecutter.use_celery == 'y' %}
|
|
|
|
flower:
|
|
loadBalancer:
|
|
servers:
|
|
- url: http://flower:5555
|
|
{%- endif %}
|
|
{%- if cookiecutter.cloud_provider == 'None' %}
|
|
|
|
django-media:
|
|
loadBalancer:
|
|
servers:
|
|
- url: http://nginx:80
|
|
{%- endif %}
|
|
|
|
providers:
|
|
# https://doc.traefik.io/traefik/master/providers/file/
|
|
file:
|
|
filename: /etc/traefik/traefik.yml
|
|
watch: true
|