Skip to content

Conversation

@mosoriob
Copy link
Contributor

@mosoriob mosoriob commented Feb 14, 2025

Changes

This PR restructures the Hasura deployment by moving the PostgreSQL database from a sidecar container into its own StatefulSet. This change provides better data persistence and management capabilities.

Key Updates:

  1. Database Architecture

    • Created a new StatefulSet for PostgreSQL database
    • Added a headless service (-hasura-db) for stable network identity
    • Configured persistent storage using volumeClaimTemplates
    • Removed database sidecar container from Hasura deployment
  2. Connection Updates

    • Updated database URL to point to the new StatefulSet service
    • Modified database connection strings in secrets
    • Added init containers to ensure database availability before starting Hasura
  3. Monitoring

    • Updated readiness probes to check database connectivity using new hostname
    • Improved database health checks using pg_isready

Benefits

  • Better data persistence through StatefulSet
  • Improved separation of concerns
  • More reliable database operations
  • Easier scaling and maintenance
  • Better resource isolation

Testing

Please verify:

  • Database persistence across pod restarts
  • Hasura connectivity to the database
  • Data migrations and post-install jobs
  • Overall system stability

- Move Hasura database configuration into a separate StatefulSet
- Update database connection configuration
- Remove duplicate database container in Hasura deployment
- Simplify database service and persistence configuration
- Replace busybox with postgres:13-alpine for database readiness probes
- Add init container to wait for database before Hasura starts
- Use pg_isready for more robust database connection verification
- Update post-install job to use consistent database readiness check
@mosoriob mosoriob changed the title 91 pod conflicts during hasura database upgrades need to separate database into statefulset feat: Separate Hasura Database into StatefulSet Feb 28, 2025
@mosoriob mosoriob merged commit c59f439 into main Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pod Conflicts During Hasura Database Upgrades - Need to Separate Database into StatefulSet

2 participants