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
MaxRequestWorkers 50
# MaxRequestWorkers 50

View File

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

View File

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

View File

@ -85,8 +85,8 @@ spec:
cpu: 2000m
memory: 2Gi
limits:
cpu: 3000m
memory: 3Gi
cpu: 4000m
memory: 2Gi
volumeMounts:
- name: nextcloud-pv
mountPath: /var/www/html
@ -98,6 +98,9 @@ spec:
mountPath: /etc/apache2/conf-enabled/apache-user.conf
subPath: apache-user.conf
readOnly: true
- name: cron-scripts
mountPath: /scripts
readOnly: true
volumes:
- name: nextcloud-pv
persistentVolumeClaim:
@ -105,6 +108,9 @@ spec:
- name: server-config
configMap:
name: server-config
- name: cron-scripts
configMap:
name: cron-scripts
---
apiVersion: v1
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
resources:
requests:
cpu: 500m
cpu: 750m
memory: 1Gi
limits:
cpu: 500m
cpu: 1000m
memory: 1Gi
volumeMounts:
- name: postgres-pvc