allow dedicated notify push

This commit is contained in:
Jonas Leder 2026-08-08 21:56:37 +02:00
commit 705f115122
6 changed files with 138 additions and 4 deletions

View file

@ -67,7 +67,7 @@
# Notify Push proxy
handle /push/* {
uri strip_prefix /push
reverse_proxy 127.0.0.1:7867
reverse_proxy {$NOTIFY_PUSH_UPSTREAM:127.0.0.1:7867}
}
# Health check

View file

@ -69,7 +69,7 @@ upgrade_nextcloud() {
}
setup_notify_push() {
if [ "${NOTIFY_PUSH_DAEMON_ENABLED:-0}" -ne 1 ]; then
if [ "${NOTIFY_PUSH_SETUP_ENABLED:-0}" -ne 1 ]; then
return 0
fi
@ -110,6 +110,8 @@ run_server() {
fi
if [ "${NOTIFY_PUSH_DAEMON_ENABLED:-0}" -eq 1 ]; then
"$NOTIFY_PUSH_BINPATH" --port 7867 /data/config/config.php &
fi
if [ "${NOTIFY_PUSH_SETUP_ENABLED:-0}" -eq 1 ]; then
setup_notify_push &
fi
exec /usr/local/bin/frankenphp run --config /etc/caddy/Caddyfile
@ -122,8 +124,11 @@ run_cron() {
run_sidecar_if_requested() {
if [ "${SIDECAR_NOTIFY_PUSH:-0}" -eq 1 ]; then
"$NOTIFY_PUSH_BINPATH" --port 7867 /data/config/config.php
exit 1
while [ ! -x "$NOTIFY_PUSH_BINPATH" ]; do
echo "Waiting for the notify_push app to be installed..."
sleep 2
done
exec "$NOTIFY_PUSH_BINPATH" --port 7867 /data/config/config.php
fi
if [ "${SIDECAR_FULLTEXTSEARCH:-0}" -eq 1 ]; then
./occ fulltextsearch:stop

View file

@ -118,4 +118,12 @@ Shared env vars for the nextcloud container/job
key: password
- name: NEXTCLOUD_SERVICE_NAME
value: {{ include "nextcloud.fullname" . }}
- name: NOTIFY_PUSH_DAEMON_ENABLED
value: {{ ternary "1" "0" (and .Values.notifyPush.enabled (not .Values.notifyPush.dedicated)) | quote }}
- name: NOTIFY_PUSH_SETUP_ENABLED
value: {{ ternary "1" "0" .Values.notifyPush.enabled | quote }}
{{- if and .Values.notifyPush.enabled .Values.notifyPush.dedicated }}
- name: NOTIFY_PUSH_UPSTREAM
value: "{{ include "nextcloud.fullname" . }}-notify-push:7867"
{{- end }}
{{- end }}

View file

@ -0,0 +1,82 @@
{{- if and .Values.notifyPush.enabled .Values.notifyPush.dedicated }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "nextcloud.fullname" . }}-notify-push
namespace: {{ .Release.Namespace }}
labels:
{{- include "nextcloud.labels" . | nindent 4 }}
app.kubernetes.io/component: notify-push
spec:
replicas: {{ .Values.notifyPush.replicaCount }}
selector:
matchLabels:
{{- include "nextcloud.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: notify-push
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "nextcloud.labels" . | nindent 8 }}
app.kubernetes.io/component: notify-push
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "nextcloud.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}-notify-push
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ include "nextcloud.image" . }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ["ash", "/usr/local/bin/serve.sh"]
env:
{{- include "nextcloud.env" . | nindent 12 }}
- name: SIDECAR_NOTIFY_PUSH
value: "1"
ports:
- name: notify-push
containerPort: 7867
protocol: TCP
livenessProbe:
tcpSocket:
port: notify-push
readinessProbe:
tcpSocket:
port: notify-push
resources:
{{- toYaml .Values.notifyPush.resources | nindent 12 }}
volumeMounts:
- name: nextcloud-data
mountPath: /data
volumes:
- name: nextcloud-data
persistentVolumeClaim:
{{ if .Values.storage.useExistingPvc }}
claimName: {{ .Values.storage.existingPvc }}
{{ else }}
claimName: {{ include "nextcloud.fullname" . }}
{{ end }}
{{- with .Values.notifyPush.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.notifyPush.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.notifyPush.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}

View file

@ -0,0 +1,20 @@
{{- if and .Values.notifyPush.enabled .Values.notifyPush.dedicated }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "nextcloud.fullname" . }}-notify-push
namespace: {{ .Release.Namespace }}
labels:
{{- include "nextcloud.labels" . | nindent 4 }}
app.kubernetes.io/component: notify-push
spec:
type: ClusterIP
ports:
- port: 7867
targetPort: notify-push
protocol: TCP
name: notify-push
selector:
{{- include "nextcloud.selectorLabels" . | nindent 4 }}
app.kubernetes.io/component: notify-push
{{- end }}

View file

@ -194,3 +194,22 @@ cron:
nodeSelector: {}
tolerations: []
affinity: {}
notifyPush:
# Whether the notify_push realtime service is set up at all.
enabled: true
# false (default): notify_push runs co-located inside every web pod, proxied
# over localhost by Caddy.
# true: notify_push runs as its own Deployment+Service instead, so it isn't
# duplicated per web replica and can be scaled/restarted independently.
dedicated: false
replicaCount: 1
resources:
limits:
memory: 256Mi
requests:
cpu: 10m
memory: 64Mi
nodeSelector: {}
tolerations: []
affinity: {}