Quick start
Run Gresbase with Docker Compose, point it at your PostgreSQL database and open it in your browser.
On this page
Before you start#
- Docker with Compose v2 (
docker compose versionshould answer). - A PostgreSQL database the container can reach, and a user to connect with. PostgreSQL 12 or newer (see supported versions).
To look around first, start the demo with a sample database. It needs only Docker:
curl -fsSLO https://raw.githubusercontent.com/amtzespinosa/gresbase/main/deploy/docker-compose.demo.yml
docker compose -f docker-compose.demo.yml up -dThen open http://localhost:8080. docker compose -f docker-compose.demo.yml down -v removes it.
If PostgreSQL runs on the same machine but outside Docker, localhost inside the container is not your machine. Use host.docker.internal on Docker Desktop, or the host's IP address.
Install and start#
-
Create the Compose file#
Save this in an empty folder as
docker-compose.yml. If you don't use Compose, the docker run tab does the same in one command.services: gresbase: image: ghcr.io/amtzespinosa/gresbase:latest restart: unless-stopped environment: DATABASE_URL: postgres://USER:PASSWORD@HOST:5432/DBNAME GRESBASE_READ_ONLY: "false" volumes: - gresbase-data:/data ports: - "127.0.0.1:8082:8080" volumes: gresbase-data:docker run -d --name gresbase \ -e DATABASE_URL=postgres://USER:PASSWORD@HOST:5432/DBNAME \ -e GRESBASE_READ_ONLY=false \ -p 127.0.0.1:8082:8080 \ -v gresbase-data:/data \ --restart unless-stopped \ ghcr.io/amtzespinosa/gresbase:latestGresbase listens on port 8080 inside the container. The
portsline publishes it as 8082, only on your machine. -
Point it at your database#
Replace
USER,PASSWORD,HOSTandDBNAMEinDATABASE_URL. It must start withpostgres://orpostgresql://. If the password contains characters such as@,:or/, percent-encode them (@becomes%40).Add
?sslmode=disableat the end if your server doesn't use SSL, for example apostgrescontainer on the same Compose network. More options in Connecting to PostgreSQL. -
Start it#
Terminaldocker compose up -d docker compose logs -f gresbaseThe log shows
starting gresbasewhen it's ready. If the database doesn't answer yet, Gresbase retries for up to 30 seconds and then exits with the reason. A wrong password, a missing database or an SSL error stops it at once. Withrestart: unless-stopped, Docker starts it again. -
Open Gresbase#
Go to http://localhost:8082. The connection card at the bottom of the sidebar shows a green dot when Gresbase can reach your database. A red one comes with Can't reach the database.
Check that it's healthy#
The image has a health check that calls /healthz every 10 seconds. After the first start, docker compose ps should show the container as healthy.
docker compose psWho can open it#
This Compose file has no account, so there is no login. Gresbase then only answers requests addressed to localhost, 127.0.0.1 or [::1], and the sidebar shows This computer only.
To open it to other people, set an account with GRESBASE_USER and GRESBASE_PASSWORD and put HTTPS in front. See Sign-in and accounts and Security and networking.
Don't publish the port on every interface (0.0.0.0) without an account and HTTPS in front. Passwords and data would travel in clear text.
Browse without changing anything#
Set GRESBASE_READ_ONLY to "true" to explore a production database safely. Gresbase rejects every write, and its database sessions are read-only too. A Read-only badge shows in the sidebar. More in Read-only mode.
Keep the data volume#
Gresbase keeps its own data in /data: gresbase.json with settings and saved connections, secret.key that encrypts the secrets inside it, and your saved queries. Your PostgreSQL data never lives there. Details in The data volume.
Removing the volume (docker compose down -v) deletes that configuration and your saved queries, and signs everyone out.
Configuration at a glance#
| Variable | Default | What it does |
|---|---|---|
DATABASE_URL |
— | Connection string of the database to manage. Without it, the setup wizard opens. |
GRESBASE_READ_ONLY |
false |
Blocks every write to the database. |
GRESBASE_USER / GRESBASE_PASSWORD |
— | Account to sign in with. Set both or neither. |
GRESBASE_SECRET_KEY |
Generated in /data/secret.key |
Encrypts the secrets in gresbase.json. At least 32 characters. |
All the options are in Environment variables.
Next steps#
- Take the quick tour of the main screens.
- Write your first query in the SQL editor and run it with ⌘ ↵ (Ctrl ↵ on Windows and Linux).
- Before opening it to your network, read Security and networking.