Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically deploy with https #76

Open
wants to merge 25 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 29 additions & 14 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
version: "3.5"

services:

nginx:
isedwards marked this conversation as resolved.
Show resolved Hide resolved
container_name: surface-nginx
build: ./nginx
volumes:
- ./api/static:/home/app/web/staticfiles
- ./data:/home/app/web/data
env_file:
- api/production.env
ports:
- 8080:80
depends_on:
- api

cache:
container_name: surface-cache
image: memcached
Expand Down Expand Up @@ -43,6 +29,8 @@ services:
options:
max-size: "1M"
max-file: "10"
networks:
- opencdms-surface

api:
build:
Expand All @@ -69,6 +57,15 @@ services:
options:
max-size: "1M"
max-file: "10"
networks:
- opencdms-surface
expose:
- 8000
labels:
- "traefik.enable=true"
- "traefik.http.routers.django.rule=Host(`$HOST_FQDN`)"
- "traefik.http.routers.django.tls=true"
- "traefik.http.routers.django.tls.certresolver=letsencrypt"

celery_worker:
build:
Expand All @@ -93,6 +90,8 @@ services:
options:
max-size: "1M"
max-file: "10"
networks:
- opencdms-surface

celery_beat:
build:
Expand All @@ -114,3 +113,19 @@ services:
options:
max-size: "1M"
max-file: "10"
networks:
- opencdms-surface

traefik:
image: traefik:latest
ports:
- "80:80"
- "443:443"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "$PWD/traefik/traefik.toml:/etc/traefik/traefik.toml"
networks:
- opencdms-surface

networks:
opencdms-surface:
23 changes: 23 additions & 0 deletions traefik/traefik.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[entryPoints]
[entryPoints.web]
address = ":80"
[entryPoints.web.http]
[entryPoints.web.http.redirections]
[entryPoints.web.http.redirections.entryPoint]
to = "websecure"
scheme = "https"

[entryPoints.websecure]
address = ":443"

[accessLog]

[providers]
[providers.docker]
exposedByDefault = false

[certificatesResolvers.letsencrypt.acme]
email = "[email protected]"
storage= "acme.json"
[certificatesResolvers.letsencrypt.acme.httpChallenge]
entryPoint = "web"