Added integration for Traefik and made some minor tweaks

This commit is contained in:
WilliamMiceli
2018-08-28 14:18:56 -04:00
parent 5bc983b9de
commit e3ab40e0c9
2 changed files with 41 additions and 31 deletions

View File

@@ -1,22 +1,22 @@
version: '2' version: '2'
services: services:
app: app:
image: invoiceninja/invoiceninja image: invoiceninja/invoiceninja:latest
dns: dns:
- 1.1.1.1 - 1.1.1.1
- 1.0.0.1 - 1.0.0.1
environment: environment:
APP_ENV: production APP_ENV: production
APP_DEBUG: false APP_DEBUG: false
APP_URL: ${URL}:${HOST_HTTP_PORT} APP_URL: https://${TRAEFIK_HOST}
APP_CIPHER: AES-256-CBC APP_CIPHER: AES-256-CBC
APP_KEY: ${APP_KEY} APP_KEY: ${APP_KEY}
DB_STRICT: false DB_STRICT: false
DB_HOST: ninja-mysql DB_HOST: mysql
DB_DATABASE: ninja_db DB_DATABASE: ninja_db
DB_USERNAME: ninja DB_USERNAME: ninja
DB_PASSWORD: ${DB_USER_PASS} DB_PASSWORD: ${DB_USER_PASS}
{{- if (.Values.GMAPS_KEY)}} {{- if (.Values.MOBILE_APP_SECRET)}}
API_SECRET: ${MOBILE_APP_SECRET} API_SECRET: ${MOBILE_APP_SECRET}
{{- end}} {{- end}}
{{- if (.Values.GMAPS_KEY)}} {{- if (.Values.GMAPS_KEY)}}
@@ -29,7 +29,7 @@ services:
{{- end}} {{- end}}
io.rancher.sidekicks: cron, web io.rancher.sidekicks: cron, web
links: links:
- db:ninja-mysql - mysql
restart: on-failure restart: on-failure
volumes: volumes:
- Logo:/var/www/app/public/logo - Logo:/var/www/app/public/logo
@@ -52,31 +52,31 @@ services:
environment: environment:
APP_ENV: production APP_ENV: production
APP_DEBUG: false APP_DEBUG: false
APP_URL: ${URL}:${HOST_HTTP_PORT} APP_URL: https://${TRAEFIK_HOST}
APP_CIPHER: AES-256-CBC APP_CIPHER: AES-256-CBC
APP_KEY: ${APP_KEY} APP_KEY: ${APP_KEY}
DB_STRICT: false DB_STRICT: false
DB_HOST: ninja-mysql DB_HOST: mysql
DB_DATABASE: ninja_db DB_DATABASE: ninja_db
DB_USERNAME: ninja DB_USERNAME: ninja
DB_PASSWORD: ${DB_USER_PASS} DB_PASSWORD: ${DB_USER_PASS}
{{- if (.Values.GMAPS_KEY)}} {{- if .Values.MOBILE_APP_SECRET}}
API_SECRET: ${MOBILE_APP_SECRET} API_SECRET: ${MOBILE_APP_SECRET}
{{- end}} {{- end}}
{{- if (.Values.GMAPS_KEY)}} {{- if .Values.GMAPS_KEY}}
GOOGLE_MAPS_API_KEY: ${GMAPS_KEY} GOOGLE_MAPS_API_KEY: ${GMAPS_KEY}
{{- end}} {{- end}}
labels: labels:
io.rancher.container.pull_image: always io.rancher.container.pull_image: always
{{- 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}}
links: links:
- db:ninja-mysql - mysql
restart: on-failure restart: on-failure
volumes_from: volumes_from:
- app - app
db: mysql:
image: mysql:5 image: mysql:5
dns: dns:
- 1.1.1.1 - 1.1.1.1
@@ -88,7 +88,7 @@ services:
MYSQL_PASSWORD: ${DB_USER_PASS} MYSQL_PASSWORD: ${DB_USER_PASS}
labels: labels:
io.rancher.container.pull_image: always io.rancher.container.pull_image: always
{{- 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}}
restart: on-failure restart: on-failure
@@ -101,19 +101,33 @@ services:
- 1.0.0.1 - 1.0.0.1
labels: labels:
io.rancher.container.pull_image: always io.rancher.container.pull_image: always
{{- 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.port: "80"
traefik.frontend.entryPoints: https
{{- else}}
traefik.enable: false
{{- end}}
links: links:
- app - app
networks:
- public-proxy
ports: ports:
- "${HOST_HTTP_PORT}:80" - "${WEB_PORT}:80"
restart: on-failure restart: on-failure
volumes: volumes:
- /RancherConfig/${DATA_DIR}/nginx.conf:/etc/nginx/nginx.conf:ro - /RancherConfig/${DATA_DIR}/nginx.conf:/etc/nginx/nginx.conf:ro
volumes_from: volumes_from:
- app - app
networks:
public-proxy:
external: true
volumes: volumes:
Database: Database:
driver: rancher-nfs driver: rancher-nfs

View File

@@ -16,18 +16,19 @@ 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: "HOST_HTTP_PORT" - variable: "WEB_PORT"
label: "Host HTTP Port" label: "Web Port"
description: | description: |
The HTTP port to access the web interface on. The port to access the web interface on.
default: "10200" default: "10200"
required: true required: true
type: string type: string
@@ -36,6 +37,7 @@ catalog:
label: "MySQL Root Password" label: "MySQL Root Password"
description: | description: |
A secure password to be used by the "root" MySQL user. A secure password to be used by the "root" MySQL user.
#default:
required: true required: true
type: password type: password
@@ -43,6 +45,7 @@ catalog:
label: "MySQL User Password" label: "MySQL User Password"
description: | description: |
A secure password to be used by the "ninja" MySQL user. A secure password to be used by the "ninja" MySQL user.
#default:
required: true required: true
type: password type: password
@@ -70,17 +73,10 @@ catalog:
- variable: DATA_DIR - variable: DATA_DIR
label: "Data Directory" label: "Data Directory"
description: | description: |
The directory within the stack directory to store data The directory to store persistent data for the stack.
default: "Personal/InvoiceNinja" default: "Personal/InvoiceNinja"
required: true required: true
type: string type: string
# - variable: "SSL_CERT"
# label: "SSL Certificate"
# description: |
# Please select which certificate you'd like to use from the environment (if any).
# required: false
# type: certificate
#services: #services:
# app: # app: