Here’s a cronjob to clean up the useless activity table every day:
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: postgresql-cleanup
namespace: lemmy
spec:
schedule: "0 0 * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: postgres-cleanup
image: postgres:alpine
command: ["psql", "--host=postgresql", "--dbname=postgres", "--username=postgres", "--command=DELETE FROM activity WHERE published < NOW() - INTERVAL '1 day';"]
env:
- name: PGPASSWORD
valueFrom:
secretKeyRef:
name: postgresql
key: postgres-password
backoffLimit: 0
ttlSecondsAfterFinished: 3600
If anyone else has made it this far and are thinking “ah balls, I’m using ingress-nginx”, here’s the ingress annotation for you!