cronjob to execute clearsessions regularly
All checks were successful
Build and Deploy Staging / build (push) Successful in 51s
Build and Deploy Staging / deploy (push) Successful in 7s

This commit is contained in:
Tobias Brunner 2025-03-24 15:16:31 +01:00
parent 60d62bd0af
commit 41ab33bee7
No known key found for this signature in database
2 changed files with 49 additions and 0 deletions

View file

@ -0,0 +1,48 @@
apiVersion: batch/v1
kind: CronJob
metadata:
name: servala-clearsessions
spec:
schedule: "42 02 * * 1"
jobTemplate:
spec:
template:
spec:
containers:
- name: servala-clearsessions
image: servala-2nkgm.app.codey.ch/servala/servala-portal:latest
imagePullPolicy: Always
# The command to clear sessions
command: ["uv", "run", "src/manage.py", "clearsessions"]
envFrom:
- secretRef:
name: servala
env:
- name: SERVALA_DB_USER
valueFrom:
secretKeyRef:
name: database-creds
key: POSTGRESQL_USER
- name: SERVALA_DB_PASSWORD
valueFrom:
secretKeyRef:
name: database-creds
key: POSTGRESQL_PASSWORD
- name: SERVALA_DB_HOST
valueFrom:
secretKeyRef:
name: database-creds
key: POSTGRESQL_HOST
- name: SERVALA_DB_PORT
valueFrom:
secretKeyRef:
name: database-creds
key: POSTGRESQL_PORT
- name: SERVALA_DB_NAME
valueFrom:
secretKeyRef:
name: database-creds
key: POSTGRESQL_DB
- name: UV_CACHE_DIR
value: /app/.uvcache
restartPolicy: OnFailure

View file

@ -1,3 +1,4 @@
resources:
- deployment.yaml
- service.yaml
- cronjob.yaml