Configure External PostgreSQL
By default, Bytebase bundles an embedded PostgreSQL instance for storing its own metadata. The metadata is stored under the --data directory.
For production setup, you should pass PG_URL environment variable to store these metadata in an external PostgreSQL database.
Prerequisites
- PostgreSQL 14 or above.
- All privileges on the database object including:
- SELECT
- INSERT
- UPDATE
- DELETE
- TRUNCATE
- REFERENCES
- TRIGGER
- CREATE
- CONNECT
- TEMPORARY
- EXECUTE
- USAGE
- The database should use UTF-8 for encoding. UTF-8 encoding is mandatory across the entire system.
- For Cloud RDS, ensure that the user either owns the schema (public) and database, or has the necessary privileges to access them.
- ALTER DATABASE dbname OWNER TO bytebase;
- ALTER SCHEMA public OWNER TO bytebase;
Connection string format for PG_URL
Supported format:
postgresql://<<user>>:<<secret>>@<<host>>:<<port>>/<<dbname>>
Example:
postgresql://bytebase:z*3kd2@example.com:5432/meta
Docker Sample
This bash script demonstrates how to add an external PostgreSQL database as the metadata store when running the bytebase container.