mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-08-09 14:34:53 +03:00
Added traefik Dockerfile and configuration file.
Updated 'production.yml' to add traefik and remove caddy Removed caddy Dockerfile and configuration file
This commit is contained in:
parent
36529326d3
commit
52ed5a5f29
|
@ -1,14 +0,0 @@
|
|||
www.{% raw %}{$DOMAIN_NAME}{% endraw %} {
|
||||
redir https://{{cookiecutter.domain_name}}
|
||||
}
|
||||
|
||||
{% raw %}{$DOMAIN_NAME}{% endraw %} {
|
||||
proxy / django:5000 {
|
||||
header_upstream Host {host}
|
||||
header_upstream X-Real-IP {remote}
|
||||
header_upstream X-Forwarded-Proto {scheme}
|
||||
}
|
||||
log stdout
|
||||
errors stdout
|
||||
gzip
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
FROM abiosoft/caddy:0.10.6
|
||||
|
||||
COPY ./compose/production/caddy/Caddyfile /etc/Caddyfile
|
|
@ -0,0 +1,2 @@
|
|||
FROM traefik
|
||||
COPY ./compose/production/traefik/traefik.toml /etc/traefik
|
|
@ -0,0 +1,37 @@
|
|||
logLevel = "ERROR"
|
||||
defaultEntryPoints = ["http", "https"]
|
||||
|
||||
[web]
|
||||
# Port for the status page
|
||||
address = ":7080"
|
||||
|
||||
# Entrypoints, http and https
|
||||
[entryPoints]
|
||||
# http should be redirected to https
|
||||
[entryPoints.http]
|
||||
address = ":80"
|
||||
[entryPoints.http.redirect]
|
||||
entryPoint = "https"
|
||||
# https is the default
|
||||
[entryPoints.https]
|
||||
address = ":443"
|
||||
[entryPoints.https.tls]
|
||||
|
||||
# Enable ACME (Let's Encrypt): automatic SSL
|
||||
[acme]
|
||||
# Email address used for registration
|
||||
email = "{{ cookiecutter.email }}"
|
||||
storageFile = "acme.json"
|
||||
entryPoint = "https"
|
||||
onDemand = false
|
||||
OnHostRule = true
|
||||
# Use a HTTP-01 acme challenge rather than TLS-SNI-01 challenge
|
||||
[acme.httpChallenge]
|
||||
entryPoint = "http"
|
||||
|
||||
# Enable Docker configuration backend
|
||||
[docker]
|
||||
endpoint = "unix:///var/run/docker.sock"
|
||||
domain = "{{cookiecutter.domain_name}}"
|
||||
watch = true
|
||||
exposedbydefault = false
|
|
@ -3,7 +3,6 @@ version: '2'
|
|||
volumes:
|
||||
postgres_data: {}
|
||||
postgres_backup: {}
|
||||
caddy: {}
|
||||
|
||||
services:
|
||||
django:{% if cookiecutter.use_celery == 'y' %} &django{% endif %}
|
||||
|
@ -18,6 +17,11 @@ services:
|
|||
- ./.envs/.production/.django
|
||||
- ./.envs/.production/.postgres
|
||||
command: /gunicorn.sh
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.backend=django"
|
||||
- "traefik.frontend.rule={{ cookiecutter.domain_name }}"
|
||||
- "traefik.port=5000"
|
||||
|
||||
postgres:
|
||||
build:
|
||||
|
@ -30,20 +34,21 @@ services:
|
|||
env_file:
|
||||
- ./.envs/.production/.postgres
|
||||
|
||||
caddy:
|
||||
traefik:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./compose/production/caddy/Dockerfile
|
||||
image: {{ cookiecutter.project_slug }}_production_caddy
|
||||
dockerfile: ./compose/production/traefik/Dockerfile
|
||||
image: {{ cookiecutter.project_slug }}_production_traefik
|
||||
depends_on:
|
||||
- django
|
||||
volumes:
|
||||
- caddy:/root/.caddy
|
||||
env_file:
|
||||
- ./.envs/.production/.caddy
|
||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||
# - ./traefik/traefik.toml:/etc/traefik/traefik.toml:ro
|
||||
# - ./traefik/acme:/etc/traefik/acme
|
||||
ports:
|
||||
- "0.0.0.0:80:80"
|
||||
- "0.0.0.0:443:443"
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
- "7080:7080"
|
||||
|
||||
redis:
|
||||
image: redis:3.2
|
||||
|
@ -59,6 +64,8 @@ services:
|
|||
- ./.envs/.production/.django
|
||||
- ./.envs/.production/.postgres
|
||||
command: /start-celeryworker.sh
|
||||
labels:
|
||||
- "traefik.enable=false"
|
||||
|
||||
celerybeat:
|
||||
<<: *django
|
||||
|
@ -70,5 +77,7 @@ services:
|
|||
- ./.envs/.production/.django
|
||||
- ./.envs/.production/.postgres
|
||||
command: /start-celerybeat.sh
|
||||
labels:
|
||||
- "traefik.enable=false"
|
||||
|
||||
{%- endif %}
|
||||
|
|
Loading…
Reference in New Issue
Block a user