Hi all, I have got Sentry onpremise running on a Kubernetes setup. Everything works fine so far but if I recreate the pod, the postgres database gets recreated and I have to re-run “sentry upgrade” on the web container. This means I lose all my previous setup and data in Sentry.
I have created a persistent volume and mounted it under /var/lib/postgresql on my postgres container. I have confirmed that if I create a file under this directory, it survives the deletion of the pod. But I still have to reinitialize Sentry.
My kubernetes deployment is configured as follows:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: sentry
labels:
name: sentry
env: staging
spec:
replicas: 1
template:
metadata:
labels:
name: sentry
spec:
containers:
- name: memcached
image: memcached:1.4
- name: redis
image: redis:3.2-alpine
- name: postgres
image: postgres:9.5
volumeMounts:
- mountPath: "/var/lib/postgresql"
name: postgres-data
- name: smtp
image: tianon/exim4
- name: web
image: repo/mycompany_sentry:0.1.1
env:
- name: SENTRY_USE_SSL
value: '1'
- name: SENTRY_SECRET_KEY
value: ****
- name: SENTRY_REDIS_HOST
value: localhost
- name: SENTRY_MEMCACHED_HOST
value: localhost
- name: SENTRY_POSTGRES_HOST
value: localhost
- name: SENTRY_EMAIL_HOST
value: localhost
- name: SENTRY_SERVER_EMAIL
value: sentry@mycompany.com
- name: worker
image: repo/mycompany_sentry:0.1.1
env:
- name: SENTRY_SECRET_KEY
value: ****
- name: SENTRY_REDIS_HOST
value: localhost
- name: SENTRY_MEMCACHED_HOST
value: localhost
- name: SENTRY_POSTGRES_HOST
value: localhost
args:
- run
- worker
- name: cron
image: repo/mycompany_sentry:0.1.1
volumeMounts:
- name: secrets
mountPath: /etc/nginx/conf.d/ssl
readOnly: true
env:
- name: SENTRY_SECRET_KEY
value: ****
- name: SENTRY_REDIS_HOST
value: localhost
- name: SENTRY_MEMCACHED_HOST
value: localhost
- name: SENTRY_POSTGRES_HOST
value: localhost
args:
- run
- cron
- name: nginx
image: repo/sentry_nginx:0.1.2
ports:
- name: sentry-http
containerPort: 80
- name: sentry-https
containerPort: 443
volumeMounts:
- name: secrets
mountPath: /etc/nginx/conf.d/ssl
readOnly: true
volumes:
- name: postgres-data
persistentVolumeClaim:
claimName: mycompany-sentry-postgres
- name: secrets
secret:
secretName: mycompany-com-cert
Am I missing something? Do I need persistent volumes for something else, or is this expected behaviour?
Any help appreciated.
James