Commit Graph

369 Commits

Author SHA1 Message Date
chrisfu
7427042694 Add KDC authority service; update registry, knoe UI, conf, and scan artifacts
- New authority/kdc Spring Boot microservice (Dockerfile, HealthController, application.properties)

- Updated authority/pom.xml, k8s/registry/deployment.yaml, knoe/ui/screens, conf, etc/ init scripts, modes/k3s/knoe-db/.version, scan artifacts

- Added project images (knoe.png, architecture diagram, screenshot)

Co-authored-by: Junie <junie@jetbrains.com>
2026-04-02 23:39:52 -07:00
chrisfu
eb9430df9d fix(gitlab,infra): ARM64 RPi service cluster – GitLab deploy in gitlab ns on gandalf
Namespace & routing
- milestones.py: GitOpsMilestone now resolves namespace from
  gitops.gitlab_namespace (new) → Global.GITLAB_NAMESPACE → 'gitlab'
  hardcoded; never falls through to gitops.namespace (was 'gitea')
- prole.cfg: add gitops.gitlab_namespace=gitlab + GITLAB_NAMESPACE=gitlab
- init_gitlab.sh: NAMESPACE defaults to gitlab, NODE_SELECTOR blanked so
  only gitaly+minio are node-pinned; GITOPS_NAMESPACE fallback removed

GitLab on ARM64 RPi (16 KB kernel pages)
- init_gitlab.sh: DaemonSet compiles jemalloc-5.3.0 with --with-lg-page=14
  (glibc/Ubuntu) on every node; LD_PRELOAD injected per Ruby component
- Minio: quay.io 2022 image (ARM64); configure init container replaced
  with ARM64 alpine that writes credential files; MINIO_ROOT_USER/PASSWORD
  injected directly into main container env via secretKeyRef
- Minio buckets auto-created post-deploy (registry, lfs, artifacts, etc.)
- webservice/sidekiq: replicaCount=1, reduced memory (1500M/800M),
  liveness probe initialDelaySeconds=3600 (Rails loads 25-40min on RPi)
- allowedHosts set as flat string list (chart 9.x default is list-of-maps
  which breaks URI initializer in 7_gitlab_http.rb)
- gitaly+minio always pinned to gandalf (local PV); other workloads spread

Storage
- Static PVs created for gitaly (50Gi) + minio (10Gi) on synology d005
- Synology dirs created before PVs; bucket creation idempotent

Redis (shared for GitLab KAS)
- init_redis.sh: persistence disabled (no dynamic provisioner); Redis used
  as pub/sub broker only

Infrastructure / pi.prole.org
- Removed pi.prole.org from [k3s_agents] – dedicated pihole node, OOM
- host_vars: k3s_enabled=false, k3s_state=absent (storage preserved)
- New playbook: infrastructure/playbooks/disable_pi_k3s.yml (drain + disable)
- monitoring.py: node-exporter DaemonSet excludes pi.prole.org
- init_monitoring.sh: pi.prole.org excluded from node-exporter affinity
- kong-deployment.yaml: affinity rule prevents scheduling on pi (pihole owns 80/443)

Co-authored-by: Junie <junie@jetbrains.com>
2026-04-02 20:15:11 -07:00
chrisfu
2bcc40fd50 fix(prole-auth): update tests for SessionUser groups field
SessionUser record was extended with List<String> groups in the groups
feature; test constructors still used the old 2-arg form.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 16:56:09 -07:00
chrisfu
e3ca33e4c7 feat(installer): add Knoe User Accounts screen after Kerberos provisioning
New KnoeUsersScreenMixin screen (knoe_users) appears in the install wizard
immediately after Kerberos Authentication (when kerberos is enabled).

- Runs etc/init_knoe_users.sh initialize in a background thread with live
  console output, forwarding SERVICE_NAMESPACE/KNOE_KDC_NAMESPACE from the
  installer state so the script always targets the right namespace
- Optional Gitea and GitLab admin token fields for service admin promotion
- Next button is disabled until provisioning succeeds (idempotent: button
  re-enables on failure so the user can fix and retry)
- Nav chain: kerberos_config -> knoe_users -> argocd_config
  Prev from argocd_config respects kerberos_enabled to route correctly
- Records STATUS in prole.cfg under [Knoe User Accounts] section

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 21:45:24 -07:00
chrisfu
e2dd122111 fix(init_knoe_users): namespace/secret resolution aligned with init_kdc.sh
- Add PROLE_KDC_NAMESPACE to namespace fallback chain; never falls to default
- Add get_secret_value() helper mirroring init_kdc.sh pattern
- Log resolved namespaces at startup
- Improve PROLE_KDC_MASTER_PASSWORD error with actionable resolution steps

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 21:34:41 -07:00
chrisfu
83938eba51 fix: use correct KDC pod label selector (app=auth not app=prole-auth)
The auth deployment in knoe-system uses label app=auth; init_knoe_users.sh
was searching for app=prole-auth causing the pod lookup to always fail.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 20:56:53 -07:00
chrisfu
872d715864 feat: Kerberos identity management — PROLE.LOCAL realm, cross-realm trust, user provisioning
Kerberos is now the single source of truth for all knoe-system accounts.

In-cluster KDC (PROLE.LOCAL):
- Rename in-cluster KDC realm PROLE.ORG → PROLE.LOCAL to avoid collision
  with the myrddin.prole.org Samba AD DC which owns PROLE.ORG
- Add [capaths] cross-realm trust block: PROLE.ORG (Samba AD) ↔ PROLE.LOCAL
- Create admin@PROLE.LOCAL on KDC startup (master password) for UI login
- Create guest@PROLE.LOCAL on KDC startup (read-only, PROLE_KDC_GUEST_PASSWORD)
- Update prole-kdc-secrets.example.yaml with trust_shared_password and guest_password
- Update prole-auth-kerberos ConfigMap realm/servicePrincipal to PROLE.LOCAL
- Add PROLE_AUTH_ADMIN_PRINCIPALS and PROLE_KDC_GUEST_PASSWORD to prole-auth Deployment

Database (knoe-db — k3s and GKE):
- Add spec.managed.roles: admin (superuser), guest (login), developer (group)
- Enable GSS pg_hba rules for both PROLE.ORG and PROLE.LOCAL realms
- Add krb_server_keyfile parameter for postgres service principal keytab
- Mount knoe-db-pg-keytab Secret via spec.additionalVolumes
- Add demo schema in postInitSQL with guest read-only grants

prole-auth (Spring Boot):
- SessionUser: add List<String> groups field
- AuthProperties: add adminPrincipals list (env: PROLE_AUTH_ADMIN_PRINCIPALS)
- LoginController: stamp groups=["admin"] for configured admin principals at login
- SessionTokenService: carry groups through TokenPayload; @JsonIgnoreProperties
  for backward compat with existing 2-field session cookies
- VerifyController: emit X-Prole-Groups header on /auth/verify
- grafana-proxy nginx: strip inbound X-Prole-Groups; capture and forward from auth

Services:
- ArgoCD (k3s + GKE): add g, admin, role:admin to argocd-rbac-cm policy.csv

etc/init_knoe_users.sh (new):
- Orchestrates full user provisioning: KDC principals, postgres keytab export,
  CNPG managed.roles patch, demo schema SQL, ArgoCD RBAC patch,
  Gitea and GitLab admin promotion via API
- Actions: initialize | status | cleanup
- Idempotent; sources prole_cfg.sh; follows existing init_*.sh style

Cross-realm trust activation (myrddin side):
  samba-tool user add krbtgt_PROLELOCAL --random-password
  samba-tool user setpassword krbtgt_PROLELOCAL --newpassword=<trust_shared_password>
  samba-tool spn add "krbtgt/PROLE.LOCAL" krbtgt_PROLELOCAL -U administrator
  samba-tool user setexpiry krbtgt_PROLELOCAL --noexpiry

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-04-01 20:38:57 -07:00
chrisfu
bb92ec3576 feat: service layer — GitLab, Redis, DB ArgoCD app, Kong, monitoring updates
- Add init_redis.sh for Redis deployment
- Extend init_gitlab.sh with Kerberos/OIDC prep and service wiring
- Add init_monitoring.sh improvements
- Update init_kong.sh and init_service_layer.sh
- Rename ArgoCD application-openbao → application-db; add DB kustomization
- Update kong-configmap, kustomization, port-mapping, service configs
- Bump knoe-db version; refresh network scan

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-04-01 20:38:57 -07:00
chrisfu
121b7b9d1b
Merge pull request #1 from dredx/claude/quirky-napier
feat: GitLab deployment pipeline — operator fix, CI config, and names…
2026-04-01 15:29:27 -07:00
chrisfu
5715add366 feat: GitLab deployment pipeline — operator fix, CI config, and namespace isolation
- etc/init_gitlab.sh: Add global.redis block (host/port/auth) to the GitLab CR so
  the chart does not fail NOTES.txt validation when redis.install: false.
  Drop the GITOPS_NAMESPACE config fallback in namespace resolution to prevent the
  Gitea namespace from bleeding into GitLab deployments; GITLAB_NAMESPACE is now the
  sole source of truth with a hard default of "gitlab".
- knoe/core/milestones.py: Fix GitOpsMilestone to route to init_gitlab.sh when
  gitops.git_provider = GitLab (was hardcoded to init_gitea.sh). Namespace resolution
  now prefers gitops.gitlab_namespace input key, then gitops.namespace, then "gitlab" —
  never picks up a stale GITLAB_NAMESPACE from the OS environment.
- conf/service/prole.cfg: Switch gitops.git_provider / GITOPS_PROVIDER to GitLab.
  Update accumulated runtime state from install runs.
- install.sh: Prefer the repo-local venv Python (PROLE_HOME/bin/python3) so that
  PyYAML and other prole_requirements.txt deps are always available.
- .gitlab-ci.yml: New CI pipeline — on every push to main, run the silent install
  (./install.sh -S -c conf/service/prole.cfg) to deploy a fresh CNPG ecosystem.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 15:26:39 -07:00
chrisfu
620bdd25eb feat: GKE production deployment — CNPG + GCS backups + Google Workspace SSO
Add complete GKE deployment stack:
- deploy/gcp/gke/: namespace, CloudNativePG cluster (premium-rwo, 100Gi),
  GCS barman-cloud backup with Workload Identity SA, ArgoCD OIDC ConfigMap,
  GitLab OmniAuth secret template, knoe-auth Google OIDC secret template
- etc/init_cnpg_gke.sh: provision GCS buckets, GCP SA, WI binding, CNPG operator
- etc/init_argocd.sh: apply argocd-oidc-cm.yaml when PLATFORM_DOMAIN/FRONTDOOR_HOST set
- etc/init_gitlab.sh: inject OmniAuth openid_connect block when FRONTDOOR_HOST set
- prole-auth-deployment.yaml: add GOOGLE_OIDC_ENABLED env vars (all optional)
- supabase/helm/prole-supabase/values-gke.yaml: GoTrue Google OAuth overlay
- knoe/core/prod_config.py: add backupProvider, workloadIdentitySA, googleClientId/Secret/HostedDomain

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 10:41:55 -07:00
chrisfu
68e4a5418c chore: checkpoint non-transitory state (excluded transient tmp render-check artifacts)
Co-authored-by: Junie <junie@jetbrains.com>
2026-04-01 01:43:39 -07:00
chrisfu
e9e53aac40 Migrate install.py logic to install.sh and restructure installer flow. Update core references, tests, and navigation to reflect the new Knoe installer architecture. 2026-04-01 01:17:04 -07:00
chrisfu
c8505e6976 Replace gcloud auth login with in-TUI email + access token credential form
Remove all browser/device-code auth flows. User now enters their Google
account email (visible) and access token (masked) directly in the ncurses
TUI. Token is passed as CLOUDSDK_AUTH_ACCESS_TOKEN env var to all gcloud
calls — no gcloud auth state is modified. Token email is resolved via
the Google tokeninfo endpoint for display only.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-31 23:35:40 -07:00
chrisfu
fabd1a3463 Fix gcloud auth login output capture swallowing device-code URL
gcloud auth login --no-browser was called via _gcloud_plain which uses
capture_output=True, silently swallowing the device-code URL that the
user needs to complete authentication. Run it directly with no capture.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-31 23:21:19 -07:00
chrisfu
2a03bfa395 Add root config.py installer utilities module
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-31 23:15:54 -07:00
chrisfu
2e517686a8 Add GCP ncurses TUI to knoe/config.py and config.sh launcher
Consolidates the GCP cluster configuration TUI (formerly etc/config.py)
into knoe/config.py as a __main__ entrypoint, resolving the naming
collision with the root-level installer utilities module. Adds config.sh
as a thin shell launcher at the project root. Also excludes .claude/
worktree directories from git and IDE indexing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-31 23:15:54 -07:00
chrisfu
93f7259722 chore: checkpoint k3s deployment and knoe updates
- update Kong/Supabase ingress and service manifests for k3s

- expand init scripts and runtime config/topology handling

- refresh KNØE UI screens and Supabase deployment/render logic

- include related env helper test adjustments

Co-authored-by: Junie <junie@jetbrains.com>
2026-03-31 23:15:54 -07:00
chrisfu
c0a7d0c5dc Refine installer orchestration and Supabase rendering paths
- improve installer/action/controller flow and shell-variable expansion handling across screens\n- adjust Supabase Helm rendering and storage deployment templates\n- align monitoring, cloudnative-pg and repair pipeline behavior with updated config paths\n- refresh and expand installer/core regression tests around milestones, navigation and repair logic

Co-authored-by: Junie <junie@jetbrains.com>
2026-03-31 23:15:54 -07:00
chrisfu
c65d336d1f Make init-script secret checks warning-only and unblock Next
Co-authored-by: Junie <junie@jetbrains.com>
2026-03-31 23:15:54 -07:00
chrisfu
5a0f8ab4f8 Make init-script secret checks warning-only and unblock Next
Co-authored-by: Junie <junie@jetbrains.com>
2026-03-30 01:26:38 -07:00
chrisfu
6232bd89ee Merge remote-tracking branch 'origin/main'
# Conflicts:
#	tests/installer/test_services_init_scripts.py
2026-03-30 00:46:56 -07:00
chrisfu
22420408f9 Align installer namespace/topology handling and add regression tests
Co-authored-by: Junie <junie@jetbrains.com>
2026-03-29 23:45:56 -07:00
chrisfu
ae42d4607b Align installer namespace/topology handling and add regression tests
Co-authored-by: Junie <junie@jetbrains.com>
2026-03-29 23:08:14 -07:00
chrisfu
4164cf9f87 Update port mappings, Supabase configuration, and network discovery data
- Refactor `conf/port-mapping.cfg` to remove unused Supabase forwards and adjust namespace for PostgreSQL.
- Overhaul `conf/service/prole.cfg` to enable additional Supabase features (auth, analytics, meta) and update secrets/config keys.
- Refresh Kerberos and CNPG placement plan settings.
- Update network scan artifacts to reflect current device topology.
2026-03-29 19:44:13 -07:00
chrisfu
fdc1582bd0 Fix DB image build and k3s registry/CNPG robustness
- update Percona Dockerfiles for compatible extension/tooling install flow\n- add HTTP/HTTPS-aware k3s registry configuration path across scripts/Ansible\n- harden CNPG TLS bootstrap CN handling for long namespaces and add regression test\n- improve namespace reset pod-deletion wait behavior

Co-authored-by: Junie <junie@jetbrains.com>
2026-03-29 19:35:37 -07:00
chrisfu
d02aadae89 Add node management workflow and installer config persistence updates
- add tools/manage-node.sh for k3s node add/remove automation with inventory reconciliation

- include kubectl drain flag compatibility and --ssh-host targeting for uninstall workflows

- persist installer cfg/env values and update deploy/database/cfg UI handling

- refresh related inventory/network artifacts and expand installer/database test coverage

Co-authored-by: Junie <junie@jetbrains.com>
2026-03-29 11:22:33 -07:00
chrisfu
7b242e88f5 Persist k3s context rename and scrub service config paths
Update conf/service/prole.cfg to persist the k3s kube context as knoe.dev.prole.org and replace host-specific absolute paths with $HOME-based paths for portability.

Include all pending project changes: local_user role package and screenrc provisioning updates, plus tools/k3s-cluster-rename.sh and tests/etc/test_k3s_cluster_rename.sh.

Co-authored-by: Junie <junie@jetbrains.com>
2026-03-28 11:23:19 -07:00
chrisfu
c5666b5233 Merge remote-tracking branch 'origin/main'
# Conflicts:
#	infrastructure/inventory/host_vars/gandalf.prole.org.yml
2026-03-28 10:43:39 -07:00
chrisfu
fb7993de1d feat: add production config schema, validation, and API with tests
- Introduced `knoe.core.prod_config` with production configuration schema and helper methods.
- Added validation logic to enforce required fields and expected formats.
- Implemented in-process API (`ProdConfigApi`) for managing production configs.
- Added test coverage for default config behavior, validation, YAML generation, and API workflow.
- Updated cluster UI layout and tests to integrate production config with new navigation flows.
- Added host inventory and updated service flow to reflect production setup changes.
2026-03-28 10:43:25 -07:00
chrisfu
7ca5eb0b2d feat: add production config schema, validation, and API with tests
- Introduced `knoe.core.prod_config` with production configuration schema and helper methods.
- Added validation logic to enforce required fields and expected formats.
- Implemented in-process API (`ProdConfigApi`) for managing production configs.
- Added test coverage for default config behavior, validation, YAML generation, and API workflow.
- Updated cluster UI layout and tests to integrate production config with new navigation flows.
- Added host inventory and updated service flow to reflect production setup changes.
2026-03-28 09:29:36 -07:00
chrisfu
15890187a3 Stabilize CNPG reset/update flow and finalize 3-node recovery
- add idempotent CNPG operator reconciliation to prevent duplicate active controller ReplicaSets
- restore and validate CNPG 3-instance convergence with PV claimRef recovery and storage path readiness
- wire canonical launcher aliases/reset behavior and improve namespace cleanup semantics
- harden backup/objectstore readiness handling and retry behavior
- enforce service namespace usage for common services and remove default-namespace drift
- enable Kerberos milestone auto-activation when realm/kdc are configured and apply CNPG GSS pg_hba rules
- keep final runtime healthy: knoe-db 3/3, operator stable, perfsnap captured

Co-authored-by: Junie <junie@jetbrains.com>
2026-03-27 21:54:53 -07:00
chrisfu
761d80486b feat: add storage probing and operational service updates
- add reusable storage probing subsystem with discovery, bounded probe execution, IO classification, caching, and topology integration

- render per-node storage inventory in Cluster Nodes UI and extend installer test coverage for topology/storage behavior

- introduce core service operation modules and align actions, milestones, services, and supporting configs/scripts for repair/update workflows

- update CNPG/Supabase/database artifacts, placement and port mapping configs, plus related integration tests

Co-authored-by: Junie <junie@jetbrains.com>
2026-03-26 09:44:23 -07:00
chrisfu
65d03ed442 stable: slimmed Supabase + CNPG 3-node healthy build (2026-03-25)
STABLE BUILD — all 35+ pods Running, zero non-Running pods, CNPG ready=3.

## Architecture changes (Supabase slim-down)
- Removed local Supabase Kong, Storage, MinIO, Imgproxy from deployed stack
- Rewired API routing to shared Kong in kube-system
- Rewired object storage to shared Garage in knoe-system
- Supabase footprint reduced to control-plane only: auth, rest, meta,
  analytics, realtime (studio port-forward retained)
- Supabase pods renamed: stripped redundant '-prole-supabase-' prefix via
  per-component fullnameOverride (e.g. supabase-auth, supabase-rest, ...)
- Supabase workloads pinned to merlin.prole.org (memory-safe node)

## File changes
- conf/service/prole.cfg
    * Replaced all hardcoded /Users/chrisfu/dev/prole paths with ${HOME}/dev/prole
      so config is portable when run from myrddin.prole.org or any user home
    * SUPABASE_ENABLED=True, SUPABASE_PRIMARY_NODE=merlin.prole.org in
      both [Global] and [Optional Features]
    * supabase_enabled=true in [Inputs]/init_cluster section
- supabase/helm/render_supabase.py
    * Explicitly disabled: kong, storage, minio, imgproxy
    * Active components pinned via nodeSelector to merlin.prole.org
    * fullnameOverride per component to clean up pod names
    * Default primary node changed from pi.prole.org -> merlin.prole.org
- supabase/deploy.sh
    * Removed svc/kong port-forward; API via shared Kong in kube-system
    * Removed imgproxy/storage from PV/PVC prep and helm --set persistence args
    * Fixed kubectl exec missing -i flag for psql heredoc stdin in
      setup_knoe_db_for_supabase
    * Updated Studio access messaging to reference shared platform Kong
- k8s/prole/knoe-db.yaml
    * instances: 3
    * Added control-plane/master tolerations for myrddin scheduling
- deploy/opentofu/k3s/manifests/prole/knoe-db.yaml
    * instances: 3, added control-plane tolerations (mirrors k8s/prole/)
- k8s/prole/iscsi-pvs.yaml
    * Expanded d003-data/d003-wal nodeAffinity to [pi, merlin, myrddin]
      to reflect post-OOM-recovery live state
- k8s/registry/deployment.yaml
    * nodeSelector restored to myrddin.prole.org (hostPort 5000 owner)
    * Added control-plane + master tolerations so pod schedules correctly
- modes/k3s/knoe-db/.version
    * Aligned to 140 (image tag 18-140) matching repo-root version
- etc/init_common_services.sh, etc/init_registry.sh
    * Minor fixes aligned with slimmed service layout and node targeting
- infrastructure/inventory/host_vars/pi.prole.org.yml
    * Updated host vars to reflect post-recovery pi state
- knoe/core/topology.py, knoe/ui/screens/cluster.py,
  knoe/ui/screens/cluster_nodes.py
    * Topology and UI updates for 3-node cluster representation
- scan/network_description.txt
    * Refreshed network scan output post-recovery
- conf/port-mapping.cfg
    * Updated port mapping to reflect removal of local Kong/storage forwards
- scripts/cleanup_stale_rs.sh (new)
    * Utility script to prune orphaned ReplicaSets after rollouts

## Verified stable state
- CNPG: Cluster in healthy state, ready=3
    knoe-db-2 (merlin, primary), knoe-db-3 (pi), knoe-db-5 (myrddin)
- Supabase: 5 pods Running on merlin.prole.org
    supabase-auth, supabase-rest, supabase-meta,
    supabase-analytics, supabase-realtime
- Monitoring: all prometheus/grafana/alertmanager pods Running on merlin
- Registry: Running on myrddin.prole.org (hostPort 5000)
- Zero non-Running / non-Completed pods across all namespaces

