1
0
Fork 0

add previewgenerator cronjob

This commit is contained in:
Massaki Archambault 2023-06-14 00:42:12 -04:00
parent f5871b8d0e
commit a725e27677
7 changed files with 56 additions and 6 deletions

View File

@ -1,2 +1,2 @@
# Mitigate an issue with CPU starvation in photo app # Mitigate an issue with CPU starvation in photo app
MaxRequestWorkers 50 # MaxRequestWorkers 50

View File

@ -1,3 +1,3 @@
upload_max_filesize=2G upload_max_filesize=2G
post_max_size=2G post_max_size=2G
memory_limit=2G memory_limit=1G

View File

@ -3,6 +3,7 @@ resources:
- ../redis - ../redis
- nextcloud-deployment.yaml - nextcloud-deployment.yaml
- nextcloud-cronjob.yaml - nextcloud-cronjob.yaml
- previewgenerator-cronjob.yaml
- nextcloud-ingress.yaml - nextcloud-ingress.yaml
namePrefix: nextcloud- namePrefix: nextcloud-
@ -15,6 +16,9 @@ configMapGenerator:
files: files:
- php-user.ini=configurations/php-user.ini - php-user.ini=configurations/php-user.ini
- apache-user.cfg=configurations/apache-user.conf - apache-user.cfg=configurations/apache-user.conf
- name: cron-scripts
files:
- cron-previewgenerator.sh=scripts/cron-previewgenerator.sh
- name: kustomize-generated-config - name: kustomize-generated-config
literals: literals:
- NEXTCLOUD_EXTERNAL_HOST=cloud.badjware.dev - NEXTCLOUD_EXTERNAL_HOST=cloud.badjware.dev

View File

@ -85,8 +85,8 @@ spec:
cpu: 2000m cpu: 2000m
memory: 2Gi memory: 2Gi
limits: limits:
cpu: 3000m cpu: 4000m
memory: 3Gi memory: 2Gi
volumeMounts: volumeMounts:
- name: nextcloud-pv - name: nextcloud-pv
mountPath: /var/www/html mountPath: /var/www/html
@ -98,6 +98,9 @@ spec:
mountPath: /etc/apache2/conf-enabled/apache-user.conf mountPath: /etc/apache2/conf-enabled/apache-user.conf
subPath: apache-user.conf subPath: apache-user.conf
readOnly: true readOnly: true
- name: cron-scripts
mountPath: /scripts
readOnly: true
volumes: volumes:
- name: nextcloud-pv - name: nextcloud-pv
persistentVolumeClaim: persistentVolumeClaim:
@ -105,6 +108,9 @@ spec:
- name: server-config - name: server-config
configMap: configMap:
name: server-config name: server-config
- name: cron-scripts
configMap:
name: cron-scripts
--- ---
apiVersion: v1 apiVersion: v1
kind: PersistentVolumeClaim kind: PersistentVolumeClaim

View File

@ -0,0 +1,35 @@
apiVersion: batch/v1
kind: CronJob
metadata:
name: previewgenerator-cron
labels:
app.kubernetes.io/name: nextcloud
app.kubernetes.io/component: previewgenerator
spec:
schedule: "3,13,23,33,43,53 * * * *"
concurrencyPolicy: Forbid
successfulJobsHistoryLimit: 1
failedJobsHistoryLimit: 1
jobTemplate:
metadata:
labels:
app.kubernetes.io/name: nextcloud
app.kubernetes.io/component: previewgenerator
spec:
backoffLimit: 0 # no retry
template:
metadata:
labels:
app.kubernetes.io/name: nextcloud
app.kubernetes.io/component: previewgenerator
spec:
restartPolicy: Never
serviceAccountName: server-cron
containers:
- name: run-previewgenerator-cron
image: bitnami/kubectl
imagePullPolicy: IfNotPresent
command: ["/bin/bash"]
args:
- -xc
- kubectl exec "$(kubectl get pods -l 'app.kubernetes.io/component=server' -o name)" -- /bin/bash -c '( if ! which sudo &>/dev/null; then apt update && apt install sudo; fi ) && sudo -u www-data bash -x /scripts/cron-previewgenerator.sh'

View File

@ -0,0 +1,5 @@
#!/bin/bash
php -f /var/www/html/occ config:app:set --value="32 64 256 1024 1920" previewgenerator squareSizes &&
php -f /var/www/html/occ config:app:set --value="64 128 1024 1080 2030" previewgenerator widthSizes &&
php -f /var/www/html/occ config:app:set --value="64 256 1024 1080 1920" previewgenerator heightSizes &&
php -f /var/www/html/occ preview:pre-generate -vvv

View File

@ -41,10 +41,10 @@ spec:
containerPort: 5432 containerPort: 5432
resources: resources:
requests: requests:
cpu: 500m cpu: 750m
memory: 1Gi memory: 1Gi
limits: limits:
cpu: 500m cpu: 1000m
memory: 1Gi memory: 1Gi
volumeMounts: volumeMounts:
- name: postgres-pvc - name: postgres-pvc