feat(fireflyiii): add cron support (#1470)
* feat(fireflyiii): add cron support * use curl for cron, add sercet for static cron token * adjust dns name * adjust schedule as per documentation * simplify dns name * make secret auto generated * whoops * actually load the secret * remove whitespace * use alpineImage * autogen remembered sercret APP_KEY * bump minor
This commit is contained in:
@@ -24,7 +24,7 @@ name: fireflyiii
|
|||||||
sources:
|
sources:
|
||||||
- https://github.com/firefly-iii/firefly-iii/
|
- https://github.com/firefly-iii/firefly-iii/
|
||||||
type: application
|
type: application
|
||||||
version: 13.0.10
|
version: 13.1.0
|
||||||
annotations:
|
annotations:
|
||||||
truecharts.org/catagories: |
|
truecharts.org/catagories: |
|
||||||
- finacial
|
- finacial
|
||||||
|
|||||||
@@ -73,7 +73,6 @@ questions:
|
|||||||
- value: "OnDelete"
|
- value: "OnDelete"
|
||||||
description: "(Legacy) OnDelete: ignore .spec.template changes"
|
description: "(Legacy) OnDelete: ignore .spec.template changes"
|
||||||
# Include{controllerExpert}
|
# Include{controllerExpert}
|
||||||
# Docker specific env
|
|
||||||
- variable: env
|
- variable: env
|
||||||
group: "Container Configuration"
|
group: "Container Configuration"
|
||||||
label: "Image Environment"
|
label: "Image Environment"
|
||||||
@@ -81,16 +80,7 @@ questions:
|
|||||||
type: dict
|
type: dict
|
||||||
attrs:
|
attrs:
|
||||||
# Include{fixedEnv}
|
# Include{fixedEnv}
|
||||||
- variable: APP_KEY
|
|
||||||
label: "App Key"
|
|
||||||
description: "Your unique 32 application character key"
|
|
||||||
schema:
|
|
||||||
type: string
|
|
||||||
default: ""
|
|
||||||
min_length: 32
|
|
||||||
max_length: 32
|
|
||||||
valid_chars: '[a-zA-Z0-9!@#$%^&*?]{32}'
|
|
||||||
required: true
|
|
||||||
|
|
||||||
# Include{containerConfig}
|
# Include{containerConfig}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
{{/* Define the cronjob */}}
|
||||||
|
{{- define "fireflyiii.cronjob" -}}
|
||||||
|
{{- $jobName := include "common.names.fullname" . }}
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: batch/v1beta1
|
||||||
|
kind: CronJob
|
||||||
|
metadata:
|
||||||
|
name: {{ printf "%s-cronjob" $jobName }}
|
||||||
|
labels:
|
||||||
|
{{- include "common.labels" . | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
schedule: "{{ .Values.cronjob.schedule }}"
|
||||||
|
concurrencyPolicy: Forbid
|
||||||
|
{{- with .Values.cronjob.failedJobsHistoryLimit }}
|
||||||
|
failedJobsHistoryLimit: {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.cronjob.successfulJobsHistoryLimit }}
|
||||||
|
successfulJobsHistoryLimit: {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
jobTemplate:
|
||||||
|
metadata:
|
||||||
|
spec:
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
spec:
|
||||||
|
restartPolicy: Never
|
||||||
|
containers:
|
||||||
|
- name: {{ .Chart.Name }}
|
||||||
|
image: "{{ .Values.alpineImage.repository }}:{{ .Values.alpineImage.tag }}"
|
||||||
|
imagePullPolicy: {{ default .Values.image.pullPolicy }}
|
||||||
|
args:
|
||||||
|
- curl
|
||||||
|
- "http://{{ $jobName }}.ix-{{ .Release.Name }}.svc.cluster.local:{{ .Values.service.main.ports.main.port }}/api/v1/cron/{{ .Values.env.STATIC_CRON_TOKEN }}"
|
||||||
|
resources:
|
||||||
|
{{ toYaml .Values.resources | indent 16 }}
|
||||||
|
|
||||||
|
{{- end -}}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
{{/* Define the secrets */}}
|
||||||
|
{{- define "fireflyiii.secrets" -}}
|
||||||
|
---
|
||||||
|
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
type: Opaque
|
||||||
|
metadata:
|
||||||
|
name: fireflyiii-secrets
|
||||||
|
{{- $fireflyiiiprevious := lookup "v1" "Secret" .Release.Namespace "fireflyiii-secrets" }}
|
||||||
|
{{- $static_cron_token := "" }}
|
||||||
|
{{- $app_key := "" }}
|
||||||
|
data:
|
||||||
|
{{- if $fireflyiiiprevious}}
|
||||||
|
STATIC_CRON_TOKEN: {{ index $fireflyiiiprevious.data "STATIC_CRON_TOKEN" }}
|
||||||
|
APP_KEY: {{ index $fireflyiiiprevious.data "APP_KEY" }}
|
||||||
|
{{- else }}
|
||||||
|
{{- $static_cron_token := randAlphaNum 32 }}
|
||||||
|
{{- $app_key := randAlphaNum 32 }}
|
||||||
|
STATIC_CRON_TOKEN: {{ $static_cron_token | b64enc | quote }}
|
||||||
|
APP_KEY: {{ $static_cron_token | b64enc | quote }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- end -}}
|
||||||
@@ -1,5 +1,11 @@
|
|||||||
{{/* Make sure all variables are set properly */}}
|
{{/* Make sure all variables are set properly */}}
|
||||||
{{- include "common.setup" . }}
|
{{- include "common.setup" . }}
|
||||||
|
|
||||||
|
{{/* Render secrets for fireflyiii */}}
|
||||||
|
{{- include "fireflyiii.secrets" . }}
|
||||||
|
|
||||||
|
{{/* Render cronjob for fireflyiii */}}
|
||||||
|
{{- include "fireflyiii.cronjob" . }}
|
||||||
|
|
||||||
{{/* Render the templates */}}
|
{{/* Render the templates */}}
|
||||||
{{ include "common.postSetup" . }}
|
{{ include "common.postSetup" . }}
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ env:
|
|||||||
DB_DATABASE: firefly
|
DB_DATABASE: firefly
|
||||||
DB_CONNECTION: pgsql
|
DB_CONNECTION: pgsql
|
||||||
DB_PORT: 5432
|
DB_PORT: 5432
|
||||||
APP_KEY: AGcfkCUS233ZWmBXztYbdyCs2u7kkz55
|
|
||||||
|
|
||||||
envValueFrom:
|
envValueFrom:
|
||||||
DB_HOST:
|
DB_HOST:
|
||||||
@@ -44,12 +43,25 @@ envValueFrom:
|
|||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: dbcreds
|
name: dbcreds
|
||||||
key: postgresql-password
|
key: postgresql-password
|
||||||
|
STATIC_CRON_TOKEN:
|
||||||
|
secretKeyRef:
|
||||||
|
name: fireflyiii-secrets
|
||||||
|
key: STATIC_CRON_TOKEN
|
||||||
|
APP_KEY:
|
||||||
|
secretKeyRef:
|
||||||
|
name: fireflyiii-secrets
|
||||||
|
key: APP_KEY
|
||||||
|
|
||||||
persistence:
|
persistence:
|
||||||
data:
|
data:
|
||||||
enabled: true
|
enabled: true
|
||||||
mountPath: "/var/www/html/storage/upload"
|
mountPath: "/var/www/html/storage/upload"
|
||||||
|
|
||||||
|
cronjob:
|
||||||
|
schedule: "0 3 * * *"
|
||||||
|
annotations: {}
|
||||||
|
failedJobsHistoryLimit: 5
|
||||||
|
successfulJobsHistoryLimit: 2
|
||||||
|
|
||||||
# Enabled postgres
|
# Enabled postgres
|
||||||
postgresql:
|
postgresql:
|
||||||
|
|||||||
Reference in New Issue
Block a user