From c629ed6e91ef12f0adbe5b3420e1f131146965b3 Mon Sep 17 00:00:00 2001 From: WilliamMiceli <9000802+WilliamMiceli@users.noreply.github.com> Date: Mon, 15 Oct 2018 16:30:42 -0400 Subject: [PATCH] Nginx being parent container required for Traefik --- templates/InvoiceNinja-TraefikFix/0/README.md | 25 ----- .../0/Resources/nginx.conf | 51 --------- .../0/docker-compose.yml | 101 ------------------ .../0/rancher-compose.yml | 45 -------- .../catalogIcon-invoiceninja.svg | 1 - templates/InvoiceNinja-TraefikFix/config.yml | 8 -- templates/InvoiceNinja/0/README.md | 4 +- templates/InvoiceNinja/0/Resources/nginx.conf | 5 +- templates/InvoiceNinja/0/docker-compose.yml | 10 +- 9 files changed, 12 insertions(+), 238 deletions(-) delete mode 100644 templates/InvoiceNinja-TraefikFix/0/README.md delete mode 100644 templates/InvoiceNinja-TraefikFix/0/Resources/nginx.conf delete mode 100644 templates/InvoiceNinja-TraefikFix/0/docker-compose.yml delete mode 100644 templates/InvoiceNinja-TraefikFix/0/rancher-compose.yml delete mode 100644 templates/InvoiceNinja-TraefikFix/catalogIcon-invoiceninja.svg delete mode 100644 templates/InvoiceNinja-TraefikFix/config.yml diff --git a/templates/InvoiceNinja-TraefikFix/0/README.md b/templates/InvoiceNinja-TraefikFix/0/README.md deleted file mode 100644 index c7073b9..0000000 --- a/templates/InvoiceNinja-TraefikFix/0/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# Invoice Ninja - -[Hosted Official Website](https://www.invoiceninja.com/) - -[Self-Hosted Official Website](https://www.invoiceninja.org/) - -[Docker Page](https://hub.docker.com/r/invoiceninja/invoiceninja/) - -## From Website - -Free Open-Source Invoicing -Expenses & time-tracking built with Laravel - -### Pre-Installation: - -Make sure that you have a "nginx.conf" file for the nginx container. -Copying the default one located [on their GitHub](https://github.com/invoiceninja/dockerfiles/blob/master/docker-compose/nginx.conf) should be sufficient. - -You may need to "chmod -R 777 storage" in the "App" container. - -Google Maps: -Get an API Key [Here](https://developers.google.com/maps/documentation/javascript/get-api-key) first. -Then add GOOGLE_MAPS_API_KEY= in your .env file. - -If using without HTTPS (like using the direct IP instead of through Traefik), please take out the line: "fastcgi_param HTTPS 1;" from your nginx.conf \ No newline at end of file diff --git a/templates/InvoiceNinja-TraefikFix/0/Resources/nginx.conf b/templates/InvoiceNinja-TraefikFix/0/Resources/nginx.conf deleted file mode 100644 index 1e1bfea..0000000 --- a/templates/InvoiceNinja-TraefikFix/0/Resources/nginx.conf +++ /dev/null @@ -1,51 +0,0 @@ -user www-data; - -events { - worker_connections 768; -} - -http { - upstream backend { - server app:9000; - } - include /etc/nginx/mime.types; - default_type application/octet-stream; - gzip on; - gzip_disable "msie6"; - - server { - listen 80 default; - server_name _; - - root /var/www/app/public; - - index index.php; - - charset utf-8; - - location / { - try_files $uri $uri/ /index.php?$query_string; - } - - location = /favicon.ico { access_log off; log_not_found off; } - location = /robots.txt { access_log off; log_not_found off; } - - sendfile off; - - location ~ \.php$ { - fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass backend; - fastcgi_index index.php; - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_intercept_errors off; - fastcgi_buffer_size 16k; - fastcgi_buffers 4 16k; - fastcgi_param HTTPS 1; - } - - location ~ /\.ht { - deny all; - } - } -} \ No newline at end of file diff --git a/templates/InvoiceNinja-TraefikFix/0/docker-compose.yml b/templates/InvoiceNinja-TraefikFix/0/docker-compose.yml deleted file mode 100644 index 3777955..0000000 --- a/templates/InvoiceNinja-TraefikFix/0/docker-compose.yml +++ /dev/null @@ -1,101 +0,0 @@ -version: '2' -services: - app: - image: invoiceninja/invoiceninja:latest - dns: - - 1.1.1.1 - - 1.0.0.1 - labels: - io.rancher.container.pull_image: always - {{- if (.Values.HOST_LABEL)}} - io.rancher.scheduler.affinity:host_label: ${HOST_LABEL} - {{- end}} - links: - - mysql - restart: on-failure - volumes: - - /RancherCattleConfig/${DATA_DIR}/.env:/var/www/app/.env - - /RancherCattleData/${DATA_DIR}/Logo:/var/www/app/public/logo - - /RancherCattleData/${DATA_DIR}/Storage:/var/www/app/storage - cron: - image: invoiceninja/invoiceninja:latest - dns: - - 1.1.1.1 - - 1.0.0.1 - entrypoint: | - bash -c 'bash -s <catalogIcon-invoiceninjaW \ No newline at end of file diff --git a/templates/InvoiceNinja-TraefikFix/config.yml b/templates/InvoiceNinja-TraefikFix/config.yml deleted file mode 100644 index f5e36dc..0000000 --- a/templates/InvoiceNinja-TraefikFix/config.yml +++ /dev/null @@ -1,8 +0,0 @@ -name: Invoice Ninja (Traefik Fix) -description: | - Status: Functional -version: latest -category: Invoicing -maintainer: WilliamMiceli -# license: -projectURL: https://hub.docker.com/r/invoiceninja/invoiceninja/ \ No newline at end of file diff --git a/templates/InvoiceNinja/0/README.md b/templates/InvoiceNinja/0/README.md index eed9185..c7073b9 100644 --- a/templates/InvoiceNinja/0/README.md +++ b/templates/InvoiceNinja/0/README.md @@ -20,4 +20,6 @@ You may need to "chmod -R 777 storage" in the "App" container. Google Maps: Get an API Key [Here](https://developers.google.com/maps/documentation/javascript/get-api-key) first. -Then add GOOGLE_MAPS_API_KEY= in your .env file. \ No newline at end of file +Then add GOOGLE_MAPS_API_KEY= in your .env file. + +If using without HTTPS (like using the direct IP instead of through Traefik), please take out the line: "fastcgi_param HTTPS 1;" from your nginx.conf \ No newline at end of file diff --git a/templates/InvoiceNinja/0/Resources/nginx.conf b/templates/InvoiceNinja/0/Resources/nginx.conf index 5cb3ba6..1e1bfea 100644 --- a/templates/InvoiceNinja/0/Resources/nginx.conf +++ b/templates/InvoiceNinja/0/Resources/nginx.conf @@ -15,7 +15,7 @@ http { server { listen 80 default; - server_name your_ininja_site; + server_name _; root /var/www/app/public; @@ -41,10 +41,11 @@ http { fastcgi_intercept_errors off; fastcgi_buffer_size 16k; fastcgi_buffers 4 16k; + fastcgi_param HTTPS 1; } location ~ /\.ht { deny all; } } -} +} \ No newline at end of file diff --git a/templates/InvoiceNinja/0/docker-compose.yml b/templates/InvoiceNinja/0/docker-compose.yml index a1fea51..3777955 100644 --- a/templates/InvoiceNinja/0/docker-compose.yml +++ b/templates/InvoiceNinja/0/docker-compose.yml @@ -10,7 +10,6 @@ services: {{- if (.Values.HOST_LABEL)}} io.rancher.scheduler.affinity:host_label: ${HOST_LABEL} {{- end}} - io.rancher.sidekicks: cron, web links: - mysql restart: on-failure @@ -58,12 +57,12 @@ services: {{- if .Values.HOST_LABEL}} io.rancher.scheduler.affinity:host_label: ${HOST_LABEL} {{- end}} + traefik.enable: false restart: on-failure volumes: - /RancherCattleData/${DATA_DIR}/Database:/var/lib/mysql web: image: nginx - command: [nginx-debug, '-g', 'daemon off;'] dns: - 1.1.1.1 - 1.0.0.1 @@ -75,13 +74,16 @@ services: {{- if .Values.TRAEFIK_HOST}} traefik.enable: true traefik.frontend.rule: Host:${TRAEFIK_HOST} - traefik.port: "80" traefik.frontend.entryPoints: http,https + traefik.frontend.headers.forceSTSHeader: true traefik.frontend.headers.SSLRedirect: true - traefik.frontend.passHostHeader: true + traefik.frontend.headers.STSPreload: true + traefik.frontend.headers.STSSeconds: 15552000 + traefik.port: "80" {{- else}} traefik.enable: false {{- end}} + io.rancher.sidekicks: app,cron links: - app networks: