Compare commits

...

23 Commits

Author SHA1 Message Date
Ween Jiann
ff897d568f Change php-alpine from latest to 3.13 (#367) 2021-06-27 18:00:41 +08:00
David Bomba
b0bb0ffd25 Merge pull request #366 from turbo124/master
Rollback php-installer tags
2021-06-27 15:57:54 +10:00
David Bomba
3902b40bc1 remove tags 2021-06-27 15:55:52 +10:00
David Bomba
29e2d93e59 Merge pull request #365 from turbo124/master
Download php-installer
2021-06-27 15:21:28 +10:00
David Bomba
b7aea66e62 Download php-installer 2021-06-27 15:17:43 +10:00
David Bomba
e2db08f207 Update env
Set QUEUE_CONNECTION=database as default
2021-06-07 08:01:09 +10:00
Ffaen
59291d8687 Set trusted proxy value to allow invoiceninja to read nginx headers (#356)
Fixes #355
2021-05-27 00:32:56 +08:00
Ween Jiann
6f747207ec Add values for initial user creation to Chart (#350)
* Added user details in values.yaml

* Fix grammer in README.md

* Remove '1' suffix in DB config

* Add user password to secret

* Bump version

* Updated wait-db

* Bump IN version
2021-05-21 18:32:42 +08:00
Ween Jiann
c2aabd14ac Fix storageClass (#353) 2021-05-18 09:55:04 +08:00
Ffaen
07f1e601ab Update README to add information on env variables (#351)
* Update README to add information on env variables

References #349

* Set APP_URL to https if TLS enabled
2021-05-17 09:41:20 +08:00
Ween Jiann
13423d38c0 Fix chown in v4 (#348) 2021-05-14 09:45:32 +08:00
Ween Jiann
e34ac95617 Use logging with timestamp (#346) 2021-05-13 09:59:43 +08:00
Ween Jiann
6c68882449 Automatically create user and skip setup page (#345)
* Added checks to docker-entrypoint

* Add init scripts feature

* Added backward compatibility

* Added auto user creation

* Updated README.md and env

* Use dbCheck for checking DB connection
2021-05-13 09:41:08 +08:00
Ween Jiann
8e9e7c47da Updated dependent charts (#340)
* Updated dependent charts

* Fix releaser version

* Bump chart version
2021-05-11 09:40:19 +08:00
Ffaen
7da83b40f4 Change github actions chart release branch from master to main (#338)
The repo has renamed their master branch to main: https://github.com/helm/chart-releaser-action
2021-05-11 09:30:11 +08:00
Ween Jiann
1b48ab6983 Fix environment issues (#337)
* Clean env file

* Remove generated .env

* Fix file_env exporting empty values
2021-05-10 16:40:55 +08:00
Ween Jiann
14357b93a1 Update Chart Dependency (#336)
* Updated IN version

* Bump chart version
2021-05-10 12:15:23 +08:00
Ween Jiann
8a68fda3f3 Added volume permissions initcontainer (#335) 2021-05-10 11:40:45 +08:00
Ween Jiann
4ee20766ef Updated chart readme and bump IN version (#323)
* Updated README.md

* Bump chart version

* Fix trailing slash in APP_URL

* Bump IN version
2021-04-09 13:01:27 +08:00
David Bomba
5ba28528c3 Merge pull request #321 from turbo124/master
Set larger client max body size
2021-04-08 10:15:23 +10:00
David Bomba
9388f66a29 Set larger client max body size 2021-04-08 10:14:58 +10:00
Ween Jiann
b445cf0402 Fix Redis password in Chart (#320)
* Fix NOTES.txt

* Added Redis password

* Updated README.md
2021-04-07 22:42:42 +08:00
Ween Jiann
11c8901fe4 Use registry cache 2021-04-07 00:47:20 +08:00
21 changed files with 466 additions and 207 deletions

View File

@@ -44,13 +44,13 @@ jobs:
id: buildx id: buildx
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v1
- name: Cache Docker layers # - name: Cache Docker layers
uses: actions/cache@v2 # uses: actions/cache@v2
with: # with:
path: /tmp/.buildx-cache # path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }} # key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: | # restore-keys: |
${{ runner.os }}-buildx- # ${{ runner.os }}-buildx-
- name: Login to DockerHub - name: Login to DockerHub
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
@@ -70,8 +70,8 @@ jobs:
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }} push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.prep.outputs.tags }} tags: ${{ steps.prep.outputs.tags }}
cache-from: type=local,src=/tmp/.buildx-cache cache-from: invoiceninja/invoiceninja:${{ steps.prep.outputs.major }}
cache-to: type=local,dest=/tmp/.buildx-cache cache-to: type=inline
- name: Image digest - name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }} run: echo ${{ steps.docker_build.outputs.digest }}

View File

@@ -27,6 +27,6 @@ jobs:
helm repo add bitnami https://charts.bitnami.com/bitnami helm repo add bitnami https://charts.bitnami.com/bitnami
- name: Run chart-releaser - name: Run chart-releaser
uses: helm/chart-releaser-action@master uses: helm/chart-releaser-action@v1.2.1
env: env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

View File

@@ -17,15 +17,15 @@ VERSION=$(shell echo ${TAG} | sed "s/-.*//")
# Building docker images based on alpine. # Building docker images based on alpine.
# Assigned tags: # Assigned tags:
# - :alpine # - :4
# - :alpine-<RELEASE VERSION> # - :<RELEASE VERSION>
.PHONY: build-alpine .PHONY: build-alpine
build-alpine: build-alpine:
ifeq ($(IS_V5),) ifeq ($(IS_V5),)
$(info Make: Building "$(VERSION)" tagged images from alpine.) $(info Make: Building "$(VERSION)" tagged images from alpine.)
@docker build -t ${HUB_NAMESPACE}/${IMAGE}:alpine-${VERSION} --build-arg INVOICENINJA_VERSION=${VERSION} ./alpine/4/ @docker build -t ${HUB_NAMESPACE}/${IMAGE}:${VERSION} --build-arg INVOICENINJA_VERSION=${VERSION} ./alpine/4/
# Tag as alpine-4 # Tag as 4
@docker tag ${HUB_NAMESPACE}/${IMAGE}:alpine-${VERSION} ${HUB_NAMESPACE}/${IMAGE}:alpine-4 @docker tag ${HUB_NAMESPACE}/${IMAGE}:alpine-${VERSION} ${HUB_NAMESPACE}/${IMAGE}:4
$(info Make: Done.) $(info Make: Done.)
endif endif
@@ -33,8 +33,8 @@ endif
push-alpine: push-alpine:
ifeq ($(IS_V5),) ifeq ($(IS_V5),)
$(info Make: Pushing tagged images from alpine.) $(info Make: Pushing tagged images from alpine.)
@docker push ${HUB_NAMESPACE}/${IMAGE}:alpine-${VERSION} @docker push ${HUB_NAMESPACE}/${IMAGE}:${VERSION}
@docker push ${HUB_NAMESPACE}/${IMAGE}:alpine-4 @docker push ${HUB_NAMESPACE}/${IMAGE}:4
$(info Make: Done.) $(info Make: Done.)
endif endif

View File

@@ -1,6 +1,8 @@
![Docker images](https://github.com/invoiceninja/dockerfiles/workflows/Docker%20images/badge.svg) ![Docker images](https://github.com/invoiceninja/dockerfiles/workflows/Docker%20images/badge.svg)
[![Docker image, latest](https://img.shields.io/docker/image-size/invoiceninja/invoiceninja/latest?label=latest)](https://hub.docker.com/r/invoiceninja/invoiceninja) [![Docker image, latest](https://img.shields.io/docker/image-size/invoiceninja/invoiceninja/latest?label=latest)](https://hub.docker.com/r/invoiceninja/invoiceninja)
[![Docker image, alpine](https://img.shields.io/docker/image-size/invoiceninja/invoiceninja/alpine?label=alpine)](https://hub.docker.com/r/invoiceninja/invoiceninja) [![Docker image, alpine](https://img.shields.io/docker/image-size/invoiceninja/invoiceninja/alpine?label=alpine)](https://hub.docker.com/r/invoiceninja/invoiceninja)
[![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/invoiceninja)](https://artifacthub.io/packages/search?repo=invoiceninja)
# Docker for [Invoice Ninja](https://www.invoiceninja.com/) # Docker for [Invoice Ninja](https://www.invoiceninja.com/)
@@ -8,14 +10,19 @@
:lock: Automatic HTTPS (:heart: [Caddy](https://caddyserver.com/)) :lock: Automatic HTTPS (:heart: [Caddy](https://caddyserver.com/))
:fire: NGINX webserver support [NGINX](https://nginx.org/) :fire: NGINX webserver support [NGINX](https://nginx.org/)
:hammer: Fully production-ready through docker-compose :hammer: Fully production-ready through Helm Chart
:pencil: Adjustable to your needs via environment variable :pencil: Adjustable to your needs via environment variable
## You want some Kubernetes + Helm with that? ## Get some Kubernetes + Helm with that!
[Helm Chat](https://github.com/Saddamus/invoiceninja-helm) by @Saddamus
[Kubernetes](https://github.com/invoiceninja/dockerfiles/issues/94) by @spacepluk
## Quickstart V5 Launch Introducing our very own [Helm Chart](https://github.com/invoiceninja/dockerfiles/tree/master/charts/invoiceninja) that helps you launch a simple standalone app to a production-ready, highly available Invoice Ninja setup. All you need to do is initialise Kubernetes (available with Docker Desktop), install [Helm](https://helm.sh/docs/intro/install/), and spin up Invoice Ninja using the steps provided [here](https://github.com/invoiceninja/dockerfiles/tree/master/charts/invoiceninja#installing-the-chart).
Other resources:
[Helm Chart](https://github.com/Saddamus/invoiceninja-helm) by @Saddamus
[K8s Manifest](https://github.com/invoiceninja/dockerfiles/issues/94) by @spacepluk
## Alternatively get started with Docker Compose
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. 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.
@@ -24,21 +31,19 @@ git clone https://github.com/invoiceninja/dockerfiles.git
cd dockerfiles cd dockerfiles
``` ```
Instead of defining our environment variables inside our docker-compose.yml file we now define this in the `env` file, open this file up and insert your `APP_URL` and your `APP_KEY` Instead of defining our environment variables inside our docker-compose.yml file we now define this in the `env` file, open this file up and insert your `APP_URL`, `APP_KEY` and update the rest of the variables as required.
``` ```
APP_URL=http://in.localhost:8003/ APP_URL=http://in.localhost:8003/
APP_KEY=<insert your generated key in here> APP_KEY=<insert your generated key in here>
APP_DEBUG=true APP_DEBUG=true
MULTI_DB_ENABLED=false REQUIRE_HTTPS=false
DB_HOST1=db IN_USER_EMAIL=
DB_PORT1=3306 IN_PASSWORD=
DB_USERNAME1=ninja
DB_PASSWORD1=ninja
DB_DATABASE1=ninja
PHANTOMJS_PDF_GENERATION=false
``` ```
If `IN_USER_EMAIL` and `IN_PASSWORD` is not set the default user email and password is "admin@example.com" and "changeme!" respectively. You will use this for the initial login, thereafter, you can delete this two environment variables.
The `APP_KEY` can be generated by running The `APP_KEY` can be generated by running
```bash ```bash
@@ -79,7 +84,7 @@ All that is left to do now is bring up the container
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. 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

@@ -83,7 +83,7 @@ fi
rm -rf "$BAK_PUBLIC_PATH" rm -rf "$BAK_PUBLIC_PATH"
# Set permission for web server to create/update files (only <v4) # Set permission for web server to create/update files (only <v4)
chown -R "$INVOICENINJA_USER":www-data /var/www/app/storage /var/www/app/public /var/www/app/bootstrap chown -R "$INVOICENINJA_USER":"$INVOICENINJA_USER" /var/www/app/storage /var/www/app/public /var/www/app/bootstrap
# Initialize values that might be stored in a file # Initialize values that might be stored in a file
file_env 'APP_KEY' file_env 'APP_KEY'

View File

@@ -28,7 +28,7 @@ RUN npm install --production \
&& mv /var/www/app/public $BAK_PUBLIC_PATH && mv /var/www/app/public $BAK_PUBLIC_PATH
# Prepare php image # Prepare php image
FROM php:${PHP_VERSION}-fpm-alpine as prod FROM php:${PHP_VERSION}-fpm-alpine3.13 as prod
ARG INVOICENINJA_VERSION ARG INVOICENINJA_VERSION
ARG BAK_STORAGE_PATH ARG BAK_STORAGE_PATH
ARG BAK_PUBLIC_PATH ARG BAK_PUBLIC_PATH

View File

@@ -0,0 +1,14 @@
#!/bin/sh
php artisan db:seed --force
# Build up array of arguments...
if [[ ! -z "${IN_USER_EMAIL}" ]]; then
email="--email ${IN_USER_EMAIL}"
fi
if [[ ! -z "${IN_PASSWORD}" ]]; then
password="--password ${IN_PASSWORD}"
fi
php artisan ninja:create-account $email $password

View File

@@ -27,60 +27,71 @@ file_env() {
local fileVar="${var}_FILE" local fileVar="${var}_FILE"
local def="${2:-}" local def="${2:-}"
if [ "$(ie_gv ${var})" != "" ] && [ "$(ie_gv ${fileVar})" != "" ]; then
in_error "Both $var and $fileVar are set (but are exclusive)"
fi
local val="$def"
if [ "$(ie_gv ${var})" != "" ]; then if [ "$(ie_gv ${var})" != "" ]; then
val=$(ie_gv ${var}) if [ "$(ie_gv ${fileVar})" != "" ]; then
elif [ "$(ie_gv ${fileVar})" != "" ]; then in_error "Both $var and $fileVar are set (but are exclusive)"
val=$(cat $(ie_gv ${fileVar})) fi
unset "$fileVar"
return
fi
if [ "$(ie_gv ${fileVar})" != "" ] && [ -f "$(ie_gv ${fileVar})" ]; then
export "$var"="$(cat $(ie_gv ${fileVar}))"
elif [ ! -z "$def" ]; then
export "$var"="$def"
fi fi
export "$var"="$val"
unset "$fileVar" unset "$fileVar"
} }
# first arg is `-f` or `--some-option` # first arg is `-f` or `--some-option`
if [ "${1#-}" != "$1" ]; then if [ "${1#-}" != "$1" ]; then
set -- php-fpm "$@" set -- supervisord "$@"
fi fi
# create storage volume # create storage volume
if [ ! -d /var/www/app/storage ] && [ -d "$BAK_STORAGE_PATH" ]; then if [ -d "$BAK_STORAGE_PATH" ]; then
mv "$BAK_STORAGE_PATH" /var/www/app/storage if [ ! -d /var/www/app/storage ]; then
elif [ -d "$BAK_STORAGE_PATH" ]; then mv "$BAK_STORAGE_PATH" /var/www/app/storage
# copy missing folders in storage else
IN_STORAGE_BACKUP="$(ls "$BAK_STORAGE_PATH")" # copy missing folders in storage
for path in $IN_STORAGE_BACKUP; do IN_STORAGE_BACKUP="$(ls "$BAK_STORAGE_PATH")"
if [ ! -e "/var/www/app/storage/$path" ]; then for path in $IN_STORAGE_BACKUP; do
cp -Rp "$BAK_STORAGE_PATH/$path" "/var/www/app/storage/" if [ ! -e "/var/www/app/storage/$path" ]; then
fi cp -Rp "$BAK_STORAGE_PATH/$path" "/var/www/app/storage/"
done fi
done
fi
rm -rf "$BAK_STORAGE_PATH"
fi
# prevent init scripts from running when upgrading from IN <= 5.1.62
if [ -f /var/www/app/public/version ] && [ "$INVOICENINJA_VERSION" != "$(cat /var/www/app/public/version)" ]; then
touch /var/www/app/storage/.initialized
fi fi
rm -rf "$BAK_STORAGE_PATH"
# create public volume # create public volume
if [ ! -d /var/www/app/public ] && [ -d "$BAK_PUBLIC_PATH" ]; then if [ -d "$BAK_PUBLIC_PATH" ]; then
mv "$BAK_PUBLIC_PATH" /var/www/app/public if [ ! -d /var/www/app/public ]; then
elif [ ! -e /var/www/app/public/version ] || [ "$INVOICENINJA_VERSION" != "$(cat /var/www/app/public/version)" ]; then mv "$BAK_PUBLIC_PATH" /var/www/app/public
# version mismatch, update all elif [ ! -f /var/www/app/public/version ] || [ "$INVOICENINJA_VERSION" != "$(cat /var/www/app/public/version)" ]; then
cp -au "$BAK_PUBLIC_PATH/"* /var/www/app/public # version mismatch, update all
echo "$INVOICENINJA_VERSION" >/var/www/app/public/version cp -au "$BAK_PUBLIC_PATH/"* /var/www/app/public
elif [ ! -d /var/www/app/public/logo ] && [ -d "$BAK_PUBLIC_PATH/logo" ]; then echo "$INVOICENINJA_VERSION" >/var/www/app/public/version
# missing logo folder only, copy folder elif [ ! -d /var/www/app/public/logo ] && [ -d "$BAK_PUBLIC_PATH/logo" ]; then
cp -a "$BAK_PUBLIC_PATH/logo" /var/www/app/public/logo # missing logo folder only, copy folder
elif [ -d "$BAK_PUBLIC_PATH/logo" ]; then cp -a "$BAK_PUBLIC_PATH/logo" /var/www/app/public/logo
# copy missing folders in logo elif [ -d "$BAK_PUBLIC_PATH/logo" ]; then
IN_LOGO_BACKUP="$(ls "$BAK_PUBLIC_PATH/logo")" # copy missing folders in logo
for path in $IN_LOGO_BACKUP; do IN_LOGO_BACKUP="$(ls "$BAK_PUBLIC_PATH/logo")"
if [ ! -e "/var/www/app/public/logo/$path" ]; then for path in $IN_LOGO_BACKUP; do
cp -a "$BAK_PUBLIC_PATH/logo/$path" "/var/www/app/public/logo/" if [ ! -e "/var/www/app/public/logo/$path" ]; then
fi cp -a "$BAK_PUBLIC_PATH/logo/$path" "/var/www/app/public/logo/"
done fi
done
fi
rm -rf "$BAK_PUBLIC_PATH"
fi fi
rm -rf "$BAK_PUBLIC_PATH"
# Initialize values that might be stored in a file # Initialize values that might be stored in a file
file_env 'APP_KEY' file_env 'APP_KEY'
@@ -98,10 +109,10 @@ file_env 'MAILGUN_SECRET'
file_env 'S3_KEY' file_env 'S3_KEY'
file_env 'S3_SECRET' file_env 'S3_SECRET'
# Run Laravel stuff # Run IN/Laravel stuff
if [[ "$1" == "supervisord" ]] || [[ "$1" == "php-fpm" ]]; then if [[ "$1" == "supervisord" ]] || [[ "$1" == "php-fpm" ]]; then
echo "Initialising Laravel..." in_log INFO "Initialising Invoice Ninja..."
. laravel-init.sh . invoiceninja-init.sh
fi fi
exec docker-php-entrypoint "$@" exec docker-php-entrypoint "$@"

View File

@@ -0,0 +1,44 @@
#!/bin/sh
# usage: docker_process_init_files [file [file [...]]]
# ie: docker_process_init_files /always-initdb.d/*
# process initializer files, based on file extensions
docker_process_init_files() {
echo
local f
for f; do
case "$f" in
*.sh)
# https://github.com/docker-library/postgres/issues/450#issuecomment-393167936
# https://github.com/docker-library/postgres/pull/452
if [ -x "$f" ]; then
in_log INFO "$0: running $f"
"$f"
else
in_log INFO "$0: sourcing $f"
. "$f"
fi
;;
*) in_log INFO "$0: ignoring $f" ;;
esac
echo
done
}
php artisan config:cache
php artisan optimize
# Check if DB works, if not crash the app.
DB_READY=$(php artisan tinker --execute='echo app()->call("App\Utils\SystemHealth@dbCheck")["success"];')
if [ "$DB_READY" != "1" ]; then
php artisan migrate:status # Print verbose error
in_error "Error connecting to DB"
fi
php artisan migrate --force
# If first IN run, it needs to be initialized
if [ ! -f /var/www/app/storage/.initialized ]; then
docker_process_init_files /docker-entrypoint-init.d/*
touch /var/www/app/storage/.initialized
fi

View File

@@ -1,5 +0,0 @@
#!/bin/sh
php artisan config:cache
php artisan optimize
php artisan migrate --force

View File

@@ -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.2 version: 1.4.3
- name: nginx - name: nginx
repository: https://charts.bitnami.com/bitnami repository: https://charts.bitnami.com/bitnami
version: 8.8.0 version: 8.8.5
- name: mariadb - name: mariadb
repository: https://charts.bitnami.com/bitnami repository: https://charts.bitnami.com/bitnami
version: 9.3.6 version: 9.3.11
- name: redis - name: redis
repository: https://charts.bitnami.com/bitnami repository: https://charts.bitnami.com/bitnami
version: 12.9.0 version: 12.9.2
digest: sha256:008659600506cbc8dd5c9b8e96ce81430e4d8582368646469aa17a37441f5bbc digest: sha256:4255a558312b033e820635f491b0960bd4ec8e716164025212af06adafbd4cb9
generated: "2021-03-29T18:41:17.978475+08:00" generated: "2021-05-11T09:31:45.433+08:00"

View File

@@ -1,6 +1,6 @@
apiVersion: v2 apiVersion: v2
name: invoiceninja name: invoiceninja
description: A Helm chart to install Invoiceninja description: A Helm chart to install Invoice Ninja
# A chart can be either an 'application' or a 'library' chart. # A chart can be either an 'application' or a 'library' chart.
# #
# Application charts are a collection of templates that can be packaged into versioned archives # Application charts are a collection of templates that can be packaged into versioned archives
@@ -13,14 +13,14 @@ 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.3.0 version: 0.5.1
# 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.35 appVersion: 5.1.64
keywords: keywords:
- invoiceninja - invoiceninja
home: https://github.com/lwj5/invoiceninja-chart home: https://invoiceninja.github.io/dockerfiles
sources: sources:
- https://github.com/invoiceninja/invoiceninja - https://github.com/invoiceninja/invoiceninja
- https://github.com/invoiceninja/dockerfiles - https://github.com/invoiceninja/dockerfiles

View File

@@ -1,9 +1,9 @@
# Invoiceninja # Invoice Ninja Helm Chart
This helm chart installs a Invoiceninja and its dependencies into a running This helm chart installs Invoice Ninja (IN) and its dependencies into a running
Kubernetes cluster. Kubernetes cluster.
The chart installs the [Invoiceninja](https://hub.docker.com/r/invoiceninja/invoiceninja) docker image. The chart installs the [Invoice Ninja](https://hub.docker.com/r/invoiceninja/invoiceninja) docker image.
Please read [Upgrading](#upgrading) section before upgrading MAJOR versions. Please read [Upgrading](#upgrading) section before upgrading MAJOR versions.
@@ -12,6 +12,7 @@ Please read [Upgrading](#upgrading) section before upgrading MAJOR versions.
- The Bitnami [common](https://github.com/bitnami/charts/tree/master/bitnami/common) helm chart - The Bitnami [common](https://github.com/bitnami/charts/tree/master/bitnami/common) helm chart
- 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
- Tested on Kubernetes 1.17+ - Tested on Kubernetes 1.17+
## Installing the Chart ## Installing the Chart
@@ -23,7 +24,7 @@ helm repo add invoiceninja https://invoiceninja.github.io/dockerfiles
helm install invoiceninja invoiceninja/invoiceninja helm install invoiceninja invoiceninja/invoiceninja
``` ```
The command deploys Invoiceninja 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.
> **Tip**: List all releases using `helm list` > **Tip**: List all releases using `helm list`
@@ -39,11 +40,13 @@ The command removes all the Kubernetes components associated with the chart and
## Parameters ## Parameters
The following table lists the configurable parameters of the Invoiceninja chart and their default values. The following table lists the configurable parameters of the Invoice Ninja chart and their default values.
> NOTE: You MUST set any values that default to random or risk losing access after an upgrade. See how [here](#installing-with-arguments)
### Global Configuration ### Global Configuration
The following table shows the configuration options for the Invoiceninja helm chart: The following table shows the configuration options for the Invoice Ninja helm chart:
### Global parameters ### Global parameters
@@ -65,40 +68,45 @@ The following table shows the configuration options for the Invoiceninja helm ch
| `kubeVersion` | Force target Kubernetes version (using Helm capabilities if not set) | `nil` | | `kubeVersion` | Force target Kubernetes version (using Helm capabilities if not set) | `nil` |
| `extraDeploy` | Array of extra objects to deploy with the release | `[]` (evaluated as a template) | | `extraDeploy` | Array of extra objects to deploy with the release | `[]` (evaluated as a template) |
### Invoiceninja parameters ### Invoice Ninja parameters
| Parameter | Description | Default | | Parameter | Description | Default |
| -------------------- | --------------------------------------------------------------- | ------------------------------------------------------- | | -------------------- | ---------------------------------------------------------------- | ------------------------------------------------------- |
| `image.registry` | Invoiceninja image registry | `docker.io` | | `image.registry` | Invoice Ninja image registry | `docker.io` |
| `image.repository` | Invoiceninja image name | `invoiceninja/invoiceninja` | | `image.repository` | Invoice Ninja image name | `invoiceninja/invoiceninja` |
| `image.tag` | Invoiceninja image tag | Check `values.yaml` file | | `image.tag` | Invoice Ninja image tag | Check `values.yaml` file |
| `image.pullPolicy` | Invoiceninja 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 Invoiceninja pods | `default` | | `serviceAccountName` | Name of a service account for the Invoice Ninja pods | `default` |
| `debug` | Turn on debug mode on Invoiceninja | `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_ |
| `logChannel` | Name of log channel to use | `nil` | | `userEmail` | Initial user email address | `admin@example.com` |
| `broadcastDriver` | Name of broadcast driver to use | `nil` | | `userPassword` | Initial user password | `changeme!` |
| `cacheDriver` | Name of cache driver to use | `nil` | | `logChannel` | Name of log channel to use | `nil` |
| `sessionDriver` | Name of session driver to use | `nil` | | `broadcastDriver` | Name of broadcast driver to use | `nil` |
| `queueConnection` | Name of queue connection to use | `nil` | | `cacheDriver` | Name of cache driver to use | `nil` |
| `snappdf` | Use snappdf instead of Phantom JS PDF generation | `true` | | `sessionDriver` | Name of session driver to use | `nil` |
| `extraEnvVars` | Extra environment variables to be set on Invoiceninja container | `{}` | | `queueConnection` | Name of queue connection to use | `nil` |
| `extraEnvVarsCM` | Name of existing ConfigMap containing extra env vars | `nil` | | `snappdf` | Use snappdf instead of Phantom JS PDF generation | `true` |
| `extraEnvVarsSecret` | Name of existing Secret containing extra env vars | `nil` | | `mailer` | Name of the mailer to use (log, smtp, etc.) | `log` |
| `requireHttps` | Force HTTPS for internal connections to Invoice Ninja (see #349) | `false` |
| `extraEnvVars` | Extra environment variables to be set on Invoice Ninja container | `{}` |
| `extraEnvVarsCM` | Name of existing ConfigMap 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 | `'*'` |
### Invoiceninja deployment parameters ### Invoice Ninja deployment parameters
| Parameter | Description | Default | | Parameter | Description | Default |
| --------------------------- | ----------------------------------------------------------------------------------------- | ------------------------------ | | --------------------------- | ----------------------------------------------------------------------------------------- | ------------------------------ |
| `replicaCount` | Number of Invoiceninja Pods to run | `1` | | `replicaCount` | Number of Invoice Ninja Pods to run | `1` |
| `containerPorts.fastcgi` | FastCGI port to expose at container level | `9000` | | `containerPorts.fastcgi` | FastCGI port to expose at container level | `9000` |
| `podSecurityContext` | Invoiceninja pods' Security Context | Check `values.yaml` file | | `podSecurityContext` | Invoice Ninja pods' Security Context | Check `values.yaml` file |
| `containerSecurityContext` | Invoiceninja containers' Security Context | Check `values.yaml` file | | `containerSecurityContext` | Invoice Ninja containers' Security Context | Check `values.yaml` file |
| `resources` | The resources for the Invoiceninja container | `{}` | | `resources` | The resources for the Invoice Ninja container | `{}` |
| `livenessProbe` | Liveness probe configuration for Invoiceninja | Check `values.yaml` file | | `livenessProbe` | Liveness probe configuration for Invoice Ninja | Check `values.yaml` file |
| `readinessProbe` | Readiness probe configuration for Invoiceninja | Check `values.yaml` file | | `readinessProbe` | Readiness probe configuration for Invoice Ninja | Check `values.yaml` file |
| `updateStrategy` | Set up update strategy | `RollingUpdate` | | `updateStrategy` | Set up update strategy | `RollingUpdate` |
| `podAntiAffinityPreset` | Pod anti-affinity preset. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `soft` | | `podAntiAffinityPreset` | Pod anti-affinity preset. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `soft` |
| `nodeAffinityPreset.type` | Node affinity preset type. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `""` | | `nodeAffinityPreset.type` | Node affinity preset type. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `""` |
@@ -107,11 +115,23 @@ The following table shows the configuration options for the Invoiceninja helm ch
| `affinity` | Affinity for pod assignment | `{}` (evaluated as a template) | | `affinity` | Affinity for pod assignment | `{}` (evaluated as a template) |
| `nodeSelector` | Node labels for pod assignment | `{}` (evaluated as a template) | | `nodeSelector` | Node labels for pod assignment | `{}` (evaluated as a template) |
| `tolerations` | Tolerations for pod assignment | `[]` (evaluated as a template) | | `tolerations` | Tolerations for pod assignment | `[]` (evaluated as a template) |
| `podLabels` | Extra labels for Invoiceninja pods | `{}` | | `podLabels` | Extra labels for Invoice Ninja pods | `{}` |
| `podAnnotations` | Annotations for Invoiceninja pods | `{}` | | `podAnnotations` | Annotations for Invoice Ninja pods | `{}` |
| `extraVolumeMounts` | Additional volume mounts | `[]` | | `extraVolumeMounts` | Additional volume mounts | `[]` |
| `extraVolumes` | Additional volumes | `[]` | | `extraVolumes` | Additional volumes | `[]` |
### Volume Permissions parameters
| Parameter | Description | Default |
| ------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- |
| `volumePermissions.enabled` | Enable init container that changes the owner and group of the persistent volume(s) mountpoint to `runAsUser:fsGroup` | `false` |
| `volumePermissions.image.registry` | Init container volume-permissions image registry | `docker.io` |
| `volumePermissions.image.repository` | Init container volume-permissions image name | `bitnami/bitnami-shell` |
| `volumePermissions.image.tag` | Init container volume-permissions image tag | `"10"` |
| `volumePermissions.image.pullPolicy` | Init container volume-permissions image pull policy | `Always` |
| `volumePermissions.image.pullSecrets` | Specify docker-registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) |
| `volumePermissions.resources` | Init container volume-permissions resource | `{}` |
### Exposure parameters ### Exposure parameters
| Parameter | Description | Default | | Parameter | Description | Default |
@@ -119,7 +139,7 @@ The following table shows the configuration options for the Invoiceninja helm ch
| `service.type` | Kubernetes Service type | `ClusterIP` | | `service.type` | Kubernetes Service type | `ClusterIP` |
| `service.port` | Service FastCGI port | `9000` | | `service.port` | Service FastCGI port | `9000` |
| `service.nodePort` | Kubernetes FastCGI node port | `""` | | `service.nodePort` | Kubernetes FastCGI node port | `""` |
| `service.clusterIP` | Invoiceninja service clusterIP IP | `None` | | `service.clusterIP` | Invoice Ninja service clusterIP IP | `None` |
| `service.loadBalancerSourceRanges` | Restricts access for LoadBalancer (only with `service.type: LoadBalancer`) | `[]` | | `service.loadBalancerSourceRanges` | Restricts access for LoadBalancer (only with `service.type: LoadBalancer`) | `[]` |
| `service.loadBalancerIP` | loadBalancerIP if service type is `LoadBalancer` | `nil` | | `service.loadBalancerIP` | loadBalancerIP if service type is `LoadBalancer` | `nil` |
| `service.externalTrafficPolicy` | Enable client source IP preservation | `Cluster` | | `service.externalTrafficPolicy` | Enable client source IP preservation | `Cluster` |
@@ -134,7 +154,7 @@ The following table shows the configuration options for the Invoiceninja helm ch
| `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.serverBlock` | Custom NGINX server block | `nil` |
| `nginx.extraVolumes` | Array to add extra volumes | Check `values.yaml` file | | `nginx.extraVolumes` | Array to add extra volumes | Check `values.yaml` file |
| `nginx.extraVolumes[0].persistentVolumeClaim.claimName` | Name of Invoiceninja public PVC | `invoiceninja-public` | | `nginx.extraVolumes[0].persistentVolumeClaim.claimName` | Name of Invoice Ninja public PVC | `invoiceninja-public` |
| `nginx.extraVolumeMounts` | Array to add extra mount | Check `values.yaml` file | | `nginx.extraVolumeMounts` | Array to add extra mount | Check `values.yaml` file |
> See [Dependencies](#dependencies) for more. > See [Dependencies](#dependencies) for more.
@@ -158,19 +178,18 @@ The following table shows the configuration options for the Invoiceninja helm ch
### Redis parameters ### Redis parameters
| Parameter | Description | Default | | Parameter | Description | Default |
| --------------------------------- | -------------------------------------------- | ------- | | --------------------------------- | -------------------------------------------- | ----------------------------------------- |
| `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 | _random 10 character alphanumeric string_ |
| `redis.usePassword` | Use redis password | `false` | | `redis.sentinel.enabled` | Enable sentinel containers | `true` |
| `redis.sentinel.enabled` | Enable sentinel containers | `true` | | `redis.sentinel.usePassword` | Use password for sentinel containers | `false` |
| `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.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` |
> See [Dependencies](#dependencies) for more. > See [Dependencies](#dependencies) for more.
@@ -194,13 +213,13 @@ The following table shows the configuration options for the Invoiceninja helm ch
### Other parameters ### Other parameters
| Parameter | Description | Default | | Parameter | Description | Default |
| -------------------------- | --------------------------------------- | ------- | | -------------------------- | ---------------------------------------- | ------- |
| `autoscaling.enabled` | Enable autoscaling for Invoiceninja | `false` | | `autoscaling.enabled` | Enable autoscaling for Invoice Ninja | `false` |
| `autoscaling.minReplicas` | Minimum number of Invoiceninja replicas | `1` | | `autoscaling.minReplicas` | Minimum number of Invoice Ninja replicas | `1` |
| `autoscaling.maxReplicas` | Maximum number of Invoiceninja replicas | `11` | | `autoscaling.maxReplicas` | Maximum number of Invoice Ninja replicas | `11` |
| `autoscaling.targetCPU` | Target CPU utilization percentage | `nil` | | `autoscaling.targetCPU` | Target CPU utilization percentage | `nil` |
| `autoscaling.targetMemory` | Target Memory utilization percentage | `nil` | | `autoscaling.targetMemory` | Target Memory utilization percentage | `nil` |
## Installing with Arguments ## Installing with Arguments
@@ -208,18 +227,63 @@ Specify each parameter using the `--set key=value[,key=value]` argument to `helm
```bash ```bash
helm install invoiceninja \ helm install invoiceninja \
--set replicaCount=3,livenessProbe.initialDelaySeconds=90 \ --set appKey=changeit \
--set replicaCount=3 \
--set nginx.replicaCount=3 \
--set redis.cluster.slaveCount=3 \
--set redis.password=changeit \
--set mariadb.auth.rootPassword=changeit \
--set mariadb.auth.password=changeit \
invoiceninja/invoiceninja invoiceninja/invoiceninja
``` ```
The above command sets the number of replicas to 4, and the liveness probe delay to 90 seconds. The above command sets the number of replicas to 3 for a highly available (HA) setup. Note that you would need to use an external DB such as MariaDB Galera for a full HA production setup.
Alternatively, a YAML file that specifies the values for the parameters can be provided while [installing](https://helm.sh/docs/helm/helm_install/) the chart. For example, Alternatively, a YAML file that specifies the values for the parameters can be provided while [installing](https://helm.sh/docs/helm/helm_install/) the chart. For example,
```yaml
# values.yaml
appKey: changeit
replicaCount: 3
nginx:
replicaCount: 3
redis:
cluster:
slaveCount: 3
password: changeit
mariadb:
auth:
rootPassword: changeit
password: changeit
```
```bash ```bash
helm install invoiceninja -f values.yaml invoiceninja/invoiceninja helm install invoiceninja -f values.yaml invoiceninja/invoiceninja
``` ```
## Setting Environment Variables
Should you need to inject any environment variables such as those in [here](https://github.com/invoiceninja/dockerfiles/blob/master/env) into the `invoiceninja` container, you can use the `extraEnvVars` option:
```yaml
# ... values.yaml file
# In this example, we are setting the SMTP MAIL_HOST to be 'smtp.mailtrap.io'
extraEnvVars:
- name: MAIL_HOST
value: 'smtp.mailtrap.io' # all values must be strings, so other types must be surrounded in quotes
```
Alternatively you can provide the name of an existing `configmap` or `secret` object:
```bash
kubectl create configmap examplemap --from-literal=MAIL_HOST='smtp.mailtrap.io'
```
```yaml
# ... values.yaml file
extraEnvVarsCM: examplemap
```
## Upgrading ## Upgrading
Nothing yet. Nothing yet.

View File

@@ -16,18 +16,19 @@ Externally through the following DNS name:
-- OR -- -- OR --
{{ end }} {{ end }}
{{- if contains "NodePort" .Values.service.type }} {{- if contains "NodePort" .Values.nginx.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "common.names.fullname" . }}) export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "invoiceninja.nginx.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }} {{- else if contains "LoadBalancer" .Values.nginx.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available. NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "common.names.fullname" . }}' You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "invoiceninja.nginx.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "common.names.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "invoiceninja.nginx.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }} echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }} {{- else if contains "ClusterIP" .Values.nginx.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "common.names.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") export SVC_NAME=$(kubectl get svc --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name=nginx,app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") export SVC_PORT=$(kubectl get svc --namespace {{ .Release.Namespace }} $SVC_NAME -o jsonpath="{.spec.ports[0].port}")
echo "Visit http://127.0.0.1:8080 to use your application" echo "Add the line '127.0.0.1 {{ .Values.nginx.ingress.hostname }}' to your hosts file"
kubectl -n {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT echo "Visit http://{{ .Values.nginx.ingress.hostname }} to use your application"
kubectl -n {{ .Release.Namespace }} port-forward svc/$SVC_NAME 80:$SVC_PORT
{{- end }} {{- end }}

View File

@@ -9,7 +9,14 @@ Return the proper image name
Return the proper Docker Image Registry Secret Names Return the proper Docker Image Registry Secret Names
*/}} */}}
{{- define "invoiceninja.imagePullSecrets" -}} {{- define "invoiceninja.imagePullSecrets" -}}
{{- include "common.images.pullSecrets" (dict "images" (list .Values.image ) "global" .Values.global) -}} {{- include "common.images.pullSecrets" (dict "images" (list .Values.image .Values.volumePermissions.image) "global" .Values.global) -}}
{{- end -}}
{{/*
Return the proper image name (for the init container volume-permissions image)
*/}}
{{- define "invoiceninja.volumePermissions.image" -}}
{{ include "common.images.image" (dict "imageRoot" .Values.volumePermissions.image "global" .Values.global) }}
{{- end -}} {{- end -}}
{{/* {{/*
@@ -52,14 +59,14 @@ Create the name of the service account to use
Return the proper Storage Class Return the proper Storage Class
*/}} */}}
{{- define "invoiceninja.public.storageClass" -}} {{- define "invoiceninja.public.storageClass" -}}
{{- include "common.storage.class" (dict "persistence" .Values.persistence "global" .Values.global) -}} {{- include "common.storage.class" (dict "persistence" .Values.persistence.public "global" .Values.global) -}}
{{- end -}} {{- end -}}
{{/* {{/*
Return the proper Storage Class Return the proper Storage Class
*/}} */}}
{{- define "invoiceninja.storage.storageClass" -}} {{- define "invoiceninja.storage.storageClass" -}}
{{- include "common.storage.class" (dict "persistence" .Values.persistence "global" .Values.global) -}} {{- include "common.storage.class" (dict "persistence" .Values.persistence.storage "global" .Values.global) -}}
{{- end -}} {{- end -}}
{{/* {{/*
@@ -221,7 +228,7 @@ Return the Cache Connection Name
{{- end -}} {{- end -}}
{{/* {{/*
Return the Broadcast Driver Name Return the Queue Connection Name
*/}} */}}
{{- define "invoiceninja.redisQueueConnection" -}} {{- define "invoiceninja.redisQueueConnection" -}}
{{- if or (and .Values.redis.enabled .Values.redis.sentinel.enabled) (and .Values.externalRedis.host .Values.externalRedis.sentinel) }} {{- if or (and .Values.redis.enabled .Values.redis.sentinel.enabled) (and .Values.externalRedis.host .Values.externalRedis.sentinel) }}
@@ -230,3 +237,14 @@ Return the Broadcast Driver Name
{{- printf "default" -}} {{- printf "default" -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{/*
Return the Session Connection Name
*/}}
{{- define "invoiceninja.redisSessionConnection" -}}
{{- 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

@@ -13,20 +13,25 @@ metadata:
{{- end }} {{- end }}
data: data:
{{- if .Values.nginx.ingress.enabled }} {{- if .Values.nginx.ingress.enabled }}
APP_URL: "http://{{ .Values.nginx.ingress.hostname }}/" {{- if .Values.nginx.ingress.tls }}
APP_URL: "https://{{ .Values.nginx.ingress.hostname }}"
{{- else }} {{- else }}
APP_URL: "http://{{ include "common.names.fullname" . }}/" APP_URL: "http://{{ .Values.nginx.ingress.hostname }}"
{{- end }}
{{- else }}
APP_URL: "http://{{ include "common.names.fullname" . }}"
{{- end }} {{- end }}
APP_DEBUG: {{ .Values.debug | quote }} APP_DEBUG: {{ .Values.debug | quote }}
DB_HOST1: {{ include "invoiceninja.databaseHost" . | quote }} DB_HOST: {{ include "invoiceninja.databaseHost" . | quote }}
DB_PORT1: {{ include "invoiceninja.databasePort" . | quote }} DB_PORT: {{ include "invoiceninja.databasePort" . | quote }}
DB_USERNAME1: {{ include "invoiceninja.databaseUser" . | quote }} DB_USERNAME: {{ include "invoiceninja.databaseUser" . | quote }}
DB_DATABASE1: {{ include "invoiceninja.databaseName" . | quote }} DB_DATABASE: {{ include "invoiceninja.databaseName" . | quote }}
{{- if .Values.logChannel }} {{- if .Values.logChannel }}
LOG_CHANNEL: {{ .Values.logChannel | quote }} LOG_CHANNEL: {{ .Values.logChannel | quote }}
{{- else }} {{- else }}
LOG_CHANNEL: stderr LOG_CHANNEL: stderr
{{- end }} {{- end }}
MAIL_MAILER: {{ .Values.mailer | quote }}
{{- if .Values.broadcastDriver }} {{- if .Values.broadcastDriver }}
BROADCAST_DRIVER: {{ .Values.broadcastDriver | quote }} BROADCAST_DRIVER: {{ .Values.broadcastDriver | quote }}
{{- else if or .Values.redis.enabled .Values.externalRedis.host }} {{- else if or .Values.redis.enabled .Values.externalRedis.host }}
@@ -55,3 +60,6 @@ data:
REDIS_BROADCAST_CONNECTION: {{ include "invoiceninja.redisBroadcastConnection" . | quote }} REDIS_BROADCAST_CONNECTION: {{ include "invoiceninja.redisBroadcastConnection" . | quote }}
REDIS_CACHE_CONNECTION: {{ include "invoiceninja.redisCacheConnection" . | quote }} REDIS_CACHE_CONNECTION: {{ include "invoiceninja.redisCacheConnection" . | quote }}
REDIS_QUEUE_CONNECTION: {{ include "invoiceninja.redisQueueConnection" . | quote }} REDIS_QUEUE_CONNECTION: {{ include "invoiceninja.redisQueueConnection" . | quote }}
SESSION_CONNECTION: {{ include "invoiceninja.redisSessionConnection" . | quote }}
REQUIRE_HTTPS: {{ .Values.requireHttps | quote }}
TRUSTED_PROXIES: {{ .Values.trustedProxies | quote }}

View File

@@ -63,12 +63,14 @@ spec:
- -cx - -cx
- | - |
COUNTER=0; COUNTER=0;
while [ $COUNTER -lt 120 ]; do [[ -z "${DB_HOST1}" ]] || DB_HOST="${DB_HOST1}";
if mysqladmin ping -h "$DB_HOST1" -P $DB_PORT1 --silent; then [[ -z "${DB_PORT1}" ]] || DB_PORT="${DB_PORT1}";
while [ $COUNTER -lt 120 ]; do
if mysqladmin ping -h "$DB_HOST" -P $DB_PORT --silent; then
exit 0; exit 0;
fi; fi;
let COUNTER=COUNTER+1; let COUNTER=COUNTER+1;
echo "Waiting for DB ($DB_HOST1:$DB_PORT1)" echo "Waiting for DB... Trying again in 2s";
sleep 2; sleep 2;
done; done;
echo "Did NOT see a database after 240 secs!"; echo "Did NOT see a database after 240 secs!";
@@ -81,6 +83,38 @@ spec:
envFrom: envFrom:
- configMapRef: - configMapRef:
name: {{ include "common.names.fullname" . }} name: {{ include "common.names.fullname" . }}
{{- if .Values.extraEnvVarsCM }}
- configMapRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsCM "context" $) }}
{{- end }}
{{- if .Values.extraEnvVarsSecret }}
- secretRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsSecret "context" $) }}
{{- end }}
env:
{{- if .Values.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
{{- if and .Values.podSecurityContext .Values.volumePermissions.enabled (or .Values.persistence.public.enabled .Values.persistence.storage.enabled) }}
- name: volume-permissions
image: {{ include "invoiceninja.volumePermissions.image" . }}
imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }}
command:
- /bin/bash
- -ec
- |
chown -R {{ .Values.containerSecurityContext.runAsUser }}:{{ .Values.podSecurityContext.fsGroup }} /var/www/app/{public,storage}
securityContext:
runAsUser: 0
{{- if .Values.volumePermissions.resources }}
resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }}
{{- end }}
volumeMounts:
- mountPath: /var/www/app/public
name: public
- mountPath: /var/www/app/storage
name: storage
{{- end }}
{{- if .Values.initContainers }} {{- if .Values.initContainers }}
{{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }} {{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }}
{{- end }} {{- end }}
@@ -128,18 +162,22 @@ spec:
name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsSecret "context" $) }} name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsSecret "context" $) }}
{{- end }} {{- end }}
env: env:
- name: DB_PASSWORD1 - name: DB_PASSWORD
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: {{ include "invoiceninja.databaseSecretName" . }} name: {{ include "invoiceninja.databaseSecretName" . }}
key: mariadb-password key: mariadb-password
{{- if not (and .Values.redis.enabled (not .Values.redis.usePassword)) }} {{- if or (and .Values.redis.enabled .Values.redis.usePassword) (or .Values.externalRedis.password .Values.externalRedis.existingSecret) }}
- name: REDIS_PASSWORD - name: REDIS_PASSWORD
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: {{ include "invoiceninja.redisSecretName" . }} name: {{ include "invoiceninja.redisSecretName" . }}
key: redis-password key: redis-password
{{- end }} {{- end }}
{{- if .Values.userEmail }}
- name: IN_USER_EMAIL
value: {{ .Values.userEmail | quote }}
{{- end }}
{{- if .Values.extraEnvVars }} {{- if .Values.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }} {{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }}
{{- end }} {{- end }}

