From 71cc848b7233f81e72e34503a29eb5f0a715eaf0 Mon Sep 17 00:00:00 2001 From: Jean Froment Date: Tue, 19 Jun 2018 15:37:29 +0200 Subject: [PATCH] Disable frontend and test portainer with traefik --- .gitignore | 1 + config.default | 2 ++ docker-compose.yml | 41 +++++++++++++++++-------- traefik/init-traefik.sh | 3 ++ traefik/traefik.env.sample | 2 ++ traefik/traefik.toml | 61 ++++++++++++++++++++++++++++++++++++++ traefik/traefik.yml | 24 +++++++++++++++ 7 files changed, 121 insertions(+), 13 deletions(-) create mode 100644 traefik/init-traefik.sh create mode 100644 traefik/traefik.env.sample create mode 100644 traefik/traefik.toml create mode 100644 traefik/traefik.yml diff --git a/.gitignore b/.gitignore index 9184ea4..c983e6f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /config tunnel-options.sh +traefik/traefik.env diff --git a/config.default b/config.default index dd48519..f789922 100644 --- a/config.default +++ b/config.default @@ -6,3 +6,5 @@ MYSQL_ROOT_PASSWORD=h4ckMePleAse # For Plex Pass download only PLEX_EMAIL= PLEX_PASSWORD= + +PORTAINER_ADMIN_PASSWORD=h4ckMePleAse \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index b535d4a..39019dd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,19 +14,19 @@ volumes: mountpoint: /data/torrents services: - frontend: - image: fromenje/seedbox:frontend - build: Dockerfiles/frontend - restart: always - networks: - - main - ports: - - "80:80" - - "443:443" - volumes: - - config:/config - env_file: - - config + # frontend: + # image: fromenje/seedbox:frontend + # build: Dockerfiles/frontend + # restart: always + # networks: + # - main + # ports: + # - "80:80" + # - "443:443" + # volumes: + # - config:/config + # env_file: + # - config deluge: image: fromenje/seedbox:deluge @@ -115,3 +115,18 @@ services: - PGID=33 - PUID=33 - TZ=Europe/Paris + + portainer: + image: portainer/portainer + volumes: + - /var/run/docker.sock:/var/run/docker.sock + networks: + - web + env_file: + - config + - traefik/traefik.env + command: --admin-password ${PORTAINER_ADMIN_PASSWORD} --host=unix:///var/run/docker.sock + labels: + - 'traefik.backend=portainer' + - 'traefik.port=9000' + - 'traefik.frontend.rule=Host:portainer.${TRAEFIK_DOMAIN}' diff --git a/traefik/init-traefik.sh b/traefik/init-traefik.sh new file mode 100644 index 0000000..ec313a7 --- /dev/null +++ b/traefik/init-traefik.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +touch /opt/traefik/acme.json && chmod 600 /opt/traefik/acme.json diff --git a/traefik/traefik.env.sample b/traefik/traefik.env.sample new file mode 100644 index 0000000..eb47b57 --- /dev/null +++ b/traefik/traefik.env.sample @@ -0,0 +1,2 @@ +ACME_MAIL=my-email@my-provider.com +TRAEFIK_DOMAIN=mydomain.com diff --git a/traefik/traefik.toml b/traefik/traefik.toml new file mode 100644 index 0000000..15599c7 --- /dev/null +++ b/traefik/traefik.toml @@ -0,0 +1,61 @@ +#https://docs.traefik.io/toml/ +#https://docs.traefik.io/user-guide/examples/ +################################################################ +# Global configuration +################################################################ +logLevel = "WARNING" +defaultEntryPoints = ["http", "https"] + +[entryPoints] + [entryPoints.http] + address = ":80" + [entryPoints.http.redirect] + entryPoint = "https" + [entryPoints.https] + address = ":443" + [entryPoints.https.tls] + +[retry] + +# [acme] +# email = "email@company.com" +# storage = "acme.json" +# onDemande = true +# caServer = "https://acme-v02.api.letsencrypt.org/directory" +# entryPoint = "https" +# [acme.httpChallenge] +# entryPoint = "http" +# [[acme.domains]] +# main = "sub.domain.com" +# sans = ["sub.domain.com", "sub2.domain.com"] + +[acme] +email = "overriden@in-traefik.yml" +storage = "acme.json" +entryPoint = "https" +onHostRule = true +acmeLogging = true +[acme.httpChallenge] +entryPoint = "http" + +################################################################ +# Web configuration backend +################################################################ +[web] +address = ":8080" + +################################################################ +# Traefik Config +################################################################ + +################################################################ +# Docker configuration backend +################################################################ +[docker] +endpoint = "unix:///var/run/docker.sock" +domain = "mydomain.com" +watch = true +exposedByDefault = false + +[file] +watch = true diff --git a/traefik/traefik.yml b/traefik/traefik.yml new file mode 100644 index 0000000..17200bf --- /dev/null +++ b/traefik/traefik.yml @@ -0,0 +1,24 @@ +version: '2' + +services: + traefik: + image: traefik + container_name: traefik + restart: always + env_file: + - ./traefik.env + networks: + - webgateway + command: --acme.email=${ACME_MAIL} --docker.domain=${TRAEFIK_DOMAIN} + ports: + - "80:80" + - "443:443" + - "8080:8080" + volumes: + - /var/run/docker.sock:/var/run/docker.sock + - ./traefik.toml:/traefik.toml + - /opt/traefik/acme.json:/acme.json + +networks: + webgateway: + driver: bridge