Browse Source

feat: traefik ssl configuration with acme provider

Nicolas Meienberger 2 years ago
parent
commit
075dd516a0
6 changed files with 27 additions and 27 deletions
  1. 1 0
      .gitignore
  2. 17 0
      docker-compose.dev.yml
  3. 1 0
      docker-compose.rc.yml
  4. 1 0
      docker-compose.yml
  5. 0 16
      traefik/dynamic.yml
  6. 7 11
      traefik/traefik.yml

+ 1 - 0
.gitignore

@@ -11,6 +11,7 @@ repos/*
 !repos/.gitkeep
 apps/*
 !apps/.gitkeep
+traefik/shared
 
 scripts/pacapt
 

+ 17 - 0
docker-compose.dev.yml

@@ -1,9 +1,26 @@
 version: "3.7"
 
 services:
+  reverse-proxy:
+    container_name: reverse-proxy
+    image: traefik:v2.8
+    restart: always
+    ports:
+      - ${NGINX_PORT-80}:80
+      - ${NGINX_PORT_SSL-443}:443
+      - 8080:8080
+    command: --providers.docker
+    volumes:
+      - /var/run/docker.sock:/var/run/docker.sock:ro
+      - ${PWD}/traefik:/root/.config
+      - ${PWD}/traefik/shared:/shared
+    networks:
+      - tipi_main_network
+
   tipi-db:
     container_name: tipi-db
     image: postgres:latest
+    user: 1000:1000
     restart: on-failure
     stop_grace_period: 1m
     volumes:

+ 1 - 0
docker-compose.rc.yml

@@ -12,6 +12,7 @@ services:
     volumes:
       - /var/run/docker.sock:/var/run/docker.sock:ro
       - ${PWD}/traefik:/root/.config
+      - ${PWD}/traefik/shared:/shared
     networks:
       - tipi_main_network
 

+ 1 - 0
docker-compose.yml

@@ -12,6 +12,7 @@ services:
     volumes:
       - /var/run/docker.sock:/var/run/docker.sock:ro
       - ${PWD}/traefik:/root/.config
+      - ${PWD}/traefik/shared:/shared
     networks:
       - tipi_main_network
 

+ 0 - 16
traefik/dynamic.yml

@@ -1,16 +0,0 @@
-http:
-  routers:
-    dashboard:
-      rule: PathPrefix(`/`)
-      service: dashboard
-    
-  services:
-    dashboard:
-      loadBalancer:
-        servers:
-        - port: 3000
-    
-# tls:
-#   certificates:
-#     - certFile: "/root/.config/ssl/local-cert.pem"
-#       keyFile: "/root/.config/ssl/local-key.pem"

+ 7 - 11
traefik/traefik.yml

@@ -8,23 +8,19 @@ providers:
     watch: true
     exposedByDefault: false
 
-  # TODO: Add TLS support
-  # file:
-  #   filename: /root/.config/dynamic.yml
-  #   watch: true
-
 entryPoints:
   web:
     address: ":80"
-    # TODO: Redirect when TLS is working
-    # http:
-    #   redirections:
-    #     entryPoint:
-    #       to: websecure
-    #       scheme: https
   websecure:
     address: ":443"
 
+certificatesResolvers:
+  myresolver:
+    acme:
+      email: acme@thisprops.com 
+      storage: /shared/acme.json
+      httpChallenge:
+        entryPoint: web
 
 log:
   level: DEBUG