From 84ffae0ff15b9332830fe15e4fde5d678eca4db0 Mon Sep 17 00:00:00 2001 From: WilliamMiceli Date: Sat, 17 Nov 2018 18:51:02 -0500 Subject: [PATCH] Added Traefik integration --- templates/Snipe-IT/0/docker-compose.yml | 22 ++++++++++++++++++++-- templates/Snipe-IT/0/rancher-compose.yml | 13 +++++++------ 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/templates/Snipe-IT/0/docker-compose.yml b/templates/Snipe-IT/0/docker-compose.yml index f39a920..9811cb8 100644 --- a/templates/Snipe-IT/0/docker-compose.yml +++ b/templates/Snipe-IT/0/docker-compose.yml @@ -11,7 +11,7 @@ services: environment: APP_ENV: production APP_DEBUG: false - APP_URL: ${URL}:${WEB_PORT} + APP_URL: ${TRAEFIK_HOST}:${WEB_PORT} APP_KEY: ${APP_KEY} MYSQL_HOST: mysql MYSQL_DATABASE: snipeit @@ -22,8 +22,22 @@ services: {{- if .Values.HOST_LABEL}} io.rancher.scheduler.affinity:host_label: ${HOST_LABEL} {{- end}} + {{- if .Values.TRAEFIK_HOST}} + traefik.enable: true + traefik.frontend.rule: Host:${TRAEFIK_HOST} + traefik.frontend.entryPoints: http,https + traefik.frontend.headers.forceSTSHeader: true + traefik.frontend.headers.SSLRedirect: true + traefik.frontend.headers.STSPreload: true + traefik.frontend.headers.STSSeconds: 15552000 + traefik.port: "80" + {{- else}} + traefik.enable: false + {{- end}} links: - mysql + networks: + - public-proxy ports: - "${WEB_PORT}:80" restart: on-failure @@ -46,4 +60,8 @@ services: {{- end}} restart: on-failure volumes: - - /RancherCattleData/${DATA_DIR}/Database:/var/lib/mysql \ No newline at end of file + - /RancherCattleData/${DATA_DIR}/Database:/var/lib/mysql + +networks: + public-proxy: + external: true \ No newline at end of file diff --git a/templates/Snipe-IT/0/rancher-compose.yml b/templates/Snipe-IT/0/rancher-compose.yml index e4d0e0c..5e4be4f 100644 --- a/templates/Snipe-IT/0/rancher-compose.yml +++ b/templates/Snipe-IT/0/rancher-compose.yml @@ -1,6 +1,6 @@ version: '2' catalog: - name: SnipeIT + name: Snipe-IT version: latest # description: # minimum_rancher_version: @@ -16,12 +16,13 @@ catalog: required: false type: string - - variable: "URL" - label: "URL" + - variable: "TRAEFIK_HOST" + label: "Public Host Domain" description: | - The domain or hostname the service can be accessed at. - default: "http://localhost" - required: true + The host that Traefik will use to provide public access. + Leaving this empty will disable Traefik on this stack. + default: "subdomain.domain.tld" + required: false type: string - variable: "WEB_PORT"