How to use Postgres
By default, Harness Open Source writes an SQLite database beneath /data
in the running container.
You can configure Harness Open Source to use an external Postgres database.
Configuration
To configure Harness Open Source to use your Postgres database, set the GITNESS_DATABASE_DRIVER
and GITNESS_DATABASE_DATASOURCE
environment variables when you launch your Harness Open Source container.
For example:
docker run -d \
-e GITNESS_DATABASE_DRIVER=postgres \
-e GITNESS_DATABASE_DATASOURCE="host=1.2.3.4 port=5678 sslmode=disable dbname=harness user=$USER password=$PASSWORD" \
-p 3000:3000 -p 3022:3022 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $HOME/harness:/data \
--name harness \
--restart always \
harness/harness
GITNESS_DATABASE_DRIVER
must be postgres
.
GITNESS_DATABASE_DATASOURCE
is the database connection string according to your Postgres server configuration. For more information on constructing this string, go to the Postgres driver documentation.