From the creators of Dolt, the world's first version-controlled SQL database, comes Doltgres, the Postgres-flavored version of Dolt. It's a SQL database that you can branch and merge, fork and clone, push and pull, just like a Git repository. Connect to your Doltgres server just like any Postgres database to read or modify schema and data. Version control functionality is exposed in SQL via system tables, functions, and procedures.
Git versions file, Doltgres versions tables. It's like Git and Postgres had a baby.
Join us on Discord to say hi and ask questions, or check out our roadmap to see what we're building next.
Lots of things! Doltgres is a generally useful tool with countless applications. But if you want some ideas, here's how people are using it so far.
This image is for the Doltgres server and is similar to the Postgres Docker image. Running this
image without any arguments is equivalent to running the doltgres command inside a Docker
container.
To see all supported options for doltgres, you can run the image with --help flag.
$ docker run dolthub/doltgresql:latest --helpTo build this image, use the Dockerfile in the root of the Doltgres
repository with an optional build argument:
# Build the latest Doltgres version (automatically fetches the latest release)
$ docker build -t doltgres:latest .
# Build the latest Doltgres version (fetches the latest release)
$ docker build --build-arg DOLTGRES_VERSION=latest -t doltgres:latest .
# Build with a specific Doltgres version
$ docker build --build-arg DOLTGRES_VERSION=0.55.1 -t doltgres:0.55.1 .
# Build from local source code
$ docker build --build-arg DOLTGRES_VERSION=source -t doltgres:source .To connect to a server running in a container from the host system, we need to map a port on the host system to the port our server is running on in the container.
$ docker run -p 5432:5432 dolthub/doltgresql:latestNote: if you have Postgres installed on this machine already, port 5432 will be in use. Either
choose a different port to map or shut down Postgres.
Now connect with psql or another Postgres-compatible client.
$ PGPASSWORD=password psql --host 127.0.0.1 -U postgresYou can specify server configuration by providing your own config.yaml for the server to use as a
mounted volume. The image looks for a config.yaml file in the mounted directory
/etc/doltgres/servercfg.d. Place your desired config.yaml directory in a local file, then
provide it to docker run with the -v argument like this:
$ docker run -v ./doltgres_cfg:/etc/doltgres/servercfg.d -p 5432:5432 dolthub/doltgresql:latestThe data directory in the container is /var/lib/doltgresql/. To change this, provide the PGDATA
or DOLTGRES_DATA environment variable to docker run. This directory can also be a mounted
directory on the local machine.
$ docker run -e PGDATA=/path/to/doltgres/data -p 5432:5432 dolthub/doltgresql:latestBy default, the server creates a super-user named postgres with the password password. To change
this, provide the DOLTGRES_USER and DOLTGRES_PASSWORD environment variables to the docker run
command.
$ docker run -e DOLTGRES_USER=myuser -e DOLTGRES_PASSWORD=mypass -p 5432:5432 dolthub/doltgresql:latestFor convenience, POSTGRES_USER and POSTGRES_PASSWORD are accepted as aliases for these variables.
To create additional users, connect to the running database and issue CREATE ROLE and GRANT
statements as the super-user.
The Doltgres image supports the following environment variables:
DOLTGRES_USER: The name of the super-user (default:postgres).POSTGRES_USERis an alias.DOLTGRES_PASSWORD: The password for the super-user (default:password).POSTGRES_PASSWORDis an alias.DOLTGRES_DATA: Specifies a path in the container to store database data, created if it doesn't exist (default:/var/lib/doltgresql/).PGDATAis an alias.DOLTGRES_DB: Specifies a database name to be created (default: none). Thepostgresdatabase is still created.