From 2cb7fa71103e04e47bbd8c99ef162c2e8b86c47a Mon Sep 17 00:00:00 2001
From: Richard Papp <richard.papp@boromino.com>
Date: Thu, 1 Feb 2018 15:46:19 +0100
Subject: [PATCH] Add SSL support.

---
 Traefik.php | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/Traefik.php b/Traefik.php
index 4607ef4..7948b38 100644
--- a/Traefik.php
+++ b/Traefik.php
@@ -45,19 +45,25 @@ class Traefik {
     }
     else {
       $fs->mkdir($traefikPath);
+      $fs->mkdir($traefikPath . '/certs');
+      $cmd = 'openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout ';
+      $cmd .= $traefikPath . '/certs/key.pem -out ' . $traefikPath . '/certs/cert.pem';
+      exec($cmd);
       $traefik = [
         'version' => '2',
         'services' => [
           'traefik' => [
             'image' => 'traefik',
             'restart' => 'unless-stopped',
-            'command' => '-c /dev/null --web --docker --logLevel=DEBUG',
+            'command' => '-c /dev/null --web --docker --logLevel=DEBUG --defaultEntryPoints="https" --defaultEntryPoints="http" --entryPoints="Name:https Address::443 TLS:/certs/cert.pem,/certs/key.pem" --entryPoints="Name:http Address::80"',
             'networks' => [],
             'ports' => [
               '8000:80',
+              '443:443',
               '8080:8080',
             ],
             'volumes' => [
+              './certs:/certs/',
               '/var/run/docker.sock:/var/run/docker.sock',
             ],
           ],
-- 
GitLab