Browse Source

preparation atelier: add default values, fix labels, fix environment

Guilhem Saurel 6 years ago
parent
commit
594bf0f30b
8 changed files with 30 additions and 77 deletions
  1. 6 0
      .gitmodules
  2. 12 6
      cloud/docker-compose.yml
  3. 3 4
      homepage/docker-compose.yml
  4. 7 5
      pad/docker-compose.yml
  5. 1 0
      traefik-dev
  6. 1 0
      traefik-prod
  7. 0 23
      traefik/docker-compose.yml
  8. 0 39
      traefik/traefik.toml

+ 6 - 0
.gitmodules

@@ -0,0 +1,6 @@
+[submodule "traefik-dev"]
+	path = traefik-dev
+	url = git@github.com:nim65s/traefik-dev.git
+[submodule "traefik-prod"]
+	path = traefik-prod
+	url = git@github.com:nim65s/traefik-prod.git

+ 12 - 6
cloud/docker-compose.yml

@@ -14,18 +14,24 @@ services:
     env_file:
       - .env
     volumes:
-      - ${CHATONS_ROOT_DIR}/nextcloud/db:/var/lib/mysql
+      - ${CHATONS_ROOT_DIR:-/srv/chatons}/nextcloud/db:/var/lib/mysql
 
   app:
     image: nextcloud
     restart: always
-    depends_on:
-      - cloud_db
+    environment:
+      - MYSQL_DATABASE=nextcloud
+      - MYSQL_USER=nextcloud
+      - MYSQL_HOST=db:3306
+    env_file:
+      - .env
     labels:
-      - "traefik.backend=nextcloud"
-      - "traefik.frontend.rule=Host:cloud.${CHATONS_DOMAIN},www.cloud.${CHATONS_DOMAIN}"
+      traefik.enable: "true"
+      traefik.backend: "nextcloud"
+      traefik.frontend.rule: "Host: cloud.${CHATONS_DOMAIN:-local}, www.cloud.${CHATONS_DOMAIN:-local}"
+      traefik.docker.network: "traefik"
     networks:
       - traefik
       - default
     volumes:
-      - ${CHATONS_ROOT_DIR}/nextcloud/app:/var/www/html
+      - ${CHATONS_ROOT_DIR:-/srv/chatons}/nextcloud/app:/var/www/html

+ 3 - 4
homepage/docker-compose.yml

@@ -9,9 +9,8 @@ services:
     build: .
     restart: always
     labels:
-      - "traefik.backend=homepage"
-      # note: www must also be present because we need its certificate
-      # and it is required for traefik redirection to work too (in traefik.yml)
-      - "traefik.frontend.rule=Host:${CHATONS_DOMAIN},www.${CHATONS_DOMAIN}"
+      traefik.enable: "true"
+      traefik.backend: "homepage"
+      traefik.frontend.rule: "Host: ${CHATONS_DOMAIN:-local}, www.${CHATONS_DOMAIN:-local}"
     networks:
       - traefik

+ 7 - 5
pad/docker-compose.yml

@@ -11,7 +11,7 @@ services:
     env_file:
       - .env
     volumes:
-      - ${CHATONS_ROOT_DIR}/etherpad/db:/var/lib/mysql
+      - ${CHATONS_ROOT_DIR:-/srv/chatons}/etherpad/db:/var/lib/mysql
 
   app:
     build: .
@@ -19,13 +19,15 @@ services:
     env_file:
       - .env
     environment:
-      - ETHERPAD_DB_HOST=pad_db
+      - ETHERPAD_DB_HOST=db
       - ETHERPAD_TITLE=Bloc Note
     labels:
-      - "traefik.backend=etherpad"
-      - "traefik.frontend.rule=Host:pad.${CHATONS_DOMAIN}"
+      traefik.enable: "true"
+      traefik.backend: "etherpad"
+      traefik.frontend.rule: "Host: pad.${CHATONS_DOMAIN:-local}, www.pad.${CHATONS_DOMAIN:-local}"
+      traefik.docker.network: "traefik"
     networks:
       - default
       - traefik
     volumes:
-      - ${CHATONS_ROOT_DIR}/etherpad/app:/opt/etherpad-lite/var
+      - ${CHATONS_ROOT_DIR:-/srv/chatons}/etherpad/app:/opt/etherpad-lite/var

+ 1 - 0
traefik-dev

@@ -0,0 +1 @@
+Subproject commit 4b04e2a29173f6d0549ef959e453c16770e740fd

+ 1 - 0
traefik-prod

@@ -0,0 +1 @@
+Subproject commit 1acf455c9a0c0dffeac0c44b2d335c42cab5b3b2

+ 0 - 23
traefik/docker-compose.yml

@@ -1,23 +0,0 @@
-version: '3'
-
-services:
-  traefik:
-    image: traefik
-    command: --acme.email=${CHATONS_MAIL}
-    restart: always
-    ports:
-      - 80:80
-      - 443:443
-      - 127.0.0.1:8080:8080
-    networks:
-      - traefik
-    volumes:
-      - /var/run/docker.sock:/var/run/docker.sock
-      - ${CHATONS_ROOT_DIR}/traefik/acme.json:/acme.json
-      - ${CHATONS_ROOT_DIR}/traefik/traefik.toml:/traefik.toml
-
-### NETWORKS
-
-networks:
-  traefik:
-    external: true

+ 0 - 39
traefik/traefik.toml

@@ -1,39 +0,0 @@
-debug = false
-checkNewVersion = true
-logLevel = "ERROR"
-defaultEntryPoints = ["https","http"]
-
-[web]
-# web ui on 8080
-
-[entryPoints]
-  [entryPoints.http]
-  address = ":80"
-    [entryPoints.http.redirect]
-    entryPoint = "https"
-  [entryPoints.https]
-  address = ":443"
-    [entryPoints.https.redirect]
-    # For this to work, there must be a corresponding frontend rule
-    # See https://github.com/containous/traefik/issues/919#issuecomment-311033114
-    regex = "^https://www.(.*)"
-    replacement = "https://$1"
-  [entryPoints.https.tls]
-
-[docker]
-# the domain is set on the command line
-endpoint = "unix:///var/run/docker.sock"
-watch = true
-exposedbydefault = true
-domain = "docker.localhost"
-
-[acme]
-# the email is set on the command line
-storage = "acme.json"
-entryPoint = "https"
-OnHostRule = true
-#acmeLogging = true
-#caServer = "https://acme-staging.api.letsencrypt.org/directory"
-[acme.httpChallenge]
-  entryPoint = "http"
-