Nginx being parent container required for Traefik

This commit is contained in:
WilliamMiceli
2018-10-15 16:30:42 -04:00
parent 5415f00016
commit c629ed6e91
9 changed files with 12 additions and 238 deletions

View File

@@ -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=<your 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

View File

@@ -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;
}
}
}

View File

@@ -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 <<EOF
trap "break;exit" SIGHUP SIGINT SIGTERM
sleep 300s
while /bin/true; do
./artisan ninja:send-invoices
./artisan ninja:send-reminders
sleep 1d
done
EOF'
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_from:
- app
mysql:
image: mysql:5
dns:
- 1.1.1.1
- 1.0.0.1
environment:
MYSQL_DATABASE: ninja_db
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASS}
MYSQL_USER: ninja
MYSQL_PASSWORD: ${DB_USER_PASS}
labels:
io.rancher.container.pull_image: always
{{- 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
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}}
{{- 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}}
io.rancher.sidekicks: app,cron
links:
- app
networks:
- public-proxy
ports:
- "${WEB_PORT}:80"
restart: on-failure
volumes:
- /RancherCattleConfig/${DATA_DIR}/nginx.conf:/etc/nginx/nginx.conf:ro
volumes_from:
- app
networks:
public-proxy:
external: true

View File

@@ -1,45 +0,0 @@
version: '2'
catalog:
name: InvoiceNinja
version: latest
# description:
# minimum_rancher_version:
# maximum_rancher_version:
# upgrade_from:
questions:
- variable: "HOST_LABEL"
label: "Host Label Key/Value Pair"
description: |
The Label Key/Value pair on the host which InvoiceNinja should be deployed
default: "host.id=Host1"
required: false
type: string
- variable: "TRAEFIK_HOST"
label: "Public Host Domain"
description: |
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"
label: "Local Web Port"
description: |
The port to access the web interface on local networks.
default: "10200"
required: true
type: string
- variable: DATA_DIR
label: "Data Directory"
description: |
The directory to store persistent data for the stack.
default: "Personal/InvoiceNinja"
required: true
type: string
#services:
# app:

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -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/

View File

@@ -20,4 +20,6 @@ You may need to "chmod -R 777 storage" in the "App" container.
Google Maps: Google Maps:
Get an API Key [Here](https://developers.google.com/maps/documentation/javascript/get-api-key) first. Get an API Key [Here](https://developers.google.com/maps/documentation/javascript/get-api-key) first.
Then add GOOGLE_MAPS_API_KEY=<your key> in your .env file. Then add GOOGLE_MAPS_API_KEY=<your 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

View File

@@ -15,7 +15,7 @@ http {
server { server {
listen 80 default; listen 80 default;
server_name your_ininja_site; server_name _;
root /var/www/app/public; root /var/www/app/public;
@@ -41,10 +41,11 @@ http {
fastcgi_intercept_errors off; fastcgi_intercept_errors off;
fastcgi_buffer_size 16k; fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k; fastcgi_buffers 4 16k;
fastcgi_param HTTPS 1;
} }
location ~ /\.ht { location ~ /\.ht {
deny all; deny all;
} }
} }
} }

View File

@@ -10,7 +10,6 @@ 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}}
io.rancher.sidekicks: cron, web
links: links:
- mysql - mysql
restart: on-failure restart: on-failure
@@ -58,12 +57,12 @@ 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}}
traefik.enable: false
restart: on-failure restart: on-failure
volumes: volumes:
- /RancherCattleData/${DATA_DIR}/Database:/var/lib/mysql - /RancherCattleData/${DATA_DIR}/Database:/var/lib/mysql
web: web:
image: nginx image: nginx
command: [nginx-debug, '-g', 'daemon off;']
dns: dns:
- 1.1.1.1 - 1.1.1.1
- 1.0.0.1 - 1.0.0.1
@@ -75,13 +74,16 @@ services:
{{- if .Values.TRAEFIK_HOST}} {{- if .Values.TRAEFIK_HOST}}
traefik.enable: true traefik.enable: true
traefik.frontend.rule: Host:${TRAEFIK_HOST} traefik.frontend.rule: Host:${TRAEFIK_HOST}
traefik.port: "80"
traefik.frontend.entryPoints: http,https traefik.frontend.entryPoints: http,https
traefik.frontend.headers.forceSTSHeader: true
traefik.frontend.headers.SSLRedirect: true traefik.frontend.headers.SSLRedirect: true
traefik.frontend.passHostHeader: true traefik.frontend.headers.STSPreload: true
traefik.frontend.headers.STSSeconds: 15552000
traefik.port: "80"
{{- else}} {{- else}}
traefik.enable: false traefik.enable: false
{{- end}} {{- end}}
io.rancher.sidekicks: app,cron
links: links:
- app - app
networks: networks: