initial work invoice-ninja (needs mysql)

This commit is contained in:
Stavros kois
2023-07-31 18:17:29 +03:00
parent 02538c13e4
commit 67c1b2e513
21 changed files with 614 additions and 0 deletions
@@ -0,0 +1,28 @@
name: invoice-ninja
description: Readarr is an ebook and audiobook collection manager for Usenet and BitTorrent
users.
annotations:
title: Invoice Ninja
type: application
version: 1.0.7
apiVersion: v2
appVersion: 0.3.0.2091
kubeVersion: '>=1.16.0-0'
maintainers:
- name: truenas
url: https://www.truenas.com/
email: dev@ixsystems.com
dependencies:
- name: common
repository: file://../../../common
version: 1.0.12
home: https://github.com/Readarr/Readarr
icon: https://raw.githubusercontent.com/Readarr/Readarr/develop/Logo/256.png
sources:
- https://github.com/onedr0p/containers/tree/main/apps/readarr
- https://github.com/truenas/charts/tree/master/library/ix-dev/community/readarr
- https://github.com/Readarr/Readarr
keywords:
- media
- ebook
- audiobook
@@ -0,0 +1,8 @@
# Readarr
[Readarr](https://github.com/Readarr/Readarr) is an ebook and audiobook collection manager for Usenet and BitTorrent users.
> When application is installed, a container will be launched with **root** privileges.
> This is required in order to apply the correct permissions to the `Readarr` directories.
> Afterward, the `Readarr` container will run as a **non**-root user (Default: `568`).
> All mounted storage(s) will be `chown`ed only if the parent directory does not match the configured user.
@@ -0,0 +1,8 @@
# Readarr
[Readarr](https://github.com/Readarr/Readarr) is an ebook and audiobook collection manager for Usenet and BitTorrent users.
> When application is installed, a container will be launched with **root** privileges.
> This is required in order to apply the correct permissions to the `Readarr` directories.
> Afterward, the `Readarr` container will run as a **non**-root user (Default: `568`).
> All mounted storage(s) will be `chown`ed only if the parent directory does not match the configured user.
@@ -0,0 +1,11 @@
readarrNetwork:
webPort: 31000
readarrRunAs:
user: 1000
group: 1000
readarrStorage:
config:
type: hostPath
hostPath: /mnt/{{ .Release.Namespace }}/config
@@ -0,0 +1,21 @@
readarrConfig:
additionalEnvs:
- name: READARR__API_KEY
value: some-long-api-key
- name: READARR__LOG_LEVEL
value: error
readarrNetwork:
webPort: 31000
readarrStorage:
config:
type: hostPath
hostPath: /mnt/{{ .Release.Namespace }}/config
additionalStorages:
- type: hostPath
hostPath: /mnt/{{ .Release.Namespace }}/pop_music
mountPath: /pop_music
- type: hostPath
hostPath: /mnt/{{ .Release.Namespace }}/country_music
mountPath: /country_music
@@ -0,0 +1,8 @@
readarrNetwork:
webPort: 30000
hostNetwork: true
readarrStorage:
config:
type: hostPath
hostPath: /mnt/{{ .Release.Namespace }}/config
@@ -0,0 +1,10 @@
icon_url: https://raw.githubusercontent.com/Readarr/Readarr/develop/Logo/256.png
categories:
- media
screenshots:
- https://readarr.com/img/features/manualsearch.png
- https://readarr.com/img/features/calibre.png
- https://readarr.com/img/features/calendar.png
tags:
- ebook
- audiobook
@@ -0,0 +1,8 @@
runAsContext:
- userName: readarr
groupName: readarr
gid: 568
uid: 568
description: Readarr can run as any non-root user.
capabilities: []
hostMounts: []
@@ -0,0 +1,240 @@
# groups:
# - name: Readarr Configuration
# description: Configure Readarr
# - name: User and Group Configuration
# description: Configure User and Group for Readarr
# - name: Network Configuration
# description: Configure Network for Readarr
# - name: Storage Configuration
# description: Configure Storage for Readarr
# - name: Resources Configuration
# description: Configure Resources for Readarr
# portals:
# web_portal:
# protocols:
# - "$kubernetes-resource_configmap_portal_protocol"
# host:
# - "$kubernetes-resource_configmap_portal_host"
# ports:
# - "$kubernetes-resource_configmap_portal_port"
# path: "$kubernetes-resource_configmap_portal_path"
# questions:
# - variable: readarrConfig
# label: ""
# group: Readarr Configuration
# schema:
# type: dict
# attrs:
# - variable: instanceName
# label: Instance Name
# description: The name of the Readarr instance.
# schema:
# type: string
# default: "Readarr"
# required: true
# - variable: additionalEnvs
# label: Additional Environment Variables
# description: Configure additional environment variables for Readarr.
# schema:
# type: list
# default: []
# items:
# - variable: env
# label: Environment Variable
# schema:
# type: dict
# attrs:
# - variable: name
# label: Name
# schema:
# type: string
# required: true
# - variable: value
# label: Value
# schema:
# type: string
# required: true
# - variable: readarrRunAs
# label: ""
# group: User and Group Configuration
# schema:
# type: dict
# attrs:
# - variable: user
# label: User ID
# description: The user id that Readarr will run as.
# schema:
# type: int
# min: 2
# default: 568
# required: true
# - variable: group
# label: Group ID
# description: The group id that Readarr will run as.
# schema:
# type: int
# min: 2
# default: 568
# required: true
# - variable: readarrNetwork
# label: ""
# group: Network Configuration
# schema:
# type: dict
# attrs:
# - variable: webPort
# label: Web Port
# description: The port for the Readarr Web UI.
# schema:
# type: int
# default: 30045
# min: 9000
# max: 65535
# required: true
# - variable: hostNetwork
# label: Host Network
# description: |
# Bind to the host network. It's recommended to keep this disabled.</br>
# schema:
# type: boolean
# default: false
# - variable: readarrStorage
# label: ""
# group: Storage Configuration
# schema:
# type: dict
# attrs:
# - variable: config
# label: Readarr Config Storage
# description: The path to store Readarr Configuration.
# schema:
# type: dict
# attrs:
# - variable: type
# label: Type
# description: |
# ixVolume: Is dataset created automatically by the system.</br>
# Host Path: Is a path that already exists on the system.
# schema:
# type: string
# required: true
# default: "ixVolume"
# enum:
# - value: "hostPath"
# description: Host Path (Path that already exists on the system)
# - value: "ixVolume"
# description: ixVolume (Dataset created automatically by the system)
# - variable: datasetName
# label: Dataset Name
# schema:
# type: string
# show_if: [["type", "=", "ixVolume"]]
# required: true
# hidden: true
# immutable: true
# default: "config"
# $ref:
# - "normalize/ixVolume"
# - variable: hostPath
# label: Host Path
# schema:
# type: hostpath
# show_if: [["type", "=", "hostPath"]]
# immutable: true
# required: true
# - variable: additionalStorages
# label: Additional Storage
# description: Additional storage for Readarr.
# schema:
# type: list
# default: []
# items:
# - variable: storageEntry
# label: Storage Entry
# schema:
# type: dict
# attrs:
# - variable: type
# label: Type
# description: |
# ixVolume: Is dataset created automatically by the system.</br>
# Host Path: Is a path that already exists on the system.
# schema:
# type: string
# required: true
# default: "ixVolume"
# enum:
# - value: "hostPath"
# description: Host Path (Path that already exists on the system)
# - value: "ixVolume"
# description: ixVolume (Dataset created automatically by the system)
# - variable: mountPath
# label: Mount Path
# description: The path inside the container to mount the storage.
# schema:
# type: path
# required: true
# - variable: hostPath
# label: Host Path
# description: The host path to use for storage.
# schema:
# type: hostpath
# show_if: [["type", "=", "hostPath"]]
# required: true
# - variable: datasetName
# label: Dataset Name
# description: The name of the dataset to use for storage.
# schema:
# type: string
# show_if: [["type", "=", "ixVolume"]]
# required: true
# immutable: true
# default: "storage_entry"
# $ref:
# - "normalize/ixVolume"
# - variable: resources
# group: Resources Configuration
# label: ""
# schema:
# type: dict
# attrs:
# - variable: limits
# label: Limits
# schema:
# type: dict
# attrs:
# - variable: cpu
# label: CPU
# description: CPU limit for Readarr.
# schema:
# type: string
# max_length: 6
# valid_chars: '^(0\.[1-9]|[1-9][0-9]*)(\.[0-9]|m?)$'
# valid_chars_error: |
# Valid CPU limit formats are</br>
# - Plain Integer - eg. 1</br>
# - Float - eg. 0.5</br>
# - Milicpu - eg. 500m
# default: "4000m"
# required: true
# - variable: memory
# label: Memory
# description: Memory limit for Readarr.
# schema:
# type: string
# max_length: 12
# valid_chars: '^[1-9][0-9]*([EPTGMK]i?|e[0-9]+)?$'
# valid_chars_error: |
# Valid Memory limit formats are</br>
# - Suffixed with E/P/T/G/M/K - eg. 1G</br>
# - Suffixed with Ei/Pi/Ti/Gi/Mi/Ki - eg. 1Gi</br>
# - Plain Integer in bytes - eg. 1024</br>
# - Exponent - eg. 134e6
# default: "8Gi"
# required: true
@@ -0,0 +1 @@
{{ include "ix.v1.common.lib.chart.notes" $ }}
@@ -0,0 +1,35 @@
{{- define "ninja.configmap" -}}
configmap:
nginx-config:
enabled: true
data:
nginx.conf: |
server {
listen {{ .Values.ninjaNetwork.webPort }} 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 "ix.v1.common.lib.chart.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;
}
}
ninja:
enabled: true
data:
DB_TYPE:
{{- end -}}
@@ -0,0 +1,50 @@
{{- define "ninja.workload" -}}
workload:
ninja:
enabled: true
primary: true
type: Deployment
podSpec:
securityContext:
fsGroup: 1500
hostNetwork: {{ .Values.ninjaNetwork.hostNetwork }}
containers:
ninja:
enabled: true
primary: true
imageSelector: image
securityContext:
runAsUser: 1500
runAsGroup: 1500
env:
APP_ENV: production
envFrom:
- secretRef:
name: ninja-creds
{{ with .Values.ninjaConfig.additionalEnvs }}
envList:
{{ range $env := . }}
- name: {{ $env.name }}
value: {{ $env.value }}
{{ end }}
{{ end }}
probes:
liveness:
enabled: true
type: tcp
port: 9000
readiness:
enabled: true
type: tcp
port: 9000
startup:
enabled: true
type: tcp
port: 9000
initContainers:
{{- include "ix.v1.common.app.permissions" (dict "containerName" "01-permissions"
"UID" 1500
"GID" 1500
"mode" "check"
"type" "init") | nindent 8 }}
{{- end -}}
@@ -0,0 +1,32 @@
{{- define "ninja.workload" -}}
workload:
nginx:
enabled: true
type: Deployment
podSpec:
securityContext:
fsGroup: 1500
hostNetwork: {{ .Values.ninjaNetwork.hostNetwork }}
containers:
nginx:
enabled: true
primary: true
imageSelector: image
securityContext:
runAsUser: 1500
runAsGroup: 1500
probes:
liveness:
enabled: true
type: tcp
port: {{ .Values.ninjaNetwork.webPort }}
readiness:
enabled: true
type: tcp
port: {{ .Values.ninjaNetwork.webPort }}
startup:
enabled: true
type: tcp
port: {{ .Values.ninjaNetwork.webPort }}
# initContainer: # TODO: wait for ninja
{{- end -}}
@@ -0,0 +1,45 @@
{{- define "ninja.persistence" -}}
persistence:
public:
enabled: true
type: {{ .Values.ninjaStorage.public.type }}
datasetName: {{ .Values.ninjaStorage.public.datasetName | default "" }}
hostPath: {{ .Values.ninjaStorage.public.hostPath | default "" }}
targetSelector:
ninja:
readarr:
mountPath: /var/www/app/public
01-permissions:
mountPath: /mnt/directories/public
storage:
enabled: true
type: {{ .Values.ninjaStorage.storage.type }}
datasetName: {{ .Values.ninjaStorage.storage.datasetName | default "" }}
hostPath: {{ .Values.ninjaStorage.storage.hostPath | default "" }}
targetSelector:
ninja:
readarr:
mountPath: /var/www/app/storage
01-permissions:
mountPath: /mnt/directories/storage
tmp:
enabled: true
type: emptyDir
targetSelector:
readarr:
readarr:
mountPath: /tmp
{{- range $idx, $storage := .Values.readarrStorage.additionalStorages }}
{{ printf "readarr-%v" (int $idx) }}:
enabled: true
type: {{ $storage.type }}
datasetName: {{ $storage.datasetName | default "" }}
hostPath: {{ $storage.hostPath | default "" }}
targetSelector:
readarr:
readarr:
mountPath: {{ $storage.mountPath }}
01-permissions:
mountPath: /mnt/directories{{ $storage.mountPath }}
{{- end }}
{{- end -}}
@@ -0,0 +1,12 @@
{{- define "ninja.portal" -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: portal
data:
path: "/"
port: {{ .Values.ninjaNetwork.webPort | quote }}
protocol: http
host: $node_ip
{{- end -}}
@@ -0,0 +1,13 @@
{{- define "ninja.secret" -}}
{{- $fullname := (include "ix.v1.common.lib.chart.names.fullname" $) -}}
{{- $appKey := randAlphaNum 32 -}}
{{- with (lookup "v1" "Secret" .Release.Namespace (printf "%s-ninja-creds" $fullname)) -}}
{{- $appKey = ((index .data "APP_KEY") | b64dec) -}}
{{- end }}
secret:
ninja-creds:
enabled: true
data:
APP_KEY: {{ $appKey }}
{{- end -}}
@@ -0,0 +1,15 @@
{{- define "ninja.service" -}}
service:
readarr:
enabled: true
primary: true
type: NodePort
targetSelector: readarr
ports:
webui:
enabled: true
primary: true
port: {{ .Values.readarrNetwork.webPort }}
nodePort: {{ .Values.readarrNetwork.webPort }}
targetSelector: readarr
{{- end -}}
@@ -0,0 +1,14 @@
{{- include "ix.v1.common.loader.init" . -}}
{{/* Merge the templates with Values */}}
{{- $_ := mustMergeOverwrite .Values (include "ninja.secret" $ | fromYaml) -}}
{{- $_ := mustMergeOverwrite .Values (include "ninja.configmap" $ | fromYaml) -}}
{{- $_ := mustMergeOverwrite .Values (include "ninja.workload" $ | fromYaml) -}}
{{- $_ := mustMergeOverwrite .Values (include "ninja.nginx" $ | fromYaml) -}}
{{- $_ := mustMergeOverwrite .Values (include "ninja.service" $ | fromYaml) -}}
{{- $_ := mustMergeOverwrite .Values (include "ninja.persistence" $ | fromYaml) -}}
{{/* Create the configmap for portal manually*/}}
{{- include "ninja.portal" $ -}}
{{- include "ix.v1.common.loader.apply" . -}}
@@ -0,0 +1 @@
{"filename": "values.yaml", "keys": ["image"]}
+31
View File
@@ -0,0 +1,31 @@
#!/usr/bin/python3
import json
import re
import sys
from catalog_update.upgrade_strategy import semantic_versioning
RE_STABLE_VERSION = re.compile(r'\d+\.\d+\.\d+')
def newer_mapping(image_tags):
key = list(image_tags.keys())[0]
tags = {t: t for t in image_tags[key] if RE_STABLE_VERSION.fullmatch(t)}
version = semantic_versioning(list(tags))
if not version:
return {}
return {
'tags': {key: tags[version]},
'app_version': version,
}
if __name__ == '__main__':
try:
versions_json = json.loads(sys.stdin.read())
except ValueError:
raise ValueError('Invalid json specified')
print(json.dumps(newer_mapping(versions_json)))
@@ -0,0 +1,23 @@
image:
repository: invoiceninja/invoiceninja
pullPolicy: IfNotPresent
tag: 5.6.23
resources:
limits:
cpu: 4000m
memory: 8Gi
ninjaConfig:
additionalEnvs: []
ninjaNetwork:
webPort: 30045
hostNetwork: false
# ninjaRunAs:
# user: 568
# group: 568
# ninjaStorage:
# config:
# type: ixVolume
# datasetName: config
# additionalStorages: []