x
This commit is contained in:
parent
731519f498
commit
c0082f0c7c
1 changed files with 60 additions and 0 deletions
|
@ -146,3 +146,63 @@ spec:
|
|||
name: nextcloud
|
||||
port:
|
||||
number: 80
|
||||
|
||||
|
||||
|
||||
---
|
||||
# This is a Kubernetes CronJob that executes the Nextcloud background tasks.
|
||||
# It is designed to run the 'cron.php' script every 5 minutes.
|
||||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: nextcloud-cron
|
||||
namespace: home-server
|
||||
spec:
|
||||
# The schedule for the cron job, in standard cron format.
|
||||
# This will run the job every 5 minutes.
|
||||
schedule: "*/5 * * * *"
|
||||
successfulJobsHistoryLimit: 3
|
||||
failedJobsHistoryLimit: 1
|
||||
jobTemplate:
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
# This security context ensures the job runs with the correct user and group
|
||||
# for the Nextcloud container, which is often www-data (UID 33).
|
||||
securityContext:
|
||||
runAsUser: 33
|
||||
runAsGroup: 33
|
||||
containers:
|
||||
- name: nextcloud-cron
|
||||
# Use the same Nextcloud image as the main deployment to ensure consistency.
|
||||
image: nextcloud:30
|
||||
imagePullPolicy: IfNotPresent
|
||||
# The command to execute. 'php -f /var/www/html/cron.php' is the official
|
||||
# Nextcloud command for running background tasks.
|
||||
command: ["php", "-f", "/var/www/html/cron.php"]
|
||||
env:
|
||||
# The environment variables are passed to the cron job container so it
|
||||
# can connect to the same database as the main Nextcloud pod.
|
||||
- name: MYSQL_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: nextcloud-secrets
|
||||
key: MYSQL_PASSWORD
|
||||
- name: MYSQL_DATABASE
|
||||
value: nextcloud
|
||||
- name: MYSQL_USER
|
||||
value: nextcloud
|
||||
- name: MYSQL_HOST
|
||||
value: mariadb.database
|
||||
volumeMounts:
|
||||
# Mount the persistent volume claim to access the Nextcloud installation
|
||||
# and data directories.
|
||||
- name: nextcloud-data
|
||||
mountPath: /var/www/html
|
||||
volumes:
|
||||
- name: nextcloud-data
|
||||
persistentVolumeClaim:
|
||||
claimName: nextcloud-pvc
|
||||
# Set the restart policy to 'OnFailure' to allow the job to complete and
|
||||
# not remain in a running state.
|
||||
restartPolicy: OnFailure
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue