Added Traefik integration

This commit is contained in:
WilliamMiceli
2018-11-17 18:51:02 -05:00
parent f54e0a2bd7
commit 84ffae0ff1
2 changed files with 27 additions and 8 deletions

View File

@@ -11,7 +11,7 @@ services:
environment: environment:
APP_ENV: production APP_ENV: production
APP_DEBUG: false APP_DEBUG: false
APP_URL: ${URL}:${WEB_PORT} APP_URL: ${TRAEFIK_HOST}:${WEB_PORT}
APP_KEY: ${APP_KEY} APP_KEY: ${APP_KEY}
MYSQL_HOST: mysql MYSQL_HOST: mysql
MYSQL_DATABASE: snipeit MYSQL_DATABASE: snipeit
@@ -22,8 +22,22 @@ services:
{{- if .Values.HOST_LABEL}} {{- if .Values.HOST_LABEL}}
io.rancher.scheduler.affinity:host_label: ${HOST_LABEL} io.rancher.scheduler.affinity:host_label: ${HOST_LABEL}
{{- end}} {{- 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: links:
- mysql - mysql
networks:
- public-proxy
ports: ports:
- "${WEB_PORT}:80" - "${WEB_PORT}:80"
restart: on-failure restart: on-failure
@@ -46,4 +60,8 @@ services:
{{- end}} {{- end}}
restart: on-failure restart: on-failure
volumes: volumes:
- /RancherCattleData/${DATA_DIR}/Database:/var/lib/mysql - /RancherCattleData/${DATA_DIR}/Database:/var/lib/mysql
networks:
public-proxy:
external: true

View File

@@ -1,6 +1,6 @@
version: '2' version: '2'
catalog: catalog:
name: SnipeIT name: Snipe-IT
version: latest version: latest
# description: # description:
# minimum_rancher_version: # minimum_rancher_version:
@@ -16,12 +16,13 @@ catalog:
required: false required: false
type: string type: string
- variable: "URL" - variable: "TRAEFIK_HOST"
label: "URL" label: "Public Host Domain"
description: | description: |
The domain or hostname the service can be accessed at. The host that Traefik will use to provide public access.
default: "http://localhost" Leaving this empty will disable Traefik on this stack.
required: true default: "subdomain.domain.tld"
required: false
type: string type: string
- variable: "WEB_PORT" - variable: "WEB_PORT"