# PostgreSQL Database Template # Extracted from wuji infrastructure patterns (real production config) # Provides PostgreSQL configuration with proven settings import taskservs.databases.postgres.kcl.postgres as postgres # Base PostgreSQL configuration schema from wuji production schema PostgresBase: # Version configuration (from wuji production) postgres_version: str = "1.16" vers_num: int = 16 # Path configuration (production-tested paths from wuji) run_path: str = "/usr/bin/psql" lib_path: str = "/var/lib/postgresql" data_path: str = "/var/lib/postgresql/16/main" etc_path: str = "/etc/postgresql" config_file: str = "postgresql.conf" # User configuration (standard PostgreSQL setup) run_user: str = "postgres" run_group: str = "postgres" run_user_home: str = "/var/lib/postgresql" # Database configuration database_name: str = "main" listen_addresses: str = "*" port: int = 5432 # Performance configuration shared_buffers: str = "256MB" effective_cache_size: str = "1GB" maintenance_work_mem: str = "64MB" checkpoint_completion_target: float = 0.9 wal_buffers: str = "16MB" default_statistics_target: int = 100 # Connection configuration max_connections: int = 100 # Additional configuration custom_config: {str:any} = {} # Performance configurations for different environments _postgres_performance_configs = { development: { shared_buffers: "128MB" effective_cache_size: "512MB" max_connections: 50 } production: { shared_buffers: "512MB" effective_cache_size: "4GB" max_connections: 200 } high_performance: { shared_buffers: "1GB" effective_cache_size: "8GB" max_connections: 300 } } # Export the template schema _postgres_taskserv = PostgresBase { postgres_version = "1.16" vers_num = 16 run_path = "/usr/bin/psql" lib_path = "/var/lib/postgresql" data_path = "/var/lib/postgresql/16/main" etc_path = "/etc/postgresql" config_file = "postgresql.conf" run_user = "postgres" run_group = "postgres" run_user_home = "/var/lib/postgresql" database_name = "main" listen_addresses = "*" port = 5432 shared_buffers = "256MB" effective_cache_size = "1GB" maintenance_work_mem = "64MB" checkpoint_completion_target = 0.9 wal_buffers = "16MB" default_statistics_target = 100 max_connections = 100 } _postgres_taskserv