diff --git a/cert.pem b/cert.pem new file mode 100644 index 0000000..d4e3b89 --- /dev/null +++ b/cert.pem @@ -0,0 +1,28 @@ +-----BEGIN CERTIFICATE----- +MIIE3DCCAsQCCQDnJQvR73XJuTANBgkqhkiG9w0BAQsFADAwMQswCQYDVQQGEwJm +cjERMA8GA1UECAwIYmFzLXJoaW4xDjAMBgNVBAcMBXN0cmFzMB4XDTI0MDEzMTEy +NTYwMFoXDTI1MDEzMDEyNTYwMFowMDELMAkGA1UEBhMCZnIxETAPBgNVBAgMCGJh +cy1yaGluMQ4wDAYDVQQHDAVzdHJhczCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCC +AgoCggIBAJg2JL8H/j6mVM6aUQKw6+YvPPM115g/dqdydxikAVx1L7HcHq9iw7AA +QcvKqrWZaBkefV8fED58KaOrWm28UVj3icVBQELlc+RiGM6PXw7HiAJ5BoZQM62t +u1EKhdjdq6yb6pP3sfVmPJKXamqYcWFjaNtlkDUD38zFBfuru7APLPodjCBw++BF +MXKZZnTqG6w5ZcVJb8YA6xAGPR04Y2I8UTbbJOEB3tnAA/J517Q+esXyCeU8iFi9 +Ofmj+Qp2a1ZVAgd8SKpi+vZax5OFVgZXrtvhAFAoVhh3ZNNbgOZ4ZYnGZHs9tbyf +fadHsGRSB88XYmFgcQrHJqcOMqlC9VthE7RIIW3n4rv5V8RlWpvwfroNGDSso3zJ +j0KDYw40Z2by2UBG+dumLcL7zP8JsGx/JsAB8/6YLzN0OsE1aNYsGLv1RIHECG43 +mjghsBGqcUIOBo0gei+tEMAo9Zk+CKEHLZCzRBNUWaKo3Gu8vEhEZ/NlXz/cTcb4 +w/BjsuUpI6/4/n9qgZSC4tybAS+OdD863RaDUCkQE0Yn+rtlWKqBNxJTr+T7FEtb ++4OyuqvO9WmvYxgtuVBMR0imRcrh7/Iks+3neiPhZairNMgR8sEv455EF6M5wY4o +DLZTgjvVHDZ0my2oKY4UmaUCOxB43eR9gDzg2QF2ylt9puXLi34TAgMBAAEwDQYJ +KoZIhvcNAQELBQADggIBAGZ7Z6NbAIIPrl5/G6WQQeP6H7lk9b3a2FAUpldhqHo5 +Qc+M+OWnk0HfGeAChJzhhm07i1Y/kQN9HmoxClzKa5DaC97L/86Gr8qLoK7Y6Iof +l0eOPJFWGQspIcrniPvYrf03qBP9ZENBsiPhPzXRgUB+YankW9qGnJwKJl69SGo3 +8BuJcE6RYovDEPprFFd2qZLAxjQQQMNyvV8sLQy9keX8rnVRrHtnEEVwg/40G/43 +vnB/01SlppBL+aiuOl/cd/sKmJnZqbOvZyZt/FW06c/sN74EijXBJFKY7OleYsSn +szzy3Mg3dj/ln6wyC22Ct7sF7NCSHK7hw626yhgwoqy/r4luBj2qSi2kgJJH+yg9 +Foi+YMtQvr1gs3syHMx5G7XDPiXypXRl74Vuj8pIfiN0NxkC0FOcEqivnM55yf9P +xPE3DoRDlLhPp2z2uORv9pXh+cNvV/NK5Y12T6/AWZLWDc1/cVEvN1l7nEX2vWqb +R3/GYnbHCY3z9DDRKa01ajc7/C6Dhrn7E006lfA4Gs0vZr+whApL1UkKn7H8wAxT +GOMGyhxVl08Fyjhs+KPvZ6q2yGXNutgOT+C6InzN+kG54hwEJM6WznaXp53+FQWZ +G3b+Ob+7JGunSHwAu1ff/kXVKzkSGmvgJ72almJbsKymZ70Z23cc+W3puVhECsdP +-----END CERTIFICATE----- diff --git a/certificates.yml b/certificates.yml new file mode 100644 index 0000000..278193e --- /dev/null +++ b/certificates.yml @@ -0,0 +1,4 @@ +tls: + certificates: + - certFile: /certs/cert.pem + keyFile: /certs/key.pem diff --git a/docker-compose.yml b/docker-compose.yml index 04da7ba..65fd9e6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,20 +1,24 @@ version: "2" services: traefik: - restart: unless-stopped + image: traefik container_name: traefik - image: traefik:v2.0.2 + command: + - "--api.insecure=true" + - "--providers.docker=true" + - "--providers.docker.exposedbydefault=false" + - "--entrypoints.web.address=:80" + - "--entrypoints.websecure.address=:443" + - "--providers.file.filename=/etc/traefik/certificates.yml" ports: - "80:80" - "443:443" - "8080:8080" - labels: - - "traefik.http.services.traefik.loadbalancer.server.port=8080" volumes: - - ./traefik/traefik.yml:/etc/traefik/traefik.yml - - ./traefik/tls.yml:/etc/traefik/tls.yml - /var/run/docker.sock:/var/run/docker.sock - - certs:/etc/ssl/traefik + - ./certificates.yml:/etc/traefik/certificates.yml + - ./key.pem:/certs/key.pem + - ./cert.pem:/certs/cert.pem networks: - web @@ -53,26 +57,13 @@ services: volumes: - ./front:/app/src labels: - - "traefik.http.routers.front.rule=Host(\"instantchat.${SITE_ADDRESS}.traekif.me\")" - - "traefik.http.routers.front-tls.tls.domains[0].main=instantchat.traefik.me" - - "traefik.http.routers.front-tls.tls.domains[0].sans=instantchat-*.traefik.me" + - "traefik.enable=true" + - "traefik.http.routers.front.rule=HostRegexp(`{any:.*}`)" + - "traefik.http.routers.front.entrypoints=websecure" - "traefik.http.routers.front.tls=true" - "traefik.http.services.front.loadbalancer.server.port=3000" networks: - web - reverse-proxy-https-helper: - image: alpine - command: sh -c "cd /etc/ssl/traefik - && wget traefik.me/cert.pem -O cert.pem - && wget traefik.me/privkey.pem -O privkey.pem" - volumes: - - certs:/etc/ssl/traefik - networks: - - web - networks: web: - -volumes: - certs: diff --git a/key.pem b/key.pem new file mode 100644 index 0000000..06b66e8 --- /dev/null +++ b/key.pem @@ -0,0 +1,52 @@ +-----BEGIN PRIVATE KEY----- +MIIJQwIBADANBgkqhkiG9w0BAQEFAASCCS0wggkpAgEAAoICAQCYNiS/B/4+plTO +mlECsOvmLzzzNdeYP3ancncYpAFcdS+x3B6vYsOwAEHLyqq1mWgZHn1fHxA+fCmj +q1ptvFFY94nFQUBC5XPkYhjOj18Ox4gCeQaGUDOtrbtRCoXY3ausm+qT97H1ZjyS +l2pqmHFhY2jbZZA1A9/MxQX7q7uwDyz6HYwgcPvgRTFymWZ06husOWXFSW/GAOsQ +Bj0dOGNiPFE22yThAd7ZwAPyede0PnrF8gnlPI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iy69n0idjWDyOrDw9hzFZwnN+3+6FAo23i4tz6ZltE +vEm06ksw20HLTuMsAjJ5G0yaUv3z7Jy86ilB1VkCggEBAIT0ax1VnCJ+zPqE41sg +EEj7s+fdkbMpQDBIubVdYb/U9DoGGunQJp6mc6g80p0hOAsBrlHqsH1IwtblESnO +nY57KuPa1CEA55O4n1fb6vH03pinq5XbIom8q9/aSQjy0T0xmQ9/3axTS4VDm6Q7 +sN3VMKFPrxR4Kn/psuvL4HU05PebphTODdUTLYioKqFcOT1XvAdX14OI9iLpshwd +H1ddIxpgaR0mb258fomb2faksN6ZcXdWhufpdddTfpyKy3kgvhuzbjqdcvKiRQk4 +OXaeJs0LX/TQKMg5cZn78F6hSVQC9WVNrAsTH2EVA0oFBHk67cd1fvLYnOpk9hYQ +vd8CggEBAK9RaVoPd1Tl1JIOJqVBdgJrTn6pWTKo+pf+svJiKTpAFu3ydwrFU0So +piygPRkYbEEFG+h0S/KzV7pifBrSImitRQvi55imCcXL+qhmgNmlALrO95+RJN/b +srMKyPrCoJZtcl8hbcg7KYntCpnZcvU8G1DxZqzxun7UR0XcrPOa3/oKKcVZNrnb +QiUxzCLz5QXt+dTq5myWaO7Z7WX5a7yvuBdOHj38jGYVvT6W/rAGmQL/m7EstamK +sn/2uZ9tI+PPwUDIBjtlsiE4Wv7G4LFsjFx6jwCaUkvE5fnU5Vs84eJOssTTwDTS +xJLD/iCOHRtF4UyQeo2Ao+Qklhw9CA0= +-----END PRIVATE KEY----- diff --git a/traefik/tls.yml b/traefik/tls.yml deleted file mode 100644 index 310c8c2..0000000 --- a/traefik/tls.yml +++ /dev/null @@ -1,9 +0,0 @@ -tls: - stores: - default: - defaultCertificate: - certFile: /etc/ssl/traefik/cert.pem - keyFile: /etc/ssl/traefik/privkey.pem - certificates: - - certFile: /etc/ssl/traefik/cert.pem - keyFile: /etc/ssl/traefik/privkey.pem diff --git a/traefik/traefik.yml b/traefik/traefik.yml deleted file mode 100644 index 0e6e557..0000000 --- a/traefik/traefik.yml +++ /dev/null @@ -1,20 +0,0 @@ -logLevel: INFO - -api: - insecure: true - dashboard: true - -entryPoints: - http: - address: ":80" - https: - address: ":443" - -providers: - file: - filename: /etc/traefik/tls.yml - docker: - endpoint: unix:///var/run/docker.sock - watch: true - exposedByDefault: true - defaultRule: 'HostRegexp(`{{ index .Labels "com.docker.compose.service"}}.traefik.me`,`{{ index .Labels "com.docker.compose.service"}}-{dashed-ip:.*}.traefik.me`)'