PostgreSQL and high availability

Operations · ViswCA Governance Engine 2.0

By default each module keeps its data in a SQLite file - fine for one server. For larger installations and several servers use PostgreSQL 13 or later.

  1. Create the database: CREATE ROLE viswca LOGIN PASSWORD '...'; CREATE DATABASE viswca OWNER viswca;
  2. Move your data (service stopped):
    VISWCA_DB_URL=postgresql://viswca:PASSWORD@dbhost:5432/viswca ./run_server.bin --migrate-to-postgres
    Keep the SQLite files as a backup.
  3. Start every server with the same VISWCA_DB_URL, SECRET_KEY and VISWCA_DATA_KEY (copy secret.key / data.key from the first server) and a unique VISWCA_NODE_NAME.
  4. Load balancer: health check GET /healthz (200 = this server can reach the database; the answer shows leader or standby). Sticky sessions are not needed.
  • Scheduled jobs run on one server only (the leader). If it stops, another takes over within 10-20 seconds.
  • Simultaneous actions on the same item (two approvers, double clicks, two servers) are serialised - exactly one wins.
  • Each server keeps VISWCA_DB_POOL (default 32) connections open. Set PostgreSQL max_connections to at least servers × (pool + 5) plus headroom.
  • Put uploads/ on shared storage (NFS, SMB, EFS) mounted on every server.