View File

@@ -57,4 +57,7 @@ data:
APP_KEY: {{ .Values.appKey | b64enc | quote }} APP_KEY: {{ .Values.appKey | b64enc | quote }}
{{- else }} {{- else }}
APP_KEY: {{ randAlphaNum 32 | b64enc | quote }} APP_KEY: {{ randAlphaNum 32 | b64enc | quote }}
{{- end }} {{- end }}
{{- if .Values.userPassword }}
IN_PASSWORD: {{ .Values.userPassword | b64enc | quote }}
{{- end }}

View File

@@ -12,13 +12,13 @@
# - myRegistryKeySecretName # - myRegistryKeySecretName
# storageClass: myStorageClass # storageClass: myStorageClass
## Invoiceninja image version ## Invoice Ninja image version
## ref: https://github.com/invoiceninja/dockerfiles ## ref: https://github.com/invoiceninja/dockerfiles
## ##
image: image:
registry: docker.io registry: docker.io
repository: invoiceninja/invoiceninja repository: invoiceninja/invoiceninja
tag: 5.1.35 tag: 5.1.64
## 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
## ##
@@ -30,7 +30,7 @@ image:
# pullSecrets: # pullSecrets:
# - myRegistryKeySecretName # - myRegistryKeySecretName
## String to turn on debug mode in Invoiceninja ## String to turn on debug mode in Invoice Ninja
## ##
debug: false debug: false
@@ -38,6 +38,16 @@ debug: false
## ##
appKey: "" appKey: ""
## Email of user to create first run
## If not specified, default user email will be "admin@example.com"
##
userEmail: ""
## Password of user to create on first run
## If not specified, default user password will be "changeme!"
##
userPassword: ""
## Name of log channel to use ## Name of log channel to use
## ##
logChannel: "" logChannel: ""
@@ -58,10 +68,24 @@ sessionDriver: ""
## ##
queueConnection: "" queueConnection: ""
## List of trusted proxies for Invoice Ninja to communicate with the nginx proxy
##
trustedProxies: "*"
## Use local or Phantom JS PDF generation ## Use local or Phantom JS PDF generation
## ##
snappdf: true snappdf: true
## Name of queue connection to use (use "log" for debug)
## Please check the ref below for any other env you may need to define
## ref: https://github.com/invoiceninja/invoiceninja/blob/v5-stable/config/mail.php
##
mailer: log
## Force HTTPS for all connections to Invoice Ninja
##
requireHttps: false
## String to partially override fullname template (will maintain the release name) ## String to partially override fullname template (will maintain the release name)
## ##
# nameOverride: # nameOverride:
@@ -165,11 +189,29 @@ containerSecurityContext:
# - ALL # - ALL
# readOnlyRootFilesystem: true # readOnlyRootFilesystem: true
## Init containers parameters:
## volumePermissions: Change the owner and group of the persistent volume mountpoint to runAsUser:fsGroup values from the securityContext section.
##
volumePermissions:
enabled: false
image:
registry: docker.io
repository: bitnami/bitnami-shell
tag: "10"
pullPolicy: Always
## Optionally specify an array of imagePullSecrets.
## Secrets must be manually created in the namespace.
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
##
# pullSecrets:
# - myRegistryKeySecretName
resources: {}
## Number of replicas (requires ReadWriteMany PVC support) ## Number of replicas (requires ReadWriteMany PVC support)
## ##
replicaCount: 1 replicaCount: 1
## Set up update strategy for Invoiceninja installation. Set to Recreate if you use persistent volume that cannot be mounted by more than one pods to makesure the pods is destroyed first. ## Set up update strategy for Invoice Ninja installation. Set to Recreate if you use persistent volume that cannot be mounted by more than one pods to makesure the pods is destroyed first.
## ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy ## ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy
## Example: ## Example:
## updateStrategy: ## updateStrategy:
@@ -247,7 +289,7 @@ service:
annotations: {} annotations: {}
## Configure extra options for liveness and readiness probes ## Configure extra options for liveness and readiness probes
## This applies to all the Invoiceninja in the sharded cluster ## This applies to all the Invoice Ninja in the sharded cluster
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes) ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes)
## ##
livenessProbe: livenessProbe:
@@ -286,7 +328,7 @@ resources:
persistence: persistence:
public: public:
enabled: true enabled: true
## Invoiceninja data Persistent Volume Storage Class ## Invoice Ninja data Persistent Volume Storage Class
## If defined, storageClassName: <storageClass> ## If defined, storageClassName: <storageClass>
## If set to "-", storageClassName: "", which disables dynamic provisioning ## If set to "-", storageClassName: "", which disables dynamic provisioning
## If undefined (the default) or set to null, no storageClassName spec is ## If undefined (the default) or set to null, no storageClassName spec is
@@ -305,7 +347,7 @@ persistence:
dataSource: {} dataSource: {}
storage: storage:
enabled: true enabled: true
## Invoiceninja data Persistent Volume Storage Class ## Invoice Ninja data Persistent Volume Storage Class
## If defined, storageClassName: <storageClass> ## If defined, storageClassName: <storageClass>
## If set to "-", storageClassName: "", which disables dynamic provisioning ## If set to "-", storageClassName: "", which disables dynamic provisioning
## If undefined (the default) or set to null, no storageClassName spec is ## If undefined (the default) or set to null, no storageClassName spec is
@@ -335,7 +377,6 @@ autoscaling:
## ##
redis: redis:
enabled: true enabled: true
usePassword: false
sentinel: sentinel:
enabled: true enabled: true
usePassword: false usePassword: false
@@ -395,7 +436,7 @@ externalDatabase:
## Database host ## Database host
## ##
host: "" host: ""
## non-root Username for Invoiceninja Database ## non-root Username for Invoice Ninja Database
## ##
user: invoiceninja user: invoiceninja
## Database password ## Database password
@@ -422,13 +463,13 @@ nginx:
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types
## ##
type: ClusterIP type: ClusterIP
## Configure the ingress resource that allows you to access the Invoiceninja ## Configure the ingress resource that allows you to access the Invoice Ninja
## ref: http://kubernetes.io/docs/user-guide/ingress/ ## ref: http://kubernetes.io/docs/user-guide/ingress/
## ##
ingress: ingress:
enabled: true enabled: true
hostname: invoiceninja.local hostname: invoiceninja.local
## Configure the serverblock for Invoiceninja ## Configure the serverblock for Invoice Ninja
## Note: you may need to replace the fastcgi_pass value if the release name is different ## Note: you may need to replace the fastcgi_pass value if the release name is different
## ##
serverBlock: | serverBlock: |
@@ -457,7 +498,7 @@ nginx:
fastcgi_buffers 4 16k; fastcgi_buffers 4 16k;
} }
} }
## Configure the extraVolumes and extraVolumeMounts for Invoiceninja ## Configure the extraVolumes and extraVolumeMounts for Invoice Ninja
## Note: you may need to replace the claimName if the release name is different ## Note: you may need to replace the claimName if the release name is different
## ##
extraVolumes: extraVolumes:

