From 9f71fbdf2f62c0728eafca83a03612f078613ac1 Mon Sep 17 00:00:00 2001 From: Christopher Tineo Date: Sat, 27 Jun 2026 18:50:18 -0400 Subject: [PATCH 1/2] feat: update DB config defaults from RDS to CloudNativePG - Update secret.template.yaml to show CNPG as the primary target with shared-cluster-rw.cloudnative-pg.svc.cluster.local - Switch SQL_DATABASE default from balancer_dev to balancer - Update dev.env.example to document CNPG as primary, RDS as legacy Refs: #464 Related: CodeForPhilly/cfp-sandbox-cluster#162 --- config/env/dev.env.example | 9 +++++---- deploy/manifests/balancer/base/secret.template.yaml | 9 +++++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/config/env/dev.env.example b/config/env/dev.env.example index b8e195cf..7960c654 100644 --- a/config/env/dev.env.example +++ b/config/env/dev.env.example @@ -10,13 +10,14 @@ SQL_PASSWORD=balancer # Connection Type Examples: # -# CloudNativePG (Kubernetes service within cluster): -# SQL_HOST=balancer-postgres-rw -# SQL_HOST=balancer-postgres-rw.balancer.svc.cluster.local +# CloudNativePG (primary — Philthy Civic Cloud shared cluster): +# SQL_HOST=shared-cluster-rw.cloudnative-pg.svc.cluster.local +# SQL_DATABASE=balancer # (SSL typically not required within cluster) # -# AWS RDS (External database): +# AWS RDS (legacy — for migration contexts): # SQL_HOST=balancer-db.xxxxx.us-east-1.rds.amazonaws.com +# SQL_DATABASE=balancer_dev # (SSL typically required - set SQL_SSL_MODE if needed) # # Local development: diff --git a/deploy/manifests/balancer/base/secret.template.yaml b/deploy/manifests/balancer/base/secret.template.yaml index e003a6ce..42b86d9a 100644 --- a/deploy/manifests/balancer/base/secret.template.yaml +++ b/deploy/manifests/balancer/base/secret.template.yaml @@ -6,6 +6,9 @@ # repository. Secrets should be created in each target cluster using cluster-specific # tools (e.g., SealedSecrets in the cfp-sandbox-cluster). # +# CloudNativePG is the primary database target (Philthy Civic Cloud shared cluster). +# AWS RDS was used previously and may still be referenced for migration contexts. +# apiVersion: v1 kind: Secret metadata: @@ -20,8 +23,10 @@ stringData: REACT_APP_API_BASE_URL: https://balancer.sandbox.k8s.phl.io/ SECRET_KEY: randomly_generated_key_ere SQL_ENGINE: django.db.backends.postgresql - SQL_HOST: sql_host_here + # CloudNativePG (primary): shared-cluster-rw.cloudnative-pg.svc.cluster.local + # AWS RDS (legacy): balancer-db.xxxxx.us-east-1.rds.amazonaws.com + SQL_HOST: shared-cluster-rw.cloudnative-pg.svc.cluster.local SQL_PORT: '5432' - SQL_DATABASE: balancer_dev + SQL_DATABASE: balancer SQL_USER: balancer SQL_PASSWORD: sql_password_here From a1ab4ee0f9cd66172bb4582cab4b31b609e2a1ba Mon Sep 17 00:00:00 2001 From: Christopher Tineo Date: Fri, 10 Jul 2026 05:43:36 -0400 Subject: [PATCH 2/2] fix: resolve Ruff lint errors blocking CI - Move os/settings/HttpResponseNotFound imports to top in urls.py (E402) - Add noqa: E402 to django.setup()-dependent imports in eval_assistant.py - Remove unused INSTRUCTIONS import in eval_assistant.py (F401) Refs: #464 --- server/api/views/assistant/eval_assistant.py | 6 ++---- server/balancer_backend/urls.py | 7 +++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/server/api/views/assistant/eval_assistant.py b/server/api/views/assistant/eval_assistant.py index b44a2174..7584ae18 100644 --- a/server/api/views/assistant/eval_assistant.py +++ b/server/api/views/assistant/eval_assistant.py @@ -33,11 +33,9 @@ import django django.setup() -from django.contrib.auth import get_user_model +from django.contrib.auth import get_user_model # noqa: E402 -from api.views.assistant.assistant_services import run_assistant -# TODO: remove unused import or use INSTRUCTIONS to record an instructions_hash column -from api.views.assistant.assistant_prompts import INSTRUCTIONS +from api.views.assistant.assistant_services import run_assistant # noqa: E402 logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s") logger = logging.getLogger(__name__) diff --git a/server/balancer_backend/urls.py b/server/balancer_backend/urls.py index 55bd2032..999dee48 100644 --- a/server/balancer_backend/urls.py +++ b/server/balancer_backend/urls.py @@ -6,6 +6,9 @@ # Import TemplateView for rendering templates from django.views.generic import TemplateView import importlib # Import the importlib module for dynamic module importing +import os +from django.conf import settings +from django.http import HttpResponseNotFound from drf_spectacular.views import SpectacularAPIView, SpectacularSwaggerView, SpectacularRedocView @@ -58,10 +61,6 @@ path("api/redoc/", SpectacularRedocView.as_view(url_name="schema"), name="redoc"), ] -import os -from django.conf import settings -from django.http import HttpResponseNotFound - def spa_fallback(request): """Serve index.html for SPA routing when build is present; otherwise 404."""