Add support for separate Horizon deployment
This commit is contained in:
@@ -105,6 +105,8 @@ A Helm chart for deploying Pixelfed on Kubernetes
|
||||
| pixelfed.force_https_urls | bool | `true` | Force https url generation |
|
||||
| pixelfed.horizon.dark_mode | bool | `false` | darkmode for the web interface in the admin panel |
|
||||
| pixelfed.horizon.prefix | string | `"horizon-"` | prefix will be used when storing all Horizon data in Redis |
|
||||
| pixelfed.horizon.replicas | int | `1` | Number of replicas for the Horizon deployment when running separately. Ignored if autoscaling is enabled. |
|
||||
| pixelfed.horizon.separate_deployment | bool | `false` | Enable running Laravel Horizon in a separate deployment. Allow to scale the backend queue workers independently. |
|
||||
| pixelfed.image_driver | string | `"gd"` | library to process images. options: "gd" (default), "imagick" |
|
||||
| pixelfed.image_quality | int | `80` | Set the image optimization quality, between 1-100. Lower uses less space, higher more quality |
|
||||
| pixelfed.instance.contact_email | string | `""` | The public contact email for your server |
|
||||
@@ -218,5 +220,3 @@ A Helm chart for deploying Pixelfed on Kubernetes
|
||||
| valkey.tls.autoGenerated | bool | `false` | |
|
||||
| valkey.tls.enabled | bool | `false` | |
|
||||
|
||||
----------------------------------------------
|
||||
Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2)
|
||||
|
||||
@@ -35,7 +35,6 @@ Common labels
|
||||
*/}}
|
||||
{{- define "pixelfed.labels" -}}
|
||||
helm.sh/chart: {{ include "pixelfed.chart" . }}
|
||||
{{ include "pixelfed.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
@@ -45,9 +44,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{/*
|
||||
Selector labels
|
||||
*/}}
|
||||
{{- define "pixelfed.selectorLabels" -}}
|
||||
{{- define "pixelfed.web.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "pixelfed.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/component: web
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Horizon selector labels
|
||||
*/}}
|
||||
{{- define "pixelfed.horizon.selectorLabels" -}}
|
||||
app.kubernetes.io/component: horizon
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
|
||||
@@ -10,7 +10,7 @@ spec:
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "pixelfed.selectorLabels" . | nindent 6 }}
|
||||
{{- include "pixelfed.web.selectorLabels" . | nindent 6 }}
|
||||
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
|
||||
template:
|
||||
metadata:
|
||||
@@ -22,6 +22,7 @@ spec:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "pixelfed.web.selectorLabels" . | nindent 8 }}
|
||||
{{- include "pixelfed.labels" . | nindent 8 }}
|
||||
{{- with .Values.podLabels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
@@ -67,6 +68,10 @@ spec:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
|
||||
# Run horizon inside this pod dependent upon the separate_deployment flag
|
||||
- name: ENABLE_HORIZON
|
||||
value: "{{ not .Values.pixelfed.horizon.separate_deployment }}"
|
||||
|
||||
# pixelfed app key
|
||||
- name: APP_KEY
|
||||
valueFrom:
|
||||
|
||||
@@ -0,0 +1,234 @@
|
||||
{{- if .Values.pixelfed.horizon.separate_deployment }}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "pixelfed.fullname" . }}-backend
|
||||
labels:
|
||||
{{- include "pixelfed.labels" . | nindent 4 }}
|
||||
spec:
|
||||
{{- if not .Values.autoscaling.enabled }}
|
||||
replicas: {{ .Values.pixelfed.horizon.replicas }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "pixelfed.horizon.selectorLabels" . | nindent 6 }}
|
||||
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
# reload deployment if config files change
|
||||
php-config-hash: {{ toJson .Values.phpConfigs | sha256sum }}
|
||||
checksum/config: {{ include (print $.Template.BasePath "/configmap_env.yaml") . | sha256sum }}
|
||||
{{- with .Values.podAnnotations }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "pixelfed.horizon.selectorLabels" . | nindent 8 }}
|
||||
{{- include "pixelfed.labels" . | nindent 8 }}
|
||||
{{- with .Values.podLabels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "pixelfed.serviceAccountName" . }}
|
||||
{{- with .Values.podSecurityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.extraInitContainers }}
|
||||
initContainers:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}-backend
|
||||
{{- with .Values.securityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
command: ["php"]
|
||||
args: ["artisan", "horizon"]
|
||||
envFrom:
|
||||
{{- with .Values.extraEnvFrom }}
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
- configMapRef:
|
||||
name: {{ include "pixelfed.fullname" . }}-env
|
||||
env:
|
||||
{{- with .Values.extraEnv }}
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
|
||||
# pixelfed app key
|
||||
- name: APP_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
{{- if and .Values.pixelfed.app.existingSecret .Values.pixelfed.app.existingSecretKey }}
|
||||
name: {{ .Values.pixelfed.app.existingSecret }}
|
||||
key: {{ .Values.pixelfed.app.existingSecretKey }}
|
||||
{{- else }}
|
||||
name: {{ include "pixelfed.fullname" . }}-app-key
|
||||
key: key
|
||||
{{- end }}
|
||||
|
||||
# valkey AKA redis
|
||||
{{- if and .Values.externalValkey.enabled .Values.externalValkey.existingSecretKeys.host }}
|
||||
- name: REDIS_HOST
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
{{- if and .Values.externalValkey.existingSecret .Values.externalValkey.existingSecretKeys.host }}
|
||||
name: {{ .Values.externalValkey.existingSecret }}
|
||||
key: {{ .Values.externalValkey.existingSecretKeys.host }}
|
||||
{{- else }}
|
||||
name: {{ include "pixelfed.fullname" . }}-valkey
|
||||
key: host
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if and .Values.externalValkey.enabled .Values.externalValkey.existingSecret .Values.externalValkey.existingSecretKeys.port }}
|
||||
- name: REDIS_PORT
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
{{- if and .Values.externalValkey.existingSecret .Values.externalValkey.existingSecretKeys.port }}
|
||||
name: {{ .Values.externalValkey.existingSecret }}
|
||||
key: {{ .Values.externalValkey.existingSecretKeys.port }}
|
||||
{{- else }}
|
||||
name: {{ include "pixelfed.fullname" . }}-valkey
|
||||
key: port
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
- name: REDIS_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
{{- if and .Values.externalValkey.enabled .Values.externalValkey.existingSecret }}
|
||||
name: {{ .Values.externalValkey.existingSecret }}
|
||||
key: {{ .Values.externalValkey.existingSecretKeys.password }}
|
||||
{{- else if and .Values.externalValkey.enabled (not .Values.externalValkey.existingSecret) }}
|
||||
name: {{ include "pixelfed.fullname" . }}-valkey
|
||||
key: password
|
||||
{{- else if .Values.valkey.auth.existingSecret }}
|
||||
name: {{ .Values.valkey.auth.existingSecret }}
|
||||
key: password
|
||||
{{- else }}
|
||||
name: {{ .Values.valkey.fullnameOverride }}
|
||||
key: valkey-password
|
||||
{{- end }}
|
||||
|
||||
# database configuration
|
||||
{{- if .Values.externalDatabase.enabled }}
|
||||
- name: DB_HOST
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
{{- if and .Values.externalDatabase.enabled .Values.externalDatabase.existingSecret .Values.externalDatabase.existingSecretKeys.host }}
|
||||
name: {{ .Values.externalDatabase.existingSecret }}
|
||||
key: {{ .Values.externalDatabase.existingSecretKeys.host }}
|
||||
{{- else if and .Values.externalDatabase.enabled (not .Values.externalDatabase.existingSecretKeys.host) }}
|
||||
name: {{ include "pixelfed.fullname" . }}-database
|
||||
key: host
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.externalDatabase.enabled }}
|
||||
- name: DB_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
{{- if and .Values.externalDatabase.enabled .Values.externalDatabase.existingSecret .Values.externalDatabase.existingSecretKeys.username }}
|
||||
name: {{ .Values.externalDatabase.existingSecret }}
|
||||
key: {{ .Values.externalDatabase.existingSecretKeys.username }}
|
||||
{{- else if and .Values.externalDatabase.enabled (not .Values.externalDatabase.existingSecretKeys.username) }}
|
||||
name: {{ include "pixelfed.fullname" . }}-database
|
||||
key: username
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.externalDatabase.enabled }}
|
||||
- name: DB_DATABASE
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
{{- if and .Values.externalDatabase.enabled .Values.externalDatabase.existingSecret .Values.externalDatabase.existingSecretKeys.database }}
|
||||
name: {{ .Values.externalDatabase.existingSecret }}
|
||||
key: {{ .Values.externalDatabase.existingSecretKeys.database }}
|
||||
{{- else if and .Values.externalDatabase.enabled (not .Values.externalDatabase.existingSecretKeys.database) }}
|
||||
name: {{ include "pixelfed.fullname" . }}-database
|
||||
key: database
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.externalDatabase.enabled }}
|
||||
- name: DB_PORT
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
{{- if and .Values.externalDatabase.enabled .Values.externalDatabase.existingSecret .Values.externalDatabase.existingSecretKeys.port }}
|
||||
name: {{ .Values.externalDatabase.existingSecret }}
|
||||
key: {{ .Values.externalDatabase.existingSecretKeys.port }}
|
||||
{{- else if and .Values.externalDatabase.enabled (not .Values.externalDatabase.existingSecretKeys.port) }}
|
||||
name: {{ include "pixelfed.fullname" . }}-database
|
||||
key: port
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
- name: DB_PASSWORD
|
||||
{{- if and .Values.externalDatabase.enabled (not .Values.externalDatabase.existingSecret) }}
|
||||
value: {{ .Values.externalDatabase.password }}
|
||||
{{- else }}
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
{{- if and .Values.externalDatabase.enabled .Values.externalDatabase.existingSecret }}
|
||||
name: {{ .Values.externalDatabase.existingSecret }}
|
||||
key: {{ .Values.externalDatabase.existingSecretKeys.password }}
|
||||
{{- else if .Values.postgresql.auth.existingSecret }}
|
||||
name: {{ .Values.postgresql.auth.existingSecret }}
|
||||
key: postgres-password
|
||||
{{- else }}
|
||||
name: {{ .Values.postgresql.fullnameOverride }}
|
||||
key: postgres-password
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- with .Values.resources }}
|
||||
resources:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
|
||||
{{- if or .Values.extraVolumeMounts .Values.phpConfigs }}
|
||||
volumeMounts:
|
||||
{{- with .Values.extraVolumeMounts }}
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- range $key, $value := .Values.phpConfigs }}
|
||||
- name: phpconfig
|
||||
mountPath: {{ print "/usr/local/etc/php-fpm.d/%s" $key | quote }}
|
||||
subPath: {{ $key }}
|
||||
{{- end }}
|
||||
{{- end }}{{/* end volumeMounts */}}
|
||||
|
||||
{{- if or .Values.phpConfigs .Values.extraVolumes }}
|
||||
volumes:
|
||||
{{- with .Values.extraVolumes }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.phpConfigs }}
|
||||
- name: phpconfig
|
||||
configMap:
|
||||
name: {{ template "pixelfed.fullname" . }}-phpconfig
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,32 @@
|
||||
{{- if and .Values.autoscaling.enabled .Values.pixelfed.horizon.separate_deployment }}
|
||||
apiVersion: autoscaling/v2
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: {{ include "pixelfed.fullname" . }}-backend
|
||||
labels:
|
||||
{{- include "pixelfed.labels" . | nindent 4 }}
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: {{ include "pixelfed.fullname" . }}-backend
|
||||
minReplicas: {{ .Values.autoscaling.minReplicas }}
|
||||
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
|
||||
metrics:
|
||||
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||
{{- end }}
|
||||
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: memory
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -12,4 +12,4 @@ spec:
|
||||
protocol: TCP
|
||||
name: http
|
||||
selector:
|
||||
{{- include "pixelfed.selectorLabels" . | nindent 4 }}
|
||||
{{- include "pixelfed.web.selectorLabels" . | nindent 4 }}
|
||||
|
||||
@@ -332,6 +332,10 @@ pixelfed:
|
||||
prefix: "horizon-"
|
||||
# -- darkmode for the web interface in the admin panel
|
||||
dark_mode: false
|
||||
# -- Enable running Laravel Horizon in a separate deployment. Allow to scale the backend queue workers independently.
|
||||
separate_deployment: false
|
||||
# -- Number of replicas for the Horizon deployment when running separately. Ignored if autoscaling is enabled.
|
||||
replicas: 1
|
||||
|
||||
# app specific settings
|
||||
app:
|
||||
|
||||
Reference in New Issue
Block a user