2019-11-28 23:16:06 +03:00
|
|
|
log:
|
|
|
|
level: INFO
|
|
|
|
|
|
|
|
entryPoints:
|
|
|
|
web:
|
|
|
|
# http
|
|
|
|
address: ":80"
|
2020-09-17 19:52:42 +03:00
|
|
|
http:
|
2020-09-18 19:44:18 +03:00
|
|
|
# https://docs.traefik.io/routing/entrypoints/#entrypoint
|
2020-09-17 19:52:42 +03:00
|
|
|
redirections:
|
|
|
|
entryPoint:
|
|
|
|
to: web-secure
|
2019-11-28 23:16:06 +03:00
|
|
|
|
|
|
|
web-secure:
|
|
|
|
# https
|
|
|
|
address: ":443"
|
2020-02-18 12:01:56 +03:00
|
|
|
{%- if cookiecutter.use_celery == 'y' %}
|
2019-11-28 23:16:06 +03:00
|
|
|
|
2020-02-04 16:04:47 +03:00
|
|
|
flower:
|
|
|
|
address: ":5555"
|
2020-02-18 12:01:56 +03:00
|
|
|
{%- endif %}
|
2020-02-04 16:04:47 +03:00
|
|
|
|
2019-11-28 23:16:06 +03:00
|
|
|
certificatesResolvers:
|
|
|
|
letsencrypt:
|
|
|
|
# https://docs.traefik.io/master/https/acme/#lets-encrypt
|
|
|
|
acme:
|
|
|
|
email: "{{ cookiecutter.email }}"
|
|
|
|
storage: /etc/traefik/acme/acme.json
|
|
|
|
# https://docs.traefik.io/master/https/acme/#httpchallenge
|
|
|
|
httpChallenge:
|
|
|
|
entryPoint: web
|
|
|
|
|
|
|
|
http:
|
|
|
|
routers:
|
|
|
|
web-secure-router:
|
2020-04-24 11:30:27 +03:00
|
|
|
{%- if cookiecutter.domain_name.count('.') == 1 %}
|
2020-04-04 18:26:24 +03:00
|
|
|
rule: "Host(`{{ cookiecutter.domain_name }}`) || Host(`www.{{ cookiecutter.domain_name }}`)"
|
2021-03-03 01:50:28 +03:00
|
|
|
{%- else %}
|
2020-04-17 21:20:57 +03:00
|
|
|
rule: "Host(`{{ cookiecutter.domain_name }}`)"
|
|
|
|
{%- endif %}
|
2019-11-28 23:16:06 +03:00
|
|
|
entryPoints:
|
|
|
|
- web-secure
|
|
|
|
middlewares:
|
|
|
|
- csrf
|
|
|
|
service: django
|
|
|
|
tls:
|
|
|
|
# https://docs.traefik.io/master/routing/routers/#certresolver
|
|
|
|
certResolver: letsencrypt
|
2020-02-18 12:01:56 +03:00
|
|
|
{%- if cookiecutter.use_celery == 'y' %}
|
2019-11-28 23:16:06 +03:00
|
|
|
|
2020-02-04 16:04:47 +03:00
|
|
|
flower-secure-router:
|
|
|
|
rule: "Host(`{{ cookiecutter.domain_name }}`)"
|
|
|
|
entryPoints:
|
|
|
|
- flower
|
|
|
|
service: flower
|
|
|
|
tls:
|
|
|
|
# https://docs.traefik.io/master/routing/routers/#certresolver
|
|
|
|
certResolver: letsencrypt
|
2020-02-18 12:01:56 +03:00
|
|
|
{%- endif %}
|
2023-03-04 21:36:11 +03:00
|
|
|
{%- if cookiecutter.cloud_provider == 'None' %}
|
|
|
|
|
|
|
|
web-media-router:
|
2023-04-04 12:25:06 +03:00
|
|
|
{%- if cookiecutter.domain_name.count('.') == 1 %}
|
|
|
|
rule: "(Host(`{{ cookiecutter.domain_name }}`) || Host(`www.{{ cookiecutter.domain_name }}`)) && PathPrefix(`/media/`)"
|
|
|
|
{%- else %}
|
2023-03-04 21:36:11 +03:00
|
|
|
rule: "Host(`{{ cookiecutter.domain_name }}`) && PathPrefix(`/media/`)"
|
2023-04-04 12:25:06 +03:00
|
|
|
{%- endif %}
|
2023-03-04 21:36:11 +03:00
|
|
|
entryPoints:
|
|
|
|
- web-secure
|
|
|
|
middlewares:
|
|
|
|
- csrf
|
|
|
|
service: django-media
|
|
|
|
tls:
|
|
|
|
certResolver: letsencrypt
|
|
|
|
{%- endif %}
|
2020-02-04 16:04:47 +03:00
|
|
|
|
2019-11-28 23:16:06 +03:00
|
|
|
middlewares:
|
|
|
|
csrf:
|
|
|
|
# https://docs.traefik.io/master/middlewares/headers/#hostsproxyheaders
|
|
|
|
# https://docs.djangoproject.com/en/dev/ref/csrf/#ajax
|
|
|
|
headers:
|
2020-02-04 16:04:47 +03:00
|
|
|
hostsProxyHeaders: ["X-CSRFToken"]
|
2019-11-28 23:16:06 +03:00
|
|
|
|
|
|
|
services:
|
|
|
|
django:
|
|
|
|
loadBalancer:
|
|
|
|
servers:
|
|
|
|
- url: http://django:5000
|
2020-02-18 12:01:56 +03:00
|
|
|
{%- if cookiecutter.use_celery == 'y' %}
|
2019-11-28 23:16:06 +03:00
|
|
|
|
2020-02-04 16:04:47 +03:00
|
|
|
flower:
|
|
|
|
loadBalancer:
|
|
|
|
servers:
|
|
|
|
- url: http://flower:5555
|
2020-02-18 12:01:56 +03:00
|
|
|
{%- endif %}
|
2023-03-04 21:36:11 +03:00
|
|
|
{%- if cookiecutter.cloud_provider == 'None' %}
|
|
|
|
|
|
|
|
django-media:
|
|
|
|
loadBalancer:
|
|
|
|
servers:
|
|
|
|
- url: http://nginx:80
|
|
|
|
{%- endif %}
|
2020-02-04 16:04:47 +03:00
|
|
|
|
2019-11-28 23:16:06 +03:00
|
|
|
providers:
|
|
|
|
# https://docs.traefik.io/master/providers/file/
|
|
|
|
file:
|
|
|
|
filename: /etc/traefik/traefik.yml
|
|
|
|
watch: true
|