Compare commits

...

3 Commits

Author SHA1 Message Date
Ween Jiann
3814e957e0 Use Redis Sentinel for chart (#317)
* Added sentinel config

* Bump chart version

* Fix trailing space
2021-04-06 18:18:34 +08:00
Thibaut De Muynck
62b1d8cb94 Added MariaDB to Docker compose for ARM64 (#315)
* Added option to use MariaDB instead of MySQL

* Moved MYSQL environment variables to env file
2021-04-06 09:29:04 +08:00
Ween Jiann
4cd773700e Update .gitignore 2021-04-05 17:31:27 +08:00
10 changed files with 96 additions and 33 deletions

3
.gitignore vendored
View File

@@ -9,3 +9,6 @@ Thumbs.db
# Helm # Helm
charts/**/charts/ charts/**/charts/
# Compose filesystem
/docker

View File

@@ -17,7 +17,7 @@
## Quickstart V5 Launch ## Quickstart V5 Launch
The dockerfile has been revamped to make is easier to get started, by default the base image selected in 5 which will pull in the latest v5 stable image. The dockerfile has been revamped to make it easier to get started, by default the base image selected is 5 which will pull in the latest v5 stable image.
```bash ```bash
git clone https://github.com/invoiceninja/dockerfiles.git git clone https://github.com/invoiceninja/dockerfiles.git
@@ -65,7 +65,7 @@ For example, lets say your APP_URL is ```http://in5.test:8000``` and your LAN IP
```192.168.0.124 in5.test``` ```192.168.0.124 in5.test```
**Please note that PDF generation using local host your domain name MUST end in .test for your PDFs to generate correctly, this is a DNS resolver issue with chromium. **Please note that for PDF generation using local host, your domain name MUST end in .test for your PDFs to generate correctly, this is a DNS resolver issue with chromium.
All that is left to do now is bring up the container All that is left to do now is bring up the container
@@ -75,6 +75,10 @@ All that is left to do now is bring up the container
**Note: When performing the setup, the Database host is ```db``` **Note: When performing the setup, the Database host is ```db```
### Running on ARM64 (Raspberry Pi 4)
When deploying on an ARM64 system, you need to comment out the `image: mysql:5` line and uncomment `image: mariadb:10.4` in the `docker-compose.yml` file.
## Updating the Image when using `docker-compose` ## Updating the Image when using `docker-compose`
As `docker-compose` does not support any form of version control, this git provide updates to `docker-compose.yml` directly. As `docker-compose` does not support any form of version control, this git provide updates to `docker-compose.yml` directly.

View File

@@ -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.2.0 version: 0.3.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.32 appVersion: 5.1.35
keywords: keywords:
- invoiceninja - invoiceninja
home: https://github.com/lwj5/invoiceninja-chart home: https://github.com/lwj5/invoiceninja-chart

View File

@@ -163,9 +163,12 @@ The following table shows the configuration options for the Invoiceninja helm ch
| `redis.enabled` | If external redis is used, set it to `false` | `true` | | `redis.enabled` | If external redis is used, set it to `false` | `true` |
| `redis.password` | Redis password | `nil` | | `redis.password` | Redis password | `nil` |
| `redis.usePassword` | Use redis password | `false` | | `redis.usePassword` | Use redis password | `false` |
| `redis.sentinel.enabled` | Enable sentinel containers | `true` |
| `redis.sentinel.usePassword` | Use password for sentinel containers | `false` |
| `externalRedis.host` | Host of the external redis | `nil` | | `externalRedis.host` | Host of the external redis | `nil` |
| `externalRedis.port` | Port of the external redis | `6379` | | `externalRedis.port` | Port of the external redis | `6379` |
| `externalRedis.password` | Password for the external redis | `nil` | | `externalRedis.password` | Password for the external redis | `nil` |
| `externalRedis.sentinel` | Using sentinels | `false` |
| `externalRedis.databases.default` | Database to use by default | `0` | | `externalRedis.databases.default` | Database to use by default | `0` |
| `externalRedis.databases.cache` | Database to use by cache | `1` | | `externalRedis.databases.cache` | Database to use by cache | `1` |

View File

@@ -140,7 +140,11 @@ Return the Redis Hostname
*/}} */}}
{{- define "invoiceninja.redisHost" -}} {{- define "invoiceninja.redisHost" -}}
{{- if .Values.redis.enabled }} {{- if .Values.redis.enabled }}
{{- if .Values.redis.sentinel.enabled }}
{{- printf "%s-%s" (include "invoiceninja.redis.fullname" .) "headless" | trunc 63 | trimSuffix "-" -}}
{{- else }}
{{- printf "%s-%s" (include "invoiceninja.redis.fullname" .) "master" | trunc 63 | trimSuffix "-" -}} {{- printf "%s-%s" (include "invoiceninja.redis.fullname" .) "master" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- else -}} {{- else -}}
{{- printf "%s" .Values.externalRedis.host -}} {{- printf "%s" .Values.externalRedis.host -}}
{{- end -}} {{- end -}}
@@ -151,7 +155,11 @@ Return the Redis Port
*/}} */}}
{{- define "invoiceninja.redisPort" -}} {{- define "invoiceninja.redisPort" -}}
{{- if .Values.redis.enabled }} {{- if .Values.redis.enabled }}
{{- if .Values.redis.sentinel.enabled }}
{{- printf "26379" -}}
{{- else }}
{{- printf "6379" -}} {{- printf "6379" -}}
{{- end -}}
{{- else -}} {{- else -}}
{{- printf "%d" (.Values.externalRedis.port | int ) -}} {{- printf "%d" (.Values.externalRedis.port | int ) -}}
{{- end -}} {{- end -}}
@@ -189,3 +197,36 @@ Return the Redis Secret Name
{{- printf "%s" (include "invoiceninja.redis.fullname" .) -}} {{- printf "%s" (include "invoiceninja.redis.fullname" .) -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{/*
Return the Broadcast Connection Name
*/}}
{{- define "invoiceninja.redisBroadcastConnection" -}}
{{- if or (and .Values.redis.enabled .Values.redis.sentinel.enabled) (and .Values.externalRedis.host .Values.externalRedis.sentinel) }}
{{- printf "sentinel-default" -}}
{{- else -}}
{{- printf "default" -}}
{{- end -}}
{{- end -}}
{{/*
Return the Cache Connection Name
*/}}
{{- define "invoiceninja.redisCacheConnection" -}}
{{- if or (and .Values.redis.enabled .Values.redis.sentinel.enabled) (and .Values.externalRedis.host .Values.externalRedis.sentinel) }}
{{- printf "sentinel-cache" -}}
{{- else -}}
{{- printf "cache" -}}
{{- end -}}
{{- end -}}
{{/*
Return the Broadcast Driver Name
*/}}
{{- define "invoiceninja.redisQueueConnection" -}}
{{- if or (and .Values.redis.enabled .Values.redis.sentinel.enabled) (and .Values.externalRedis.host .Values.externalRedis.sentinel) }}
{{- printf "sentinel-default" -}}
{{- else -}}
{{- printf "default" -}}
{{- end -}}
{{- end -}}

View File

@@ -22,27 +22,29 @@ data:
DB_PORT1: {{ include "invoiceninja.databasePort" . | quote }} DB_PORT1: {{ include "invoiceninja.databasePort" . | quote }}
DB_USERNAME1: {{ include "invoiceninja.databaseUser" . | quote }} DB_USERNAME1: {{ include "invoiceninja.databaseUser" . | quote }}
DB_DATABASE1: {{ include "invoiceninja.databaseName" . | quote }} DB_DATABASE1: {{ include "invoiceninja.databaseName" . | quote }}
{{- if not (empty .Values.logChannel) }} {{- if .Values.logChannel }}
LOG_CHANNEL: {{ .Values.logChannel | quote }} LOG_CHANNEL: {{ .Values.logChannel | quote }}
{{- else }}
LOG_CHANNEL: stderr
{{- end }} {{- end }}
{{- if not (empty .Values.broadcastDriver) }} {{- if .Values.broadcastDriver }}
BROADCAST_DRIVER: {{ .Values.broadcastDriver | quote }} BROADCAST_DRIVER: {{ .Values.broadcastDriver | quote }}
{{- else if or .Values.redis.enabled (not (empty .Values.externalRedis.host)) }} {{- else if or .Values.redis.enabled .Values.externalRedis.host }}
BROADCAST_DRIVER: redis BROADCAST_DRIVER: redis
{{- end }} {{- end }}
{{- if not (empty .Values.cacheDriver) }} {{- if .Values.cacheDriver }}
CACHE_DRIVER: {{ .Values.cacheDriver | quote }} CACHE_DRIVER: {{ .Values.cacheDriver | quote }}
{{- else if or .Values.redis.enabled (not (empty .Values.externalRedis.host)) }} {{- else if or .Values.redis.enabled .Values.externalRedis.host }}
CACHE_DRIVER: redis CACHE_DRIVER: redis
{{- end }} {{- end }}
{{- if not (empty .Values.sessionDriver) }} {{- if .Values.sessionDriver }}
SESSION_DRIVER: {{ .Values.sessionDriver | quote }} SESSION_DRIVER: {{ .Values.sessionDriver | quote }}
{{- else if or .Values.redis.enabled (not (empty .Values.externalRedis.host)) }} {{- else if or .Values.redis.enabled .Values.externalRedis.host }}
SESSION_DRIVER: redis SESSION_DRIVER: redis
{{- end }} {{- end }}
{{- if not (empty .Values.queueConnection) }} {{- if .Values.queueConnection }}
QUEUE_CONNECTION: {{ .Values.queueConnection | quote }} QUEUE_CONNECTION: {{ .Values.queueConnection | quote }}
{{- else if or .Values.redis.enabled (not (empty .Values.externalRedis.host)) }} {{- else if or .Values.redis.enabled .Values.externalRedis.host }}
QUEUE_CONNECTION: redis QUEUE_CONNECTION: redis
{{- end }} {{- end }}
PHANTOMJS_PDF_GENERATION: {{ not .Values.snappdf | quote}} PHANTOMJS_PDF_GENERATION: {{ not .Values.snappdf | quote}}
@@ -50,3 +52,6 @@ data:
REDIS_PORT: {{ include "invoiceninja.redisPort" . | quote }} REDIS_PORT: {{ include "invoiceninja.redisPort" . | quote }}
REDIS_DB: {{ include "invoiceninja.redisDatabase" . | quote }} REDIS_DB: {{ include "invoiceninja.redisDatabase" . | quote }}
REDIS_CACHE_DB: {{ include "invoiceninja.redisCacheDatabase" . | quote }} REDIS_CACHE_DB: {{ include "invoiceninja.redisCacheDatabase" . | quote }}
REDIS_BROADCAST_CONNECTION: {{ include "invoiceninja.redisBroadcastConnection" . | quote }}
REDIS_CACHE_CONNECTION: {{ include "invoiceninja.redisCacheConnection" . | quote }}
REDIS_QUEUE_CONNECTION: {{ include "invoiceninja.redisQueueConnection" . | quote }}

View File

@@ -18,7 +18,7 @@
image: image:
registry: docker.io registry: docker.io
repository: invoiceninja/invoiceninja repository: invoiceninja/invoiceninja
tag: 5.1.32 tag: 5.1.35
## 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
## ##
@@ -336,18 +336,19 @@ autoscaling:
redis: redis:
enabled: true enabled: true
usePassword: false usePassword: false
cluster: sentinel:
enabled: false enabled: true
usePassword: false
## External Redis Configuration ## External Redis Configuration
## ##
## All of these values are only used when redis.enabled is set to false ## All of these values are only used when redis.enabled is set to false
## ##
externalRedis: externalRedis:
## Redis host ## Redis/Sentinel host
## ##
host: "" host: ""
## Redis port number ## Redis/Sentinel port number
## ##
port: 6379 port: 6379
## Redis password ## Redis password
@@ -358,6 +359,8 @@ externalRedis:
## NOTE: When it's set, the `externalRedis.password` parameter is ignored ## NOTE: When it's set, the `externalRedis.password` parameter is ignored
## ##
# existingSecret: # existingSecret:
## Whether Redis Sentinel are used
sentinel: false
## Redis databases ## Redis databases
## ##
databases: databases:

View File

@@ -1,4 +1,6 @@
FROM mysql:5 FROM mysql:5
# When running on ARM64 use MariaDB instead of MySQL
#FROM mariadb:10.4
ENV force_color_prompt yes ENV force_color_prompt yes
RUN apt-get update; RUN apt-get update;

View File

@@ -39,17 +39,15 @@ services:
db: db:
image: mysql:5 image: mysql:5
# When running on ARM64 use MariaDB instead of MySQL
# image: mariadb:10.4
# For auto DB backups comment out image and use the build block below # For auto DB backups comment out image and use the build block below
# build: # build:
# context: ./config/mysql # context: ./config/mysql
ports: ports:
- "3305:3306" - "3305:3306"
restart: always restart: always
environment: env_file: env
- MYSQL_ROOT_PASSWORD=ninjaAdm1nPassword
- MYSQL_USER=ninja
- MYSQL_PASSWORD=ninja
- MYSQL_DATABASE=ninja
volumes: volumes:
- ./docker/mysql/data:/var/lib/mysql:rw,delegated - ./docker/mysql/data:/var/lib/mysql:rw,delegated

4
env
View File

@@ -7,6 +7,10 @@ DB_PORT1=3306
DB_USERNAME1=ninja DB_USERNAME1=ninja
DB_PASSWORD1=ninja DB_PASSWORD1=ninja
DB_DATABASE1=ninja DB_DATABASE1=ninja
MYSQL_ROOT_PASSWORD=ninjaAdm1nPassword
MYSQL_USER=ninja
MYSQL_PASSWORD=ninja
MYSQL_DATABASE=ninja
#this is a system variable please do not remove #this is a system variable please do not remove
IS_DOCKER=true IS_DOCKER=true