about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEmile <hanemile@protonmail.com>2019-10-09 13:46:34 +0200
committerEmile <hanemile@protonmail.com>2019-10-09 13:46:34 +0200
commit392f2b771dcec723bd70f01e624653150f85931b (patch)
tree6ae84d631bbb948be00d8ebbdccadcf19895ff89
parent21c15a0d397b144e17a07c5f6fc6a6ae669b2f1b (diff)
https, each user with a custom service
-rw-r--r--src/docker.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/docker.go b/src/docker.go
index b5398d8..e3ff19c 100644
--- a/src/docker.go
+++ b/src/docker.go
@@ -64,9 +64,16 @@ func spawnCompanion(username string, accesscode string) {
 		// Container labels used by traefik
 		Labels: map[string]string{
 			"traefik.enable": "true",
-			fmt.Sprintf("traefik.http.routers.%s.entrypoints", username):               "web",
-			fmt.Sprintf("traefik.http.routers.%s.rule", username):                      fmt.Sprintf("Host(`%s.%s`)", username, os.Getenv("HOSTNAME")),
-			fmt.Sprintf("traefik.http.services.%s.loadbalancer.server.port", username): "8080",
+			fmt.Sprintf("traefik.http.routers.%s.entrypoints", username):                              "web",
+			fmt.Sprintf("traefik.http.routers.%s.rule", username):                                     fmt.Sprintf("Host(`%s.%s`)", username, os.Getenv("HOSTNAME")),
+			fmt.Sprintf("traefik.http.middlewares.%s-https-redirect.redirectscheme.scheme", username): "https",
+			fmt.Sprintf("traefik.http.routers.%s.middlewares", username):                              fmt.Sprintf("%s-https-redirect", username),
+			fmt.Sprintf("traefik.http.routers.%s-secure.entrypoints", username):                       "websecure",
+			fmt.Sprintf("traefik.http.routers.%s-secure.rule", username):                              fmt.Sprintf("Host(`%s.%s`)", username, os.Getenv("HOSTNAME")),
+			fmt.Sprintf("traefik.http.routers.%s-secure.tls", username):                               "true",
+			fmt.Sprintf("traefik.http.routers.%s-secure.tls.certresolver", username):                  "mytlschallenge",
+			fmt.Sprintf("traefik.http.routers.%s-secure.service", username):                           fmt.Sprintf("%s", username),
+			fmt.Sprintf("traefik.http.services.%s.loadbalancer.server.port", username):                "8080",
 			"traefik.docker.network": "circus",
 		},
 	}