View File

@@ -2,6 +2,8 @@ server {
listen 80 default_server; listen 80 default_server;
server_name _; server_name _;
client_max_body_size 100M;
root /var/www/app/public/; root /var/www/app/public/;
index index.php; index index.php;

53
env
View File

@@ -1,26 +1,41 @@
APP_URL=http://in.localhost:8003/ # IN application vars
APP_URL=http://in.localhost:8003
APP_KEY=<insert your generated key in here> APP_KEY=<insert your generated key in here>
APP_DEBUG=true APP_DEBUG=true
MULTI_DB_ENABLED=false REQUIRE_HTTPS=false
DB_HOST1=db PHANTOMJS_PDF_GENERATION=false
DB_PORT1=3306 QUEUE_CONNECTION=database
DB_USERNAME1=ninja
DB_PASSWORD1=ninja # DB connection
DB_DATABASE1=ninja DB_HOST=db
DB_PORT=3306
DB_DATABASE=ninja
DB_USERNAME=ninja
DB_PASSWORD=ninja
# Create initial user
# Default to these values if empty
# IN_USER_EMAIL=admin@example.com
# IN_PASSWORD=changeme!
IN_USER_EMAIL=
IN_PASSWORD=
# Mail options
MAIL_MAILER=log
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS='user@example.com'
MAIL_FROM_NAME='Self Hosted User'
# MySQL
MYSQL_ROOT_PASSWORD=ninjaAdm1nPassword MYSQL_ROOT_PASSWORD=ninjaAdm1nPassword
MYSQL_USER=ninja MYSQL_USER=ninja
MYSQL_PASSWORD=ninja MYSQL_PASSWORD=ninja
MYSQL_DATABASE=ninja MYSQL_DATABASE=ninja
#this is a system variable please do not remove # V4 env vars
IS_DOCKER=true # DB_STRICT=false
# APP_CIPHER=AES-256-CBC
PHANTOMJS_PDF_GENERATION=false
#V4 env vars
DB_STRICT=false
DB_HOST=db
DB_DATABASE=ninja
DB_USERNAME=ninja
DB_PASSWORD=ninja
APP_CIPHER=AES-256-CBC