feat(linkace): Add linkace (#1886)

* feat(linkace): Add linkace

* use correct secrets

* add hardcoded values

* whoops

* typo

* add init container

* render secrets earlier?

* debug

* tryout

* whats going on

* try moving nginx conf

* fastcgi filename changed?

* localhost

* perms

* try with rofs

* Create env file on the correct dir

* fix paths and update questions

* actually use app_key

* Add conditional cron

* update gui

* whoops

* update image
This commit is contained in:
Stavros Kois
2022-02-13 13:08:40 +01:00
committed by GitHub
parent 38cb7229ed
commit ea02662485
10 changed files with 860 additions and 1 deletions
+35
View File
@@ -0,0 +1,35 @@
apiVersion: v2
appVersion: "v1.9.1"
dependencies:
- name: common
repository: https://truecharts.org
version: 8.15.2
- condition: mariadb.enabled
name: mariadb
repository: https://truecharts.org/
version: 1.0.68
- condition: redis.enabled
name: redis
repository: https://truecharts.org
version: 1.0.71
description: Your self-hosted bookmark archive. Free and open source.
home: https://github.com/truecharts/apps/tree/master/charts/stable/linkace
icon: https://truecharts.org/_static/img/appicons/linkace-icon.png
keywords:
- linkace
kubeVersion: '>=1.16.0-0'
maintainers:
- email: info@truecharts.org
name: TrueCharts
url: https://truecharts.org
name: linkace
sources:
- https://www.linkace.org/docs/
- https://github.com/linkace/linkace
- https://hub.docker.com/r/linkace/linkace
version: 0.0.1
annotations:
truecharts.org/catagories: |
- media
truecharts.org/SCALE-support: "true"
truecharts.org/grade: U
+535
View File
@@ -0,0 +1,535 @@
# Include{groups}
portals:
web_portal:
protocols:
- "$kubernetes-resource_configmap_portal_protocol"
host:
- "$kubernetes-resource_configmap_portal_host"
ports:
- "$kubernetes-resource_configmap_portal_port"
questions:
- variable: portal
group: "Container Image"
label: "Configure Portal Button"
schema:
type: dict
hidden: true
attrs:
- variable: enabled
label: "Enable"
description: "enable the portal button"
schema:
hidden: true
editable: false
type: boolean
default: true
# Include{global}
- variable: controller
group: "Controller"
label: ""
schema:
additional_attrs: true
type: dict
attrs:
- variable: advanced
label: "Show Advanced Controller Settings"
schema:
type: boolean
default: false
show_subquestions_if: true
subquestions:
- variable: type
description: "Please specify type of workload to deploy"
label: "(Advanced) Controller Type"
schema:
type: string
default: "deployment"
required: true
enum:
- value: "deployment"
description: "Deployment"
- value: "statefulset"
description: "Statefulset"
- value: "daemonset"
description: "Daemonset"
- variable: replicas
description: "Number of desired pod replicas"
label: "Desired Replicas"
schema:
type: int
default: 1
required: true
- variable: strategy
description: "Please specify type of workload to deploy"
label: "(Advanced) Update Strategy"
schema:
type: string
default: "Recreate"
required: true
enum:
- value: "Recreate"
description: "Recreate: Kill existing pods before creating new ones"
- value: "RollingUpdate"
description: "RollingUpdate: Create new pods and then kill old ones"
- value: "OnDelete"
description: "(Legacy) OnDelete: ignore .spec.template changes"
# Include{controllerExpert}
# Docker specific env
- variable: env
group: "Container Configuration"
label: "Image Environment"
schema:
additional_attrs: true
type: dict
attrs:
# Include{fixedEnv}
- variable: APP_URL
label: "APP_URL"
description: "Application URL eg. https://linkace.mydomain.com"
schema:
type: string
default: "http://localhost"
- variable: APP_DEBUG
label: "APP_DEBUG"
description: "Enables the debug info"
schema:
type: boolean
default: false
- variable: BACKUP_ENABLED
label: "BACKUP_ENABLED"
description: "Enables backups"
schema:
type: boolean
default: false
- variable: BACKUP_DISK
label: "BACKUP_DISK"
description: "Backup destination"
schema:
type: string
default: "local"
enum:
- value: "local"
description: "local"
- value: "s3"
description: "s3"
- variable: BACKUP_MAX_SIZE
label: "BACKUP_MAX_SIZE"
description: "Max size of backup in MB"
schema:
type: int
default: 512
- variable: secret
group: "Container Configuration"
label: "Secret Image Environment"
schema:
additional_attrs: true
type: dict
attrs:
- variable: CRON_TOKEN
label: "CRON_TOKEN (Generate this inside the app)"
description: "Generate token inside the app and come back later to fill this."
schema:
type: string
default: ""
- variable: AWS_ACCESS_KEY_ID
label: "AWS_ACCESS_KEY_ID"
description: "AWS Access Key ID"
schema:
type: string
default: ""
- variable: AWS_SECRET_ACCESS_KEY
label: "AWS_SECRET_ACCESS_KEY"
description: "AWS Secret Access Key"
schema:
type: string
default: ""
- variable: AWS_DEFAULT_REGION
label: "AWS_DEFAULT_REGION"
description: "AWS Default Region"
schema:
type: string
default: ""
- variable: AWS_BUCKET
label: "AWS_BUCKET"
description: "AWS Bucket"
schema:
type: string
default: ""
- variable: MAIL_FROM_ADDRESS
label: "MAIL_FROM_ADDRESS"
description: "Mail from Address"
schema:
type: string
default: ""
- variable: MAIL_FROM_NAME
label: "MAIL_FROM_NAME"
description: "Mail from Name"
schema:
type: string
default: ""
- variable: MAIL_DRIVER
label: "MAIL_DRIVER"
description: "Mail Driver"
schema:
type: string
default: "smtp"
enum:
- value: "smtp"
description: "smtp"
- value: "mailgun"
description: "mailgun"
- value: "sendmail"
description: "sendmail"
- value: "ses"
description: "ses"
- value: "postmark"
description: "postmark"
- value: "log"
description: "log"
- value: "array"
description: "array"
- variable: MAIL_HOST
label: "MAIL_HOST"
description: "Mail Host"
schema:
type: string
default: ""
- variable: MAIL_PORT
label: "MAIL_PORT"
description: "Mail Port"
schema:
type: int
- variable: MAIL_USERNAME
label: "MAIL_USERNAME"
description: "Mail Username"
schema:
type: string
default: ""
- variable: MAIL_PASSWORD
label: "MAIL_PASSWORD"
description: "Mail Password"
schema:
type: string
default: ""
- variable: MAIL_ENCRYPTION
label: "MAIL_ENCRYPTION"
description: "Mail Encryption"
schema:
type: string
default: "tls"
# Include{containerConfig}
- variable: service
group: "Networking and Services"
label: "Configure Service(s)"
schema:
additional_attrs: true
type: dict
attrs:
- variable: main
label: "Main Service"
description: "The Primary service on which the healthcheck runs, often the webUI"
schema:
additional_attrs: true
type: dict
attrs:
# Include{serviceSelector}
- variable: main
label: "Main Service Port Configuration"
schema:
additional_attrs: true
type: dict
attrs:
- variable: port
label: "Port"
description: "This port exposes the container port on the service"
schema:
type: int
default: 10160
required: true
- variable: advanced
label: "Show Advanced settings"
schema:
type: boolean
default: false
show_subquestions_if: true
subquestions:
- variable: protocol
label: "Port Type"
schema:
type: string
default: "HTTP"
enum:
- value: HTTP
description: "HTTP"
- value: "HTTPS"
description: "HTTPS"
- value: TCP
description: "TCP"
- value: "UDP"
description: "UDP"
- variable: nodePort
label: "Node Port (Optional)"
description: "This port gets exposed to the node. Only considered when service type is NodePort, Simple or LoadBalancer"
schema:
type: int
min: 9000
max: 65535
- variable: targetPort
label: "Target Port"
description: "The internal(!) port on the container the Application runs on"
schema:
type: int
default: 80
- variable: serviceexpert
group: "Networking and Services"
label: "Show Expert Config"
schema:
type: boolean
default: false
show_subquestions_if: true
subquestions:
- variable: hostNetwork
group: "Networking and Services"
label: "Host-Networking (Complicated)"
schema:
type: boolean
default: false
# Include{serviceExpert}
# Include{serviceList}
- variable: persistence
label: "Integrated Persistent Storage"
description: "Integrated Persistent Storage"
group: "Storage and Persistence"
schema:
additional_attrs: true
type: dict
attrs:
- variable: app
label: "App Storage"
description: "Stores the Application."
schema:
additional_attrs: true
type: dict
attrs:
- variable: type
label: "Type of Storage"
description: "Sets the persistence type, Anything other than PVC could break rollback!"
schema:
type: string
default: "simplePVC"
enum:
- value: "simplePVC"
description: "PVC (simple)"
- value: "simpleHP"
description: "HostPath (simple)"
- value: "emptyDir"
description: "emptyDir"
- value: "pvc"
description: "pvc"
- value: "hostPath"
description: "hostPath"
# Include{persistenceBasic}
- variable: hostPath
label: "hostPath"
description: "Path inside the container the storage is mounted"
schema:
show_if: [["type", "=", "hostPath"]]
type: hostpath
- variable: medium
label: "EmptyDir Medium"
schema:
show_if: [["type", "=", "emptyDir"]]
type: string
default: ""
enum:
- value: ""
description: "Default"
- value: "Memory"
description: "Memory"
# Include{persistenceAdvanced}
- variable: logs
label: "App Log Storage"
description: "Stores the Application Logs."
schema:
additional_attrs: true
type: dict
attrs:
- variable: type
label: "Type of Storage"
description: "Sets the persistence type, Anything other than PVC could break rollback!"
schema:
type: string
default: "simplePVC"
enum:
- value: "simplePVC"
description: "PVC (simple)"
- value: "simpleHP"
description: "HostPath (simple)"
- value: "emptyDir"
description: "emptyDir"
- value: "pvc"
description: "pvc"
- value: "hostPath"
description: "hostPath"
# Include{persistenceBasic}
- variable: hostPath
label: "hostPath"
description: "Path inside the container the storage is mounted"
schema:
show_if: [["type", "=", "hostPath"]]
type: hostpath
- variable: medium
label: "EmptyDir Medium"
schema:
show_if: [["type", "=", "emptyDir"]]
type: string
default: ""
enum:
- value: ""
description: "Default"
- value: "Memory"
description: "Memory"
# Include{persistenceAdvanced}
- variable: backups
label: "App Backup Storage"
description: "Stores the Application Backup."
schema:
additional_attrs: true
type: dict
attrs:
- variable: type
label: "Type of Storage"
description: "Sets the persistence type, Anything other than PVC could break rollback!"
schema:
type: string
default: "simplePVC"
enum:
- value: "simplePVC"
description: "PVC (simple)"
- value: "simpleHP"
description: "HostPath (simple)"
- value: "emptyDir"
description: "emptyDir"
- value: "pvc"
description: "pvc"
- value: "hostPath"
description: "hostPath"
# Include{persistenceBasic}
- variable: hostPath
label: "hostPath"
description: "Path inside the container the storage is mounted"
schema:
show_if: [["type", "=", "hostPath"]]
type: hostpath
- variable: medium
label: "EmptyDir Medium"
schema:
show_if: [["type", "=", "emptyDir"]]
type: string
default: ""
enum:
- value: ""
description: "Default"
- value: "Memory"
description: "Memory"
# Include{persistenceAdvanced}
# Include{persistenceList}
- variable: ingress
label: ""
group: "Ingress"
schema:
additional_attrs: true
type: dict
attrs:
- variable: main
label: "Main Ingress"
schema:
additional_attrs: true
type: dict
attrs:
# Include{ingressDefault}
# Include{ingressTLS}
# Include{ingressTraefik}
# Include{ingressExpert}
# Include{ingressList}
- variable: advancedSecurity
label: "Show Advanced Security Settings"
group: "Security and Permissions"
schema:
type: boolean
default: false
show_subquestions_if: true
subquestions:
- variable: securityContext
label: "Security Context"
schema:
additional_attrs: true
type: dict
attrs:
- variable: privileged
label: "Privileged mode"
schema:
type: boolean
default: false
- variable: readOnlyRootFilesystem
label: "ReadOnly Root Filesystem"
schema:
type: boolean
default: true
- variable: allowPrivilegeEscalation
label: "Allow Privilege Escalation"
schema:
type: boolean
default: false
- variable: runAsNonRoot
label: "runAsNonRoot"
schema:
type: boolean
default: false
# Include{securityContextAdvanced}
- variable: podSecurityContext
group: "Security and Permissions"
label: "Pod Security Context"
schema:
additional_attrs: true
type: dict
attrs:
- variable: runAsUser
label: "runAsUser"
description: "The UserID of the user running the application"
schema:
type: int
default: 0
- variable: runAsGroup
label: "runAsGroup"
description: The groupID this App of the user running the application"
schema:
type: int
default: 0
- variable: fsGroup
label: "fsGroup"
description: "The group that should own ALL storage."
schema:
type: int
default: 568
# Include{podSecurityContextAdvanced}
# Include{resources}
# Include{advanced}
# Include{addons}
@@ -0,0 +1,53 @@
{{/* Define the cronjob */}}
{{- define "linkace.cronjob" -}}
{{- if .Values.secret.CRON_TOKEN }}
{{- $jobName := include "common.names.fullname" . }}
---
apiVersion: batch/v1
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:
securityContext:
runAsUser: 568
runAsGroup: 568
restartPolicy: Never
containers:
- name: {{ .Chart.Name }}
securityContext:
privileged: false
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
runAsNonRoot: true
capabilities:
drop:
- ALL
env:
- name: CRON_TOKEN
value: {{ .Values.secret.CRON_TOKEN }}
image: "{{ .Values.alpineImage.repository }}:{{ .Values.alpineImage.tag }}"
args:
- curl
- "http://{{ $jobName }}.ix-{{ .Release.Name }}.svc.cluster.local:{{ .Values.service.main.ports.main.port }}/cron/$(CRON_TOKEN)"
resources:
{{ toYaml .Values.resources | indent 16 }}
{{- end -}}
{{- end }}
@@ -0,0 +1,20 @@
{{/* Define the secrets */}}
{{- define "linkace.secrets" -}}
---
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: linkace-secrets
{{- $linkaceprevious := lookup "v1" "Secret" .Release.Namespace "linkace-secrets" }}
{{- $app_key := "" }}
data:
{{- if $linkaceprevious}}
APP_KEY: {{ index $linkaceprevious.data "APP_KEY" }}
{{- else }}
{{- $app_key := randAlphaNum 32 }}
APP_KEY: {{ $app_key | b64enc | quote }}
{{- end }}
{{- end -}}
@@ -0,0 +1,23 @@
{{/* Make sure all variables are set properly */}}
{{ include "common.setup" . }}
{{/* Append the general configMap volume to the volumes */}}
{{- define "linkace.harcodedValues" -}}
persistence:
linkace-config:
enabled: "true"
mountPath: "/etc/nginx/conf.d/linkace.conf"
subPath: "nginx-config"
type: "custom"
volumeSpec:
configMap:
name: {{ printf "%v-config" (include "common.names.fullname" .) }}
{{- end -}}
{{- $_ := mergeOverwrite .Values (include "linkace.harcodedValues" . | fromYaml) -}}
{{- include "linkace.cronjob" . }}
{{- include "linkace.secrets" . }}
{{/* Render the templates */}}
{{ include "common.postSetup" . }}
@@ -0,0 +1,65 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "common.names.fullname" . }}-config
labels:
{{- include "common.labels" . | nindent 4 }}
data:
nginx-config: |-
server {
root /app/public;
server_name _;
index index.php;
charset utf-8;
client_max_body_size 20M;
port_in_redirect off;
# Choose the connection method
listen 0.0.0.0:8080;
# Content security headers for Laravel
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
# Gzip
gzip on;
gzip_vary on;
gzip_comp_level 8;
gzip_min_length 256;
gzip_proxied expired no-cache no-store private auth;
gzip_types application/javascript application/x-javascript application/xhtml+xml font/woff font/woff2 image/svg+xml image/x-icon text/css text/javascript text/plain text/xml;
# Location configs
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# Assets and media files
location ~* \.(?:css|js|map|scss|jpg|jpeg|png|gif|mp4|woff|woff2|ico|svg|webmanifest)$ {
expires max;
access_log off;
add_header Cache-Control "public";
try_files $uri =404;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
# Error pages
error_page 404 /index.php;
error_page 403 /index.php;
# PHP handling
location ~ \.php$ {
fastcgi_pass localhost:9000;
try_files $uri /index.php;
include fastcgi_params;
fastcgi_keep_conn on;
fastcgi_intercept_errors on;
fastcgi_index index.php;
fastcgi_read_timeout 300;
}
}
+127
View File
@@ -0,0 +1,127 @@
image:
repository: tccr.io/truecharts/linkace
tag: v1.9.1@sha256:d56fa76113e3e5ab0889a13bdfb463d12b71b3e2ec839a8ff6fa99ec036be862
pullPolicy: IfNotPresent
nginxImage:
repository: tccr.io/truecharts/nginx
tag: v1.21.6@sha256:80d87a1d4d67749d2caaa64ee061a66a946b81942ac56f4780e36f8356cee371
securityContext:
runAsNonRoot: false
podSecurityContext:
runAsUser: 0
runAsGroup: 0
env:
# Internal Envs
DB_CONNECTION: "mysql"
DB_PORT: "3306"
DB_DATABASE: "{{ .Values.mariadb.mariadbDatabase }}"
DB_USERNAME: "{{ .Values.mariadb.mariadbUsername }}"
REDIS_PORT: "6379"
CACHE_DRIVER: "redis"
SESSION_DRIVER: "redis"
APP_NAME: "LinkAce"
APP_ENV: "production"
APP_TIMEZONE: "{{ .Values.env.TZ }}"
# User Envs
TZ: UTC
APP_URL: "http://localhost"
APP_DEBUG: false
BACKUP_ENABLED: false
BACKUP_DISK: s3
BACKUP_NOTIFICATION_EMAIL: your@email.com
BACKUP_MAX_SIZE: 512
envValueFrom:
DB_HOST:
secretKeyRef:
name: mariadbcreds
key: plainhost
DB_PASSWORD:
secretKeyRef:
name: mariadbcreds
key: mariadb-password
REDIS_HOST:
secretKeyRef:
name: rediscreds
key: plainhost
REDIS_PASSWORD:
secretKeyRef:
name: rediscreds
key: redis-password
APP_KEY:
secretKeyRef:
name: linkace-secrets
key: APP_KEY
additionalContainers:
nginx:
name: nginx
image: "{{ .Values.nginxImage.repository }}:{{ .Values.nginxImage.tag }}"
ports:
- containerPort: 80
name: main
volumeMounts:
- name: linkace-config
mountPath: "/etc/nginx/conf.d/linkace.conf"
subPath: nginx-config
readOnly: true
- name: app
mountPath: "/app"
initContainers:
# App checks ".env" for "SETUP_COMPELTED" status, to determine if it needs to run initial setup or not.
# We create this file and set it to false if it doesn't exists.
# If it exists, we let the app decide it's value (true|false) and how to proceed.
1-create-env-file:
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
volumeMounts:
- name: app
mountPath: "/app"
command: ["/bin/sh", "-c"]
args:
- >
if [ ! -f "/app/.env" ];
then
echo "Preparing for initial installation";
echo "SETUP_COMPLETED=false" > /app/.env;
else
echo "Initial installation has already completed.";
fi;
cronjob:
schedule: "* * * * *"
annotations: {}
failedJobsHistoryLimit: 5
successfulJobsHistoryLimit: 2
service:
main:
ports:
main:
port: 10160
targetPort: 80
persistence:
app:
enabled: true
mountPath: "/app"
logs:
enabled: true
mountPath: "/app/storage/logs"
backups:
enabled: true
mountPath: "/app/storage/app/backups"
mariadb:
enabled: true
mariadbUsername: linkace
mariadbDatabase: linkace
existingSecret: "mariadbcreds"
redis:
enabled: true
existingSecret: "rediscreds"
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

+1 -1
View File
@@ -33,7 +33,6 @@ _This list is to track `App Requests` from one place._
- [ ] Filestash #1000
- [ ] UISP #1007
- [ ] Openspeedtest #1018
- [ ] LinkAce #1020
- [ ] Zoneminder #1021
- [ ] OpenHAB #1043
- [ ] Suricata #1063
@@ -515,3 +514,4 @@ _These Apps have specific requirements or need specific customisation and care_
- [x] Synapse (Matrix Server) #410
- [x] n8n #27
- [x] WeblateOrg #817
- [x] LinkAce #1020
+1
View File
@@ -310,6 +310,7 @@ These defaults can of course be changed, but as we guarantee "sane, working defa
| trilium-notes | main | main | 10156 | HTTP | |
| unmanic | main | main | 10157 | TCP | |
| weblate | main | main | 10158 | TCP | |
| linkace | main | main | 10160 | TCP | |
| satisfactory | beacon | beacon | 15000 | UDP | |
| satisfactory | query | query | 15777 | UDP | |
| minecraft-bedrock | main | main | 19132 | UDP | |