From abf746b7e66bf4eb105cbe1f4fcaef5fb7b0755f Mon Sep 17 00:00:00 2001 From: Phillip Date: Thu, 7 Jun 2018 21:12:39 +0200 Subject: [PATCH] Added domain and https support --- docker-compose.yaml | 16 +++++ traefik.toml | 138 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 154 insertions(+) create mode 100644 traefik.toml diff --git a/docker-compose.yaml b/docker-compose.yaml index 23a84a6..f7179d3 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,5 +1,16 @@ version: '2' + services: + traefik: + image: traefik:latest + ports: + - "80:80" + - "443:443" + volumes: + - "/opt/traefik/traefik.toml:/etc/traefik/traefik.toml" + - "/opt/traefik/acme:/etc/traefik/acme" + - "/var/run/docker.sock:/var/run/docker.sock" + mongo: image: mongo:3.6 ports: @@ -16,3 +27,8 @@ services: - mongo:mongo volumes: - ./static:/var/www/static + labels: + traefik.enable: "true" + traefik.port: "8080" + traefik.frontend.rule: "Host: eduboard.io" + diff --git a/traefik.toml b/traefik.toml new file mode 100644 index 0000000..7d9c841 --- /dev/null +++ b/traefik.toml @@ -0,0 +1,138 @@ +################################################################ +# Global configuration +################################################################ + +# Enable debug mode +# +# Optional +# Default: false +# +# debug = true + +# Log level +# +# Optional +# Default: "ERROR" +# +# logLevel = "ERROR" + +# Entrypoints to be used by frontends that do not specify any entrypoint. +# Each frontend can specify its own entrypoints. +# +# Optional +# Default: ["http"] +# +defaultEntryPoints = ["http", "https"] + +# Entrypoints definition +# +# Optional +# Default: +[entryPoints] + [entryPoints.http] + address = ":80" + [entryPoints.http.redirect] + entryPoint = "https" + [entryPoints.https] + address = ":443" + [entryPoints.https.tls] + +[acme] + email = "changeme@eduboard" + storage = "/etc/traefik/acme/acme.json" + entryPoint = "https" + onHostRule = true + + + [acme.httpChallenge] + entryPoint = "http" +# Traefik logs +# Enabled by default and log to stdout +# +# Optional +# +# [traefikLog] + +# Sets the filepath for the traefik log. If not specified, stdout will be used. +# Intermediate directories are created if necessary. +# +# Optional +# Default: os.Stdout +# +# filePath = "log/traefik.log" + +# Format is either "json" or "common". +# +# Optional +# Default: "common" +# +# format = "common" + +# Enable access logs +# By default it will write to stdout and produce logs in the textual +# Common Log Format (CLF), extended with additional fields. +# +# Optional +# +# [accessLog] + +# Sets the file path for the access log. If not specified, stdout will be used. +# Intermediate directories are created if necessary. +# +# Optional +# Default: os.Stdout +# +# filePath = "/path/to/log/log.txt" + +# Format is either "json" or "common". +# +# Optional +# Default: "common" +# +# format = "common" + +################################################################ +# Web configuration backend +################################################################ + +# Enable web configuration backend +#[web] + +# Web administration port +# +# Required +# +#address = ":8080" + +################################################################ +# Docker configuration backend +################################################################ + +# Enable Docker configuration backend +[docker] + +# Docker server endpoint. Can be a tcp or a unix socket endpoint. +# +# Required +# Default: "unix:///var/run/docker.sock" +# +# endpoint = "tcp://10.10.10.10:2375" + +# Default domain used. +# Can be overridden by setting the "traefik.domain" label on a container. +# +# Optional +# Default: "" +# +domain = "eduboard" + +# Expose containers by default in traefik +# +# Optional +# Default: true +# + exposedbydefault = false + +# Enable to watch docker changes +watch = true +