diff --git a/kubernetes/deployment-production.tmpl b/kubernetes/deployment-production.tmpl index 141700a..588d7d0 100644 --- a/kubernetes/deployment-production.tmpl +++ b/kubernetes/deployment-production.tmpl @@ -30,6 +30,8 @@ spec: env: - name: PANOPTES_PROD_URL value: https://panoptes.zooniverse.org/ + - name: ENV + value: production volumeMounts: - name: theia-production-volume mountPath: "/tmp" @@ -114,6 +116,18 @@ spec: claimName: theia-production-redis --- apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: theia-production-redis +spec: + accessModes: + - ReadWriteMany + storageClassName: azurefile + resources: + requests: + storage: 5Gi +--- +apiVersion: v1 kind: Service metadata: name: theia-production-redis diff --git a/start_server.sh b/start_server.sh index e2e3382..57bd3e4 100755 --- a/start_server.sh +++ b/start_server.sh @@ -8,7 +8,7 @@ done echo Applying migrations python manage.py migrate --noinput -if [ "$DJANGO_ENV" == "production" ]; then +if [ "$ENV" == "production" ]; then if [ ! -d "theia/static" ]; then echo Generating static files python manage.py collectstatic diff --git a/theia/settings.py b/theia/settings.py index 2b2f30c..0806962 100644 --- a/theia/settings.py +++ b/theia/settings.py @@ -19,7 +19,10 @@ # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = '6n$fr-9vudyln(o=6jzv*pr_3b9(kajv=#&wq6ep4vm_s1m@6p' +if os.environ.get('ENV') == "production": + SECRET_KEY = os.environ.get('SECRET_KEY') +else + SECRET_KEY = '6n$fr-9vudyln(o=6jzv*pr_3b9(kajv=#&wq6ep4vm_s1m@6p' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True