diff --git a/compose.override.production.yml b/compose.override.production.yml index 58f47d7..de54d36 100644 --- a/compose.override.production.yml +++ b/compose.override.production.yml @@ -26,8 +26,9 @@ services: - production_postgres_data_backups:/backups:z env_file: - ./.envs/.production/.postgres + - /etc/vault.d/secrets/kv_root_security.env deploy: - replicas: 0 + replicas: ${POSTGRES_ENABLED:-0} nginx: image: nginx:1.19 diff --git a/compose/production/django/Dockerfile b/compose/production/django/Dockerfile index 8474812..f9e1407 100644 --- a/compose/production/django/Dockerfile +++ b/compose/production/django/Dockerfile @@ -1,7 +1,9 @@ ARG PYTHON_IMAGE_VER=3.12 + FROM python:${PYTHON_IMAGE_VER}-slim-bookworm + ENV PYTHONUNBUFFERED 1 RUN apt-get update \ diff --git a/config/settings/production.py b/config/settings/production.py index cdb213f..4af0de7 100644 --- a/config/settings/production.py +++ b/config/settings/production.py @@ -13,9 +13,10 @@ DATABASES["default"] = env.db("DATABASE_URL") # noqa F405 DATABASES["default"]["ATOMIC_REQUESTS"] = True # noqa F405 DATABASES["default"]["CONN_MAX_AGE"] = env.int("CONN_MAX_AGE", default=60) # noqa F405 -if env("POSTGRES_SSL"): +if env.bool("POSTGRES_SSL", default=True): DATABASES["default"]["OPTIONS"] = {"sslmode": "require"} # noqa F405 - +else: + DATABASES["default"]["OPTIONS"] = {"sslmode": "disable"} # noqa F405 # CACHES # ------------------------------------------------------------------------------ CACHES = {