Configure External PostgreSQL

By default, Bytebase bundles an embedded PostgreSQL instance for storing its own metadata. The metadata is stored under the --data directory.

Alternatively, you can supply --pg or pass PG_URL environment variable to store these metadata in an external PostgreSQL database.

Prerequisites

  1. PostgreSQL 14 or above.
  2. All privileges on the database object including:
    • SELECT
    • INSERT
    • UPDATE
    • DELETE
    • TRUNCATE
    • REFERENCES
    • TRIGGER
    • CREATE
    • CONNECT
    • TEMPORARY
    • EXECUTE
    • USAGE

--pg connection string

!

Alternatively, you can also pass PG_URL environment variable.

Supported format:

  • postgresql://<<user>>:<<secret>>@<<host>>:<<port>>/<<dbname>>

  • postgresql://<<user>>:<<secret>>@<<host>>:<<port>>/<<dbname>>?sslrootcert=<<root.pem>>

Example:

Notes

  • user must be specified.
  • dbname must be specified and must be created in advance. The connecting user must have all the database privileges mentioned above.