From e3ab40e0c91c3b92cb70c77388e70fe508de750d Mon Sep 17 00:00:00 2001 From: WilliamMiceli <9000802+WilliamMiceli@users.noreply.github.com> Date: Tue, 28 Aug 2018 14:18:56 -0400 Subject: [PATCH] Added integration for Traefik and made some minor tweaks --- templates/InvoiceNinja/0/docker-compose.yml | 44 +++++++++++++------- templates/InvoiceNinja/0/rancher-compose.yml | 28 ++++++------- 2 files changed, 41 insertions(+), 31 deletions(-) diff --git a/templates/InvoiceNinja/0/docker-compose.yml b/templates/InvoiceNinja/0/docker-compose.yml index 8ce2296..0184aae 100644 --- a/templates/InvoiceNinja/0/docker-compose.yml +++ b/templates/InvoiceNinja/0/docker-compose.yml @@ -1,22 +1,22 @@ version: '2' services: app: - image: invoiceninja/invoiceninja + image: invoiceninja/invoiceninja:latest dns: - 1.1.1.1 - 1.0.0.1 environment: APP_ENV: production APP_DEBUG: false - APP_URL: ${URL}:${HOST_HTTP_PORT} + APP_URL: https://${TRAEFIK_HOST} APP_CIPHER: AES-256-CBC APP_KEY: ${APP_KEY} DB_STRICT: false - DB_HOST: ninja-mysql + DB_HOST: mysql DB_DATABASE: ninja_db DB_USERNAME: ninja DB_PASSWORD: ${DB_USER_PASS} - {{- if (.Values.GMAPS_KEY)}} + {{- if (.Values.MOBILE_APP_SECRET)}} API_SECRET: ${MOBILE_APP_SECRET} {{- end}} {{- if (.Values.GMAPS_KEY)}} @@ -29,7 +29,7 @@ services: {{- end}} io.rancher.sidekicks: cron, web links: - - db:ninja-mysql + - mysql restart: on-failure volumes: - Logo:/var/www/app/public/logo @@ -52,31 +52,31 @@ services: environment: APP_ENV: production APP_DEBUG: false - APP_URL: ${URL}:${HOST_HTTP_PORT} + APP_URL: https://${TRAEFIK_HOST} APP_CIPHER: AES-256-CBC APP_KEY: ${APP_KEY} DB_STRICT: false - DB_HOST: ninja-mysql + DB_HOST: mysql DB_DATABASE: ninja_db DB_USERNAME: ninja DB_PASSWORD: ${DB_USER_PASS} - {{- if (.Values.GMAPS_KEY)}} + {{- if .Values.MOBILE_APP_SECRET}} API_SECRET: ${MOBILE_APP_SECRET} {{- end}} - {{- if (.Values.GMAPS_KEY)}} + {{- if .Values.GMAPS_KEY}} GOOGLE_MAPS_API_KEY: ${GMAPS_KEY} {{- end}} labels: io.rancher.container.pull_image: always - {{- if (.Values.HOST_LABEL)}} + {{- if .Values.HOST_LABEL}} io.rancher.scheduler.affinity:host_label: ${HOST_LABEL} {{- end}} links: - - db:ninja-mysql + - mysql restart: on-failure volumes_from: - app - db: + mysql: image: mysql:5 dns: - 1.1.1.1 @@ -88,7 +88,7 @@ services: MYSQL_PASSWORD: ${DB_USER_PASS} labels: io.rancher.container.pull_image: always - {{- if (.Values.HOST_LABEL)}} + {{- if .Values.HOST_LABEL}} io.rancher.scheduler.affinity:host_label: ${HOST_LABEL} {{- end}} restart: on-failure @@ -101,19 +101,33 @@ services: - 1.0.0.1 labels: io.rancher.container.pull_image: always - {{- if (.Values.HOST_LABEL)}} + {{- 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.port: "80" + traefik.frontend.entryPoints: https + {{- else}} + traefik.enable: false + {{- end}} links: - app + networks: + - public-proxy ports: - - "${HOST_HTTP_PORT}:80" + - "${WEB_PORT}:80" restart: on-failure volumes: - /RancherConfig/${DATA_DIR}/nginx.conf:/etc/nginx/nginx.conf:ro volumes_from: - app +networks: + public-proxy: + external: true + volumes: Database: driver: rancher-nfs diff --git a/templates/InvoiceNinja/0/rancher-compose.yml b/templates/InvoiceNinja/0/rancher-compose.yml index b9c0c46..21153d2 100644 --- a/templates/InvoiceNinja/0/rancher-compose.yml +++ b/templates/InvoiceNinja/0/rancher-compose.yml @@ -16,18 +16,19 @@ 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: "HOST_HTTP_PORT" - label: "Host HTTP Port" + - variable: "WEB_PORT" + label: "Web Port" description: | - The HTTP port to access the web interface on. + The port to access the web interface on. default: "10200" required: true type: string @@ -36,6 +37,7 @@ catalog: label: "MySQL Root Password" description: | A secure password to be used by the "root" MySQL user. + #default: required: true type: password @@ -43,6 +45,7 @@ catalog: label: "MySQL User Password" description: | A secure password to be used by the "ninja" MySQL user. + #default: required: true type: password @@ -70,17 +73,10 @@ catalog: - variable: DATA_DIR label: "Data Directory" description: | - The directory within the stack directory to store data + The directory to store persistent data for the stack. default: "Personal/InvoiceNinja" required: true 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: # app: \ No newline at end of file