mirror of
https://github.com/invoiceninja/dockerfiles.git
synced 2025-12-31 19:47:25 +01:00
Automatically set values for Nginx sub-chart based on install name (#370)
* Automatically set serverblock from IN chart * Automatically set nginx PVC * Bump chart version * Upgrade dependencies * Updated k8s test versions
This commit is contained in:
2
.github/ct-install.yaml
vendored
2
.github/ct-install.yaml
vendored
@@ -3,4 +3,4 @@ chart-dirs:
|
|||||||
chart-repos:
|
chart-repos:
|
||||||
- bitnami=https://charts.bitnami.com/bitnami
|
- bitnami=https://charts.bitnami.com/bitnami
|
||||||
check-version-increment: true
|
check-version-increment: true
|
||||||
debug: true
|
debug: false
|
||||||
|
|||||||
34
.github/workflows/charts.yaml
vendored
34
.github/workflows/charts.yaml
vendored
@@ -13,9 +13,8 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
- name: Fetch history
|
fetch-depth: 0
|
||||||
run: git fetch --prune --unshallow
|
|
||||||
|
|
||||||
- name: Set up Helm
|
- name: Set up Helm
|
||||||
uses: azure/setup-helm@v1
|
uses: azure/setup-helm@v1
|
||||||
@@ -41,6 +40,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Run chart-testing (lint)
|
- name: Run chart-testing (lint)
|
||||||
run: ct lint --config .github/ct-lint.yaml
|
run: ct lint --config .github/ct-lint.yaml
|
||||||
|
|
||||||
kubeval-chart:
|
kubeval-chart:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
needs:
|
||||||
@@ -49,9 +49,9 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
chart: ${{ fromJson(needs.lint-chart.outputs.matrix) }}
|
chart: ${{ fromJson(needs.lint-chart.outputs.matrix) }}
|
||||||
k8s:
|
k8s:
|
||||||
- v1.17.11
|
- v1.19.11
|
||||||
- v1.18.8
|
- v1.20.7
|
||||||
- v1.19.4
|
- v1.21.2
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v1
|
||||||
@@ -79,20 +79,26 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
k8s:
|
k8s:
|
||||||
- v1.17.11
|
- v1.19.11
|
||||||
- v1.18.8
|
- v1.20.7
|
||||||
- v1.19.4
|
- v1.21.2
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Create kind ${{ matrix.k8s }} cluster
|
- name: Create kind ${{ matrix.k8s }} cluster
|
||||||
uses: helm/kind-action@v1.1.0
|
uses: helm/kind-action@v1.2.0
|
||||||
with:
|
with:
|
||||||
node_image: kindest/node:${{ matrix.k8s }}
|
node_image: kindest/node:${{ matrix.k8s }}
|
||||||
|
|
||||||
- name: Run chart-testing (install)
|
- uses: actions/setup-python@v2
|
||||||
uses: helm/chart-testing-action@v2.0.1
|
|
||||||
with:
|
with:
|
||||||
command: install
|
python-version: 3.7
|
||||||
config: .github/ct-install.yaml
|
|
||||||
|
- name: Set up chart-testing
|
||||||
|
uses: helm/chart-testing-action@v2.0.1
|
||||||
|
|
||||||
|
- name: Run chart-testing (install)
|
||||||
|
run: ct install --config .github/ct-install.yaml
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
- name: common
|
- name: common
|
||||||
repository: https://charts.bitnami.com/bitnami
|
repository: https://charts.bitnami.com/bitnami
|
||||||
version: 1.4.3
|
version: 1.7.0
|
||||||
- name: nginx
|
- name: nginx
|
||||||
repository: https://charts.bitnami.com/bitnami
|
repository: https://charts.bitnami.com/bitnami
|
||||||
version: 8.8.5
|
version: 9.3.5
|
||||||
- name: mariadb
|
- name: mariadb
|
||||||
repository: https://charts.bitnami.com/bitnami
|
repository: https://charts.bitnami.com/bitnami
|
||||||
version: 9.3.11
|
version: 9.3.16
|
||||||
- name: redis
|
- name: redis
|
||||||
repository: https://charts.bitnami.com/bitnami
|
repository: https://charts.bitnami.com/bitnami
|
||||||
version: 12.9.2
|
version: 12.10.1
|
||||||
digest: sha256:4255a558312b033e820635f491b0960bd4ec8e716164025212af06adafbd4cb9
|
digest: sha256:d5605fef85b764ec25c0a486df1228f0d7946a3e029d361514d3582b779cbce6
|
||||||
generated: "2021-05-11T09:31:45.433+08:00"
|
generated: "2021-07-07T02:14:37.758095+08:00"
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ type: application
|
|||||||
# This is the chart version. This version number should be incremented each time you make changes
|
# This is the chart version. This version number should be incremented each time you make changes
|
||||||
# to the chart and its templates, including the app version.
|
# to the chart and its templates, including the app version.
|
||||||
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||||
version: 0.5.1
|
version: 0.6.0
|
||||||
# This is the version number of the application being deployed. This version number should be
|
# This is the version number of the application being deployed. This version number should be
|
||||||
# incremented each time you make changes to the application. Versions are not expected to
|
# incremented each time you make changes to the application. Versions are not expected to
|
||||||
# follow Semantic Versioning. They should reflect the version the application is using.
|
# follow Semantic Versioning. They should reflect the version the application is using.
|
||||||
appVersion: 5.1.64
|
appVersion: 5.2.10
|
||||||
keywords:
|
keywords:
|
||||||
- invoiceninja
|
- invoiceninja
|
||||||
home: https://invoiceninja.github.io/dockerfiles
|
home: https://invoiceninja.github.io/dockerfiles
|
||||||
@@ -32,7 +32,7 @@ dependencies:
|
|||||||
version: 1.x.x
|
version: 1.x.x
|
||||||
- name: nginx
|
- name: nginx
|
||||||
repository: https://charts.bitnami.com/bitnami
|
repository: https://charts.bitnami.com/bitnami
|
||||||
version: 8.8.x
|
version: 9.x.x
|
||||||
- condition: mariadb.enabled
|
- condition: mariadb.enabled
|
||||||
name: mariadb
|
name: mariadb
|
||||||
repository: https://charts.bitnami.com/bitnami
|
repository: https://charts.bitnami.com/bitnami
|
||||||
@@ -40,7 +40,7 @@ dependencies:
|
|||||||
- condition: redis.enabled
|
- condition: redis.enabled
|
||||||
name: redis
|
name: redis
|
||||||
repository: https://charts.bitnami.com/bitnami
|
repository: https://charts.bitnami.com/bitnami
|
||||||
version: 12.9.x
|
version: 12.x.x
|
||||||
maintainers:
|
maintainers:
|
||||||
- email: lwj5@hotmail.com
|
- email: lwj5@hotmail.com
|
||||||
name: lwj5
|
name: lwj5
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ Please read [Upgrading](#upgrading) section before upgrading MAJOR versions.
|
|||||||
- The Bitnami [mariadb](https://github.com/bitnami/charts/tree/master/bitnami/mariadb) helm chart
|
- The Bitnami [mariadb](https://github.com/bitnami/charts/tree/master/bitnami/mariadb) helm chart
|
||||||
- The Bitnami [nginx](https://github.com/bitnami/charts/tree/master/bitnami/nginx) helm chart
|
- The Bitnami [nginx](https://github.com/bitnami/charts/tree/master/bitnami/nginx) helm chart
|
||||||
- The Bitnami [redis](https://github.com/bitnami/charts/tree/master/bitnami/redis) helm chart
|
- The Bitnami [redis](https://github.com/bitnami/charts/tree/master/bitnami/redis) helm chart
|
||||||
- Tested on Kubernetes 1.17+
|
- Tested on Kubernetes 1.19+
|
||||||
|
|
||||||
## Installing the Chart
|
## Installing the Chart
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ To install the chart with the release name `invoiceninja`:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
helm repo add invoiceninja https://invoiceninja.github.io/dockerfiles
|
helm repo add invoiceninja https://invoiceninja.github.io/dockerfiles
|
||||||
helm install invoiceninja invoiceninja/invoiceninja
|
helm install invoiceninja invoiceninja/invoiceninja --set appKey=changeit --set mariadb.auth.rootPassword=changeit --set mariadb.auth.password=changeit --set redis.password=changeit
|
||||||
```
|
```
|
||||||
|
|
||||||
The command deploys Invoice Ninja on the Kubernetes cluster in the default namespace. The [Parameters](#parameters) section lists the parameters that can be configured during installation.
|
The command deploys Invoice Ninja on the Kubernetes cluster in the default namespace. The [Parameters](#parameters) section lists the parameters that can be configured during installation.
|
||||||
@@ -70,30 +70,30 @@ The following table shows the configuration options for the Invoice Ninja helm c
|
|||||||
|
|
||||||
### Invoice Ninja parameters
|
### Invoice Ninja parameters
|
||||||
|
|
||||||
| Parameter | Description | Default |
|
| Parameter | Description | Default |
|
||||||
| -------------------- | ---------------------------------------------------------------- | ------------------------------------------------------- |
|
| -------------------- | ----------------------------------------------------------------------------- | ------------------------------------------------------- |
|
||||||
| `image.registry` | Invoice Ninja image registry | `docker.io` |
|
| `image.registry` | Invoice Ninja image registry | `docker.io` |
|
||||||
| `image.repository` | Invoice Ninja image name | `invoiceninja/invoiceninja` |
|
| `image.repository` | Invoice Ninja image name | `invoiceninja/invoiceninja` |
|
||||||
| `image.tag` | Invoice Ninja image tag | Check `values.yaml` file |
|
| `image.tag` | Invoice Ninja image tag | Check `values.yaml` file |
|
||||||
| `image.pullPolicy` | Invoice Ninja image pull policy | `IfNotPresent` |
|
| `image.pullPolicy` | Invoice Ninja image pull policy | `IfNotPresent` |
|
||||||
| `image.pullSecrets` | Specify docker-registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) |
|
| `image.pullSecrets` | Specify docker-registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) |
|
||||||
| `image.debug` | Specify if debug logs should be enabled | `false` |
|
| `image.debug` | Specify if debug logs should be enabled | `false` |
|
||||||
| `serviceAccountName` | Name of a service account for the Invoice Ninja pods | `default` |
|
| `serviceAccountName` | Name of a service account for the Invoice Ninja pods | `default` |
|
||||||
| `debug` | Turn on debug mode on Invoice Ninja | `false` |
|
| `debug` | Turn on debug mode on Invoice Ninja | `false` |
|
||||||
| `appKey` | Laravel Application Key | _random 32 character alphanumeric string_ |
|
| `appKey` | Laravel Application Key | _random 32 character alphanumeric string_ |
|
||||||
| `userEmail` | Initial user email address | `admin@example.com` |
|
| `userEmail` | Initial user email address | `admin@example.com` |
|
||||||
| `userPassword` | Initial user password | `changeme!` |
|
| `userPassword` | Initial user password | `changeme!` |
|
||||||
| `logChannel` | Name of log channel to use | `nil` |
|
| `logChannel` | Name of log channel to use | `nil` |
|
||||||
| `broadcastDriver` | Name of broadcast driver to use | `nil` |
|
| `broadcastDriver` | Name of broadcast driver to use | `nil` |
|
||||||
| `cacheDriver` | Name of cache driver to use | `nil` |
|
| `cacheDriver` | Name of cache driver to use | `nil` |
|
||||||
| `sessionDriver` | Name of session driver to use | `nil` |
|
| `sessionDriver` | Name of session driver to use | `nil` |
|
||||||
| `queueConnection` | Name of queue connection to use | `nil` |
|
| `queueConnection` | Name of queue connection to use | `nil` |
|
||||||
| `snappdf` | Use snappdf instead of Phantom JS PDF generation | `true` |
|
| `snappdf` | Use snappdf instead of Phantom JS PDF generation | `true` |
|
||||||
| `mailer` | Name of the mailer to use (log, smtp, etc.) | `log` |
|
| `mailer` | Name of the mailer to use (log, smtp, etc.) | `log` |
|
||||||
| `requireHttps` | Force HTTPS for internal connections to Invoice Ninja (see #349) | `false` |
|
| `requireHttps` | Force HTTPS for internal connections to Invoice Ninja (see #349) | `false` |
|
||||||
| `extraEnvVars` | Extra environment variables to be set on Invoice Ninja container | `{}` |
|
| `extraEnvVars` | Extra environment variables to be set on Invoice Ninja container | `{}` |
|
||||||
| `extraEnvVarsCM` | Name of existing ConfigMap containing extra env vars | `nil` |
|
| `extraEnvVarsCM` | Name of existing ConfigMap containing extra env vars | `nil` |
|
||||||
| `extraEnvVarsSecret` | Name of existing Secret containing extra env vars | `nil` |
|
| `extraEnvVarsSecret` | Name of existing Secret containing extra env vars | `nil` |
|
||||||
| `trustedProxy` | List of trusted proxies for Invoice Ninja to communicate with the nginx proxy | `'*'` |
|
| `trustedProxy` | List of trusted proxies for Invoice Ninja to communicate with the nginx proxy | `'*'` |
|
||||||
|
|
||||||
### Invoice Ninja deployment parameters
|
### Invoice Ninja deployment parameters
|
||||||
@@ -147,15 +147,13 @@ The following table shows the configuration options for the Invoice Ninja helm c
|
|||||||
|
|
||||||
### Ingress parameters
|
### Ingress parameters
|
||||||
|
|
||||||
| Parameter | Description | Default |
|
| Parameter | Description | Default |
|
||||||
| ------------------------------------------------------- | ------------------------------------- | ------------------------ |
|
| ------------------------------------ | ------------------------------------- | ------------------------------------------------------- |
|
||||||
| `nginx.service.type` | Kubernetes Service type | `ClusterIP` |
|
| `nginx.service.type` | Kubernetes Service type | `ClusterIP` |
|
||||||
| `nginx.ingress.enabled` | Enable ingress controller resource | `true` |
|
| `nginx.ingress.enabled` | Enable ingress controller resource | `true` |
|
||||||
| `nginx.ingress.hostname` | Default host for the ingress resource | `invoiceninja.local` |
|
| `nginx.ingress.hostname` | Default host for the ingress resource | `invoiceninja.local` |
|
||||||
| `nginx.serverBlock` | Custom NGINX server block | `nil` |
|
| `nginx.existingServerBlockConfigmap` | Custom NGINX server block config map | `{{ include "invoiceninja.nginx.serverBlockName" . }}` |
|
||||||
| `nginx.extraVolumes` | Array to add extra volumes | Check `values.yaml` file |
|
| `nginx.staticSitePVC` | Name of Invoice Ninja public PVC | `{{ include "invoiceninja.public.storageName" . }}` |
|
||||||
| `nginx.extraVolumes[0].persistentVolumeClaim.claimName` | Name of Invoice Ninja public PVC | `invoiceninja-public` |
|
|
||||||
| `nginx.extraVolumeMounts` | Array to add extra mount | Check `values.yaml` file |
|
|
||||||
|
|
||||||
> See [Dependencies](#dependencies) for more.
|
> See [Dependencies](#dependencies) for more.
|
||||||
|
|
||||||
|
|||||||
@@ -248,3 +248,11 @@ Return the Session Connection Name
|
|||||||
{{- printf "default" -}}
|
{{- printf "default" -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Server block configmap name for nignx.
|
||||||
|
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||||
|
*/}}
|
||||||
|
{{- define "invoiceninja.nginx.serverBlockName" -}}
|
||||||
|
{{- printf "%s-%s" .Release.Name "server-block" | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|||||||
39
charts/invoiceninja/templates/serverblock.yaml
Normal file
39
charts/invoiceninja/templates/serverblock.yaml
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: {{ include "invoiceninja.nginx.serverBlockName" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "common.labels.standard" $ | nindent 4 }}
|
||||||
|
{{- if .Values.commonLabels }}
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.commonAnnotations }}
|
||||||
|
annotations:
|
||||||
|
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
data:
|
||||||
|
server-block.conf: |-
|
||||||
|
server {
|
||||||
|
listen 8080 default_server;
|
||||||
|
server_name _;
|
||||||
|
|
||||||
|
root /app;
|
||||||
|
index index.php;
|
||||||
|
|
||||||
|
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; }
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||||
|
fastcgi_pass {{ include "common.names.fullname" . }}:9000;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_param SCRIPT_FILENAME /var/www/app/public$fastcgi_script_name;
|
||||||
|
fastcgi_buffer_size 16k;
|
||||||
|
fastcgi_buffers 4 16k;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
image:
|
image:
|
||||||
registry: docker.io
|
registry: docker.io
|
||||||
repository: invoiceninja/invoiceninja
|
repository: invoiceninja/invoiceninja
|
||||||
tag: 5.1.64
|
tag: 5.2.10
|
||||||
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
|
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
|
||||||
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
|
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
|
||||||
##
|
##
|
||||||
@@ -469,43 +469,9 @@ nginx:
|
|||||||
ingress:
|
ingress:
|
||||||
enabled: true
|
enabled: true
|
||||||
hostname: invoiceninja.local
|
hostname: invoiceninja.local
|
||||||
## Configure the serverblock for Invoice Ninja
|
## Use the serverblock config map from Invoice Ninja
|
||||||
## Note: you may need to replace the fastcgi_pass value if the release name is different
|
|
||||||
##
|
##
|
||||||
serverBlock: |
|
existingServerBlockConfigmap: '{{ include "invoiceninja.nginx.serverBlockName" . }}'
|
||||||
server {
|
## Use the public PVC created by Invoice Ninja
|
||||||
listen 8080 default_server;
|
|
||||||
server_name _;
|
|
||||||
|
|
||||||
root /var/www/app/public/;
|
|
||||||
index index.php;
|
|
||||||
|
|
||||||
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; }
|
|
||||||
|
|
||||||
location ~ \.php$ {
|
|
||||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
|
||||||
fastcgi_pass invoiceninja:9000;
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
## Configure the extraVolumes and extraVolumeMounts for Invoice Ninja
|
|
||||||
## Note: you may need to replace the claimName if the release name is different
|
|
||||||
##
|
##
|
||||||
extraVolumes:
|
staticSitePVC: '{{ include "invoiceninja.public.storageName" . }}'
|
||||||
- name: public
|
|
||||||
persistentVolumeClaim:
|
|
||||||
claimName: invoiceninja-public
|
|
||||||
extraVolumeMounts:
|
|
||||||
- mountPath: /var/www/app/public
|
|
||||||
name: public
|
|
||||||
readOnly: true
|
|
||||||
|
|||||||
Reference in New Issue
Block a user