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
- PostgreSQL 14 or above.
- All privileges on the database object including:
- SELECT
- INSERT
- UPDATE
- DELETE
- TRUNCATE
- REFERENCES
- TRIGGER
- CREATE
- CONNECT
- TEMPORARY
- EXECUTE
- USAGE
 
- 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;
 
--pg connection string
info
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:
- postgresql://bytebase:z*3kd2@example.com:5432/meta
- postgresql://bytebase:z*3kd2@example.com:5432/meta?sslrootcert=root.pem
Notes
- usermust be specified.
- dbnamemust be specified and must be created in advance. The connecting- usermust have all the database privileges mentioned above.
- host. If you run Bytebase inside Docker and want to connect the pg intance on the same host, then you need to use- host.docker.internal.
