Postgres Configuration
Postgres handles identity management and symbol database storage. It stores user authentication data and debugging symbol metadata.
Configuration Modes​
- Use Existing
- Create Mode
Connect to existing Postgres​
This mode connects to your existing Postgres database or GCP Cloud SQL.
- Standard Postgres
- GCP Cloud SQL
Standard Postgres Configuration​
Standard Postgres Configuration
postgres:
mode: "use_existing"
use_existing:
host: "" # host:port
user: ""
password: ""
database: "zymtrace" # Database name
secure: false # Enable TLS/secure connection
autoCreateDBs: false # When true, zymtrace migration will automatically create the required databases.
# NOTE: For autoCreateDBs to work, the database user must have CREATEDB permission.
# Grant with: ALTER USER "your-user" CREATEDB;
Setting up the Postgres use_existing mode
Postgres setups can vary based on security needs like data classification and role usage. The example below is a simplified guideline.
Note that unlike typical applications, which require only INSERT
and SELECT
permissions, the zymtrace database migration job requires DDL access.
If you're setting up zymtrace for the first time, the most straightforward approach is to create one role with both DDL and DML permissions.
Database Setup Options​
You have two options for setting up the required databases:
- Manual Setup: Create databases and users manually using SQL commands
- Automatic Setup: Enable
autoCreateDBs
to let zymtrace create databases during migration
Option 1: Manual Database Setup​
For manual database setup, use the SQL commands below. This approach gives you full control over user permissions and database ownership.
The commands below assume you're connected to the database using a role with superuser privileges.
CREATE ROLE zystem LOGIN PASSWORD 'metsyz';
CREATE DATABASE zymtrace_identity OWNER zystem;
CREATE DATABASE zymtrace_symdb OWNER zystem;
\c zymtrace_identity
ALTER SCHEMA public OWNER TO zystem;
\c zymtrace_symdb
ALTER SCHEMA public OWNER TO zystem;
Option 2: Automatic Database Setup​
Alternatively, you can enable autoCreateDBs: true
in your configuration to let zymtrace automatically create the required databases during migration. This requires the database user to have CREATEDB
permission.
When to use automatic setup:
- Development environments where quick setup is preferred
- When you have administrative access to grant broad CREATE permissions
- Testing scenarios where database recreation is acceptable
When to use manual setup:
- Production environments requiring strict permission control
- When following security best practices with minimal required permissions
- Enterprise environments with database administration policies
Security Considerations​
Database Permissions​
zymtrace requires both DDL (Data Definition Language) and DML (Data Manipulation Language) permissions:
- DDL permissions: Required for database schema migrations
- DML permissions: Required for normal application operations
User Role Management​
For production environments, consider creating separate roles for:
- Migration role: Has DDL permissions for schema updates
- Application role: Has minimal DML permissions for runtime operations
Configuration Examples​
- Development Environment
- Production Environment
Development Environment​
For development setups with simplified security:
postgres:
mode: "use_existing"
use_existing:
host: "postgres.dev.company.com:5432"
user: "zymtrace_dev"
password: "dev-password"
database: "zymtrace"
secure: false
autoCreateDBs: true
Production Environment​
For production setups with enhanced security:
postgres:
mode: "use_existing"
use_existing:
host: "postgres.prod.company.com:5432"
user: "zymtrace_prod"
password: "secure-prod-password"
database: "zymtrace"
secure: true
autoCreateDBs: false # Manually create databases for production
GCP Cloud SQL Configuration​
GCP Cloud SQL Configuration
postgres:
mode: "gcp_cloudsql"
gcp_cloudsql:
instance: "" # PROJECT:REGION:INSTANCE format, e.g. zymtrace-cloudsql-psql-1
user: "" # IAM account, e.g [email protected] (without gserviceaccount.com suffix)
database: "zymtrace" # Database prefix for zymtrace_identity and zymtrace_profiling databases
autoCreateDBs: false # When true, zymtrace migration will automatically create the required databases.
# NOTE: For autoCreateDBs to work, the IAM database user must have CREATEDB permission.
# Grant with: ALTER USER "[email protected]" CREATEDB;
workloadIdentity:
enabled: true # Enable Workload Identity for authentication
proxy:
image:
repository: gcr.io/cloud-sql-connectors/cloud-sql-proxy
tag: "2.15.0"
# Use nodeSelector if you created a dedicated node pool with cloud-platform scope
nodeSelector:
cloud.google.com/gke-nodepool: cloudsql-pool
resources:
requests:
cpu: "100m"
memory: "128Mi"
limits:
cpu: "500m"
memory: "556Mi"
port: 5432
serviceAccount: "zymtrace-cloudsql-sa" # Kubernetes service account bound to GCP service account via Workload Identity
Prerequisites for GCP Cloud SQL:
- Set up Workload Identity between your Kubernetes service account and GCP service account
- Grant the GCP service account Cloud SQL Client role
- Ensure the IAM database user has appropriate permissions in your Cloud SQL instance
For detailed setup instructions including creating the Cloud SQL instance, configuring Workload Identity, and setting up IAM authentication, refer to the GCP Cloud SQL setup guide.
Next Steps​
After configuring Postgres, proceed to configure the other storage components:
Deploy new Postgres instance​
This mode deploys and manages Postgres within your cluster.
Postgres Create Mode Configuration
postgres:
mode: "create"
create:
config:
user: "postgres"
password: "postgres123"
service:
port: 5432
resources:
requests:
cpu: "200m"
memory: "512Mi"
limits:
cpu: "1000m"
memory: "1024Mi"
storage:
type: "persistent"
size: 20Gi
className: ""