Co-authored-by: Junie <junie@jetbrains.com>
2026-03-25 11:56:40 -07:00
chrisfu
d7b6d62177 remove hard coded home dir paths 2026-03-25 00:40:40 -07:00
chrisfu
b58ffd2551 Merge remote-tracking branch 'origin/main'
# Conflicts:
#	conf/service/prole.cfg
2026-03-24 22:13:15 -07:00
chrisfu
a1177d71bc Add GitOps provider choice screen and cluster UI improvements
- Add _render_gitops_choice_page() to GitOpsScreenMixin for explicit
  Gitea / ArgoCD / None provider selection with radio buttons
- Extend cluster screen with GitOps provider radio group and canvas layout
- Refactor services screen layout and navigation registration
- Register new gitops choice screen in screens __init__ / navigation
- Expand Kong init scripts (etc/ and mock_val/) with additional logic
- Update init_cnpg_backup.sh with minor fix
- Refresh conf/service and conf/prod prole.cfg generated configs
- Update conf/port-mapping.cfg port entries
- Update Supabase Helm values.yaml
- Bump modes/k3s/knoe-db/.version
- Update network scan description
- Add/expand tests: test_cluster_screen_layout, test_gitops_choice_screen

Co-authored-by: Junie <junie@jetbrains.com>
2026-03-24 22:12:25 -07:00
chrisfu
46a6923bc8 merge myrddin prole.cfg 2026-03-24 18:20:56 -07:00
chrisfu
43fd34ea87 Fix svc.prole.org login: add GOTRUE_URI_ALLOW_LIST for multi-origin auth
- render_supabase.py: read SUPABASE_ADDITIONAL_REDIRECT_URLS from cfg,
  normalise each entry to https://.../** wildcard, inject as GOTRUE_URI_ALLOW_LIST
  in GoTrue auth env so logins from svc.prole.org are accepted
- conf/service/prole.cfg: set SUPABASE_ADDITIONAL_REDIRECT_URLS=svc.prole.org
- actions.py: preserve SUPABASE_ADDITIONAL_REDIRECT_URLS in globals_to_save
  so pipeline write-back never clobbers it
- k8s/prole/merlin-local-iscsi-storageclass.yaml: register StorageClass
  merlin-local-iscsi-d002 (no-provisioner/Immediate) to silence
  ProvisioningFailed warnings on static Supabase PVs

Result: all 9 Supabase pods Running; svc.prole.org login origin accepted by GoTrue

Co-authored-by: Junie <junie@jetbrains.com>
2026-03-24 17:46:24 -07:00
chrisfu
9ad1054a55 STABLE BUILD: All 9 Supabase pods Running on merlin, db.prole.org live (HTTP 401)
Fix supabase-storage migration deadlock: ALTER ROLE search_path + BYPASSRLS

Root cause: supabase_storage_admin had no rolconfig search_path, so the connection
string search_path=auth caused the service to query auth.migrations (not found →
currentMigrations=[]) but insert migration tracking rows into public.migrations
(via PostgreSQL implicit public fallback). On restart, currentMigrations was always
[] despite public.migrations having rows, causing duplicate-key on migration 0.

Fix (added to deploy.sh db init block, idempotent on every reinstall):
  ALTER ROLE supabase_storage_admin SET search_path = storage, auth, public;
  ALTER ROLE supabase_storage_admin BYPASSRLS;
  TRUNCATE TABLE IF EXISTS public.migrations;
  DROP TABLE IF EXISTS storage.migrations CASCADE;

This aligns migration reads and writes to the same schema (storage first, then auth,
then public) and ensures a clean slate on every redeploy.

Result: all 9 Supabase pods Running on merlin.prole.org (merlin-local-iscsi-d002 iSCSI
storage), db.prole.org returns HTTP 401 (Supabase Studio auth gate = live and working),
CNPG knoe-db 2/2 Ready on merlin + myrddin with Percona PostgreSQL 18 + Barman backup.

Co-authored-by: Junie <junie@jetbrains.com>
2026-03-24 15:19:10 -07:00
chrisfu
e0616fda3f STABLE BUILD: Supabase running on merlin.prole.org with CNPG backend (knoe-db)
All 9 Supabase pods Running on merlin.prole.org backed by merlin-local-iscsi-d002
(/synology/d002) iSCSI storage. db.prole.org (HTTP 401 = auth gate = reachable).
CNPG cluster knoe-db 2/2 Ready (merlin + myrddin), Percona PostgreSQL 18, Barman backup.

Key fixes in this build:
- supabase_enabled=true now honored in silent mode (actions.py override removed)
- SUPABASE_STORAGE_CLASS/PV_NODE/PRIMARY_NODE pinned to merlin in prole.cfg
- _write_cfg preserves SUPABASE_* vars from existing cfg (no pipeline write-back clobber)
- render_supabase.py writes persistence.*.storageClassName (correct Helm chart path)
- deploy.sh: synology guard prevents non-iSCSI storage; --set persistence.* all modes;
  stale values.generated.json deleted before every render; live DB_PASSWORD from secret
- init_monitoring.sh: pv_prom/pv_am/pv_graf derived inline before Released-PV loop
- k8s/prole/knoe-db.yaml: instances=2 (pi excluded), maxSyncReplicas=0
- Static PVs merlin-supabase-{functions,imgproxy,snippets,storage} created on merlin
- storage.migrations DROP fixes idempotent reinstall conflict from prior deploy

Co-authored-by: Junie <junie@jetbrains.com>
2026-03-24 14:59:19 -07:00
chrisfu
5a7a7a5a91 Remove generated values.generated.json from git; add to .gitignore
Co-authored-by: Junie <junie@jetbrains.com>
2026-03-24 14:40:02 -07:00
chrisfu
80323afd10 Fix Supabase storage class injection: write persistence.*.storageClassName, add synology guard
Root cause: render_supabase.py wrote to deployment.*.storageClass (ignored by Helm chart PVC
templates) instead of persistence.*.storageClassName (_pvc.tpl:43 is the real path). Also
deploy.sh --set persistence.* args only ran in k8s mode, and stale values.generated.json
was reused across deploys. Together these caused Supabase PVCs to fall through to
pi-local-iscsi (pi SD card), crashing the node under memory pressure.

- supabase/helm/render_supabase.py:
  - write persistence.{functions,imgproxy,snippets,storage,deno,minio}.storageClassName
    using the correct Helm chart path (_pvc.tpl:43)
  - add synology guard: raise SystemExit if storage class is not synology/merlin/myrddin
  - remove broken deployment.*.storageClass writes
- supabase/deploy.sh:
  - delete stale values.generated.json before every helm_render_values call
  - fall back to reading SUPABASE_STORAGE_CLASS from cfg file via python3 if env not set
  - add bash synology guard: die if storage class is not iSCSI/NFS mounted
  - extend helm_set_args to include persistence.minio.storageClassName and apply
    --set persistence.* for ALL modes (not just k8s)

Co-authored-by: Junie <junie@jetbrains.com>
2026-03-24 14:39:43 -07:00
chrisfu
36afcec298 Fix port-mapping.cfg: add missing [PortMappings] section header for configparser
Co-authored-by: Junie <junie@jetbrains.com>
2026-03-24 14:28:55 -07:00
chrisfu
6f3f62f829 Fix Supabase storage class injection: write persistence.*.storageClassName, add synology guard
Root cause: render_supabase.py wrote to deployment.*.storageClass (ignored by Helm chart PVC
templates) instead of persistence.*.storageClassName (_pvc.tpl:43 is the real path). Also
deploy.sh --set persistence.* args only ran in k8s mode, and stale values.generated.json
was reused across deploys. Together these caused Supabase PVCs to fall through to
pi-local-iscsi (pi SD card), crashing the node under memory pressure.

- supabase/helm/render_supabase.py:
  - write persistence.{functions,imgproxy,snippets,storage,deno,minio}.storageClassName
    using the correct Helm chart path (_pvc.tpl:43)
  - add synology guard: raise SystemExit if storage class is not synology/merlin/myrddin
  - remove broken deployment.*.storageClass writes
- supabase/deploy.sh:
  - delete stale values.generated.json before every helm_render_values call
  - fall back to reading SUPABASE_STORAGE_CLASS from cfg file via python3 if env not set
  - add bash synology guard: die if storage class is not iSCSI/NFS mounted
  - extend helm_set_args to include persistence.minio.storageClassName and apply
    --set persistence.* for ALL modes (not just k8s)

Co-authored-by: Junie <junie@jetbrains.com>
2026-03-24 14:27:15 -07:00
chrisfu
6f29deba99 Supabase/CNPG stability: pin Supabase to merlin, reduce CNPG to 2 instances, fix supabase_enabled
Changes address resource pressure (merlin OOM with 3 CNPG + Supabase + monitoring) and
the supabase_enabled=false override in silent mode that blocked Supabase deploy.

- conf/service/prole.cfg:
  - SUPABASE_PV_NODE/SUPABASE_PRIMARY_NODE = merlin.prole.org (d002 storage)
  - SUPABASE_STORAGE_CLASS = merlin-local-iscsi-d002
  - CNPG_ELIGIBLE_NODES: removed pi.prole.org (pi NotReady, d003 inaccessible)
- k8s/prole/knoe-db.yaml:
  - instances: 3 -> 2 (merlin + myrddin only, pi excluded)
  - maxSyncReplicas: 1 -> 0 (safe for 2-node cluster)
- supabase/deploy.sh:
  - default SUPABASE_PV_NODE to merlin.prole.org, base dir to /synology/d002/supabase
  - add idempotent ALTER ROLE password sync after CREATE ROLE IF NOT EXISTS
  - resolve live DB_PASSWORD from knoe-db-superuser secret before helm render
- supabase/helm/render_supabase.py:
  - resolve SUPABASE_STORAGE_CLASS from env/cfg, apply to storage/analytics PVCs
  - DATABASE_NAMESPACE resolution: check env + cfg Global section before discovery
  - DB_PASSWORD from env takes priority over cfg (live cluster secret wins)
  - default primary node = merlin.prole.org
- knoe/ui/screens/cluster.py: minor display update

Co-authored-by: Junie <junie@jetbrains.com>
2026-03-24 13:52:38 -07:00
chrisfu
498a7f0412 Migrate Supabase to pi.prole.org, fix supabase_enabled override, monitoring PV vars
Memory pressure on merlin (95% OOM with monitoring + CNPG replica + Supabase) resolved
by moving Supabase workload to pi.prole.org which has headroom (49% memory, 2 pods).

- conf/service/prole.cfg: set SUPABASE_PV_NODE, SUPABASE_PRIMARY_NODE=pi.prole.org,
  SUPABASE_STORAGE_CLASS=pi-local-iscsi, SUPABASE_PV_BASE_DIR for rancher local-path
- supabase/helm/render_supabase.py: resolve SUPABASE_STORAGE_CLASS from env/cfg,
  apply pi-local-iscsi to storage/analytics PVCs, resolve DATABASE_NAMESPACE for
  correct db_host, DB_PASSWORD env override takes priority for live cluster password
- supabase/deploy.sh: default SUPABASE_PV_NODE to pi.prole.org, default base dir to
  /var/lib/rancher/k3s/storage/supabase, add idempotent ALTER ROLE password sync,
  live DB_PASSWORD resolution in helm_render_values from knoe-db-superuser secret
- knoe/core/actions.py: stop overriding init_cluster.supabase_enabled to False in
  silent mode so prole.cfg value is honored end-to-end
- etc/init_monitoring.sh: derive pv_prom/pv_am/pv_graf inline before Released-PV
  loop to fix unbound variable error on idempotent monitoring installs

Co-authored-by: Junie <junie@jetbrains.com>
2026-03-24 12:01:02 -07:00
chrisfu
5e7c03324e Fix Supabase deploy: honor supabase_enabled, pin dirprep to merlin (d002), fix monitoring PV vars
- actions.py: stop overriding init_cluster.supabase_enabled to False in silent mode
- supabase/deploy.sh: change SUPABASE_PV_NODE default from myrddin to merlin.prole.org
  so prole-supabase-dirprep job runs on the node that owns /synology/d002
- conf/service/prole.cfg: add SUPABASE_PV_NODE and SUPABASE_PV_BASE_DIR to [Global]
  so prole_cfg.sh exports them explicitly on every run
- init_monitoring.sh: derive pv_prom/pv_am/pv_graf inline before Released-PV loop
  to fix unbound variable error on idempotent monitoring installs

Co-authored-by: Junie <junie@jetbrains.com>
2026-03-24 00:16:26 -07:00
chrisfu
b138bb59b9 Fix: honor supabase_enabled=true in silent mode k3s pipeline
Remove hardcoded override that reset init_cluster.supabase_enabled to
False inside _prepare_k3s_pipeline before _write_cfg() persisted the
value back to prole.cfg. The [Inputs] section in prole.cfg correctly
carries supabase_enabled = true; the pipeline must not clobber it.

- render_supabase.py already defaults ingress host to db.prole.org
- SupabaseMilestone is already wired in the run() milestones list
- No other changes required; single-line removal unblocks Supabase deploy

Co-authored-by: Junie <junie@jetbrains.com>
2026-03-23 23:46:08 -07:00
chrisfu
037f38729a STABLE BUILD: k3s deployment milestone complete
Idempotent k3s pipeline verified end-to-end:
- CNPG cluster knoe-db running Percona PostgreSQL 18
- Barman Cloud backup/objectstore configured and ready
- Monitoring stack deployed (Prometheus, Grafana, Alertmanager)
- PV/PVC lifecycle guards prevent stale-claim deadlocks
- TLS and DB user secrets bootstrapped idempotently
- Port-mapping regenerated from live cluster state

Stage 2 Python cutover complete:
- etc/init_cloudnative_pg.sh removed from runtime and git
- knoe/core/ops/cloudnative_pg.py is the sole CNPG owner
- All runtime paths dispatch through Python, no shell bridge remains

All 61 installer tests pass. Declare as stable.

Co-authored-by: Junie <junie@jetbrains.com>
2026-03-23 23:38:09 -07:00