Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(db): Enable running postgres locally in prod-mode #93

Merged
merged 9 commits into from
Dec 10, 2024
3 changes: 2 additions & 1 deletion compose.override.production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ services:
- production_postgres_data_backups:/backups:z
env_file:
- ./.envs/.production/.postgres
- /etc/vault.d/secrets/kv_root_security.env
samoehlert marked this conversation as resolved.
Show resolved Hide resolved
deploy:
replicas: 0
replicas: ${POSTGRES_ENABLED:-0}

nginx:
image: nginx:1.19
Expand Down
2 changes: 1 addition & 1 deletion compose/production/django/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

FROM python:3.12-slim-bookwork
FROM python:3.12-slim-bookworm

ENV PYTHONUNBUFFERED 1

Expand Down
5 changes: 3 additions & 2 deletions config/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
Loading