-
Notifications
You must be signed in to change notification settings - Fork 0
postgres gc10 Declarative Setup Summary
Hamzaukw edited this page Sep 8, 2025
·
1 revision
The PostgreSQL configuration has been updated to be fully declarative, eliminating the need for manual intervention to run the service with the endoreg-service-user. All database users, passwords, and authentication are now managed automatically by NixOS.
Added:
- Automatic password generation for
endoregDbLocaluser - Systemd service
postgres-endoreg-setupthat:- Generates password if it doesn't exist
- Sets password in PostgreSQL
- Manages file permissions securely
- Proper secret file management with group permissions
Key Features:
- Password stored in
/etc/secrets/vault/SCRT_local_password_maintenance_password - File permissions:
640with groupsensitiveServices - Automatic PostgreSQL user password synchronization
Changes:
- Removed manual password generation logic
- Added dependency on
postgres-endoreg-setup.service - Simplified password handling (reads from vault)
- Error handling if password not available
Added:
-
endoreg-service-useris now member ofsensitiveServicesgroup - Can read password files securely
Added:
- Comprehensive declarative setup explanation
- Verification commands
- Deployment instructions
- Troubleshooting guide for new setup
Modified:
- Added notices that scripts should no longer be needed
- Kept for legacy troubleshooting only
sudo nixos-rebuild switchsystemctl status postgresql
systemctl status postgres-endoreg-setup
systemctl status endo-api-bootPGPASSWORD="$(sudo cat /etc/secrets/vault/SCRT_local_password_maintenance_password)" \
psql -h localhost -U endoregDbLocal -d endoregDbLocal -c "SELECT current_user;"- Fully Declarative: No manual intervention required
- Secure: Proper file permissions and group-based access
- Reliable: Service dependencies ensure proper startup order
- Maintainable: Centralized password management
- Debuggable: Clear service states and logs
/home/admin/dev/luxnix/modules/nixos/roles/postgres-default/default.nix/home/admin/dev/luxnix/modules/nixos/services/endoreg-db-api-local/default.nix/home/admin/dev/luxnix/modules/nixos/user/endoreg-service-user/default.nix/home/admin/dev/luxnix/postgres-documentation.md/home/admin/dev/luxnix/scripts/fix-postgres-gc10.sh
-
System Boot:
- PostgreSQL starts
-
postgres-endoreg-setupservice runs - Password is generated/verified
-
endoregDbLocaluser password is set -
endo-api-bootservice starts
-
No Manual Steps Needed:
- No need to run scripts
- No need to manually create users
- No need to set passwords
- No need to modify pg_hba.conf
- Deploy the configuration with
sudo nixos-rebuild switch - Verify everything works as expected
- Test that the service can connect to the database
- Remove or archive the manual fix scripts once confirmed working
The setup should now work completely without manual intervention!
- Installation Guide - NixOS and Setting Up Luxnix
- Flake.nix & Garbage Collection
- Access Management
- Roles
- LX Cheatsheet
- tmux CLI Cheatsheet
- Deployment Guide
- Development
- Hardware Setup
- Network Architecture
- Security Improvements
- Security
- Service Architecture
- User Management
- Systemd tmpfiles Rules in NixOS
- Common Errors
- NixOs Configuration Testing with Eval
- System Language Change
- Roles Documentation
- Doc Maintenance Schedule
- Luxnix Server Setup with example
- Postgres Config Guide
- Postgres Documentation
- Postgres gc-10 Declarative Setup Summary
- Endoreg Central Architecture
- Readme
- Ansible CMDB Readme
- Process flow of creating Hosts, Roles, Groups
- Adding a New User Configuration
- Maintenance & Security: Auto Update #6
- Home Configuration Autoconf Flow (Step-by-Step)
- Guide to Define New Setting With Example
- Autoconfig- create inventory.yml using Python Script
- Updated : Generating home config files using autoconfig
- git
- vscode
- fix_long_lines
- kernel
- keycloak-setup
- network
- setup-mail
- setup-s04
- syncthing
- 2025-01-29 - postgres