hdb uses PostgreSQL for local development.
These commands target Pop!_OS 22.04 / Ubuntu 22.04.
sudo apt-get update
sudo apt-get install -y postgresql postgresql-contribsudo systemctl enable --now postgresql
sudo systemctl status postgresql --no-pagerpsql --version
pg_isreadyExpected:
psqlprints a PostgreSQL versionpg_isreadyreturnsaccepting connections
Replace hdb_password with a local dev password.
sudo -u postgres psql -c "CREATE ROLE hdb_user WITH LOGIN PASSWORD 'hdb_password';"
sudo -u postgres psql -c "CREATE DATABASE hdb OWNER hdb_user;"
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE hdb TO hdb_user;"Use this local role for safe ad hoc inspection from psql or other SQL clients.
Replace readonly_password with a local-only password.
sudo -u postgres psql -d hdb -c "CREATE ROLE hdb_readonly WITH LOGIN PASSWORD 'readonly_password';"
sudo -u postgres psql -d hdb -c "GRANT CONNECT ON DATABASE hdb TO hdb_readonly;"
sudo -u postgres psql -d hdb -c "GRANT USAGE ON SCHEMA public TO hdb_readonly;"
sudo -u postgres psql -d hdb -c "GRANT SELECT ON ALL TABLES IN SCHEMA public TO hdb_readonly;"
sudo -u postgres psql -d hdb -c "ALTER DEFAULT PRIVILEGES FOR ROLE hdb_user IN SCHEMA public GRANT SELECT ON TABLES TO hdb_readonly;"Connect with:
psql "postgresql://hdb_readonly:readonly_password@localhost:5432/hdb"Recommended usage:
- keep the application on
hdb_user - use
hdb_readonlyonly for troubleshooting and inspection - prefer
hdb ... --jsonfirst when an existing command already exposes the data you need
psql "postgresql://hdb_user:hdb_password@localhost:5432/hdb" -c "select now();"hdb currently reads individual helper env vars (not DATABASE_URL):
export HELPER_POSTGRES_DATABASE="hdb"
export HELPER_POSTGRES_USERNAME="hdb_user"
export HELPER_POSTGRES_PASSWORD="hdb_password"You can also place those values in:
${XDG_CONFIG_HOME:-$HOME/.config}/helper/.env- If
pg_isreadyfails:sudo systemctl restart postgresqlsudo journalctl -u postgresql -n 100 --no-pager
- If auth fails:
- verify role exists:
sudo -u postgres psql -c "\du" - verify database exists:
sudo -u postgres psql -c "\l"
- verify role exists:
Use this when you do not want a machine-level Postgres install:
docker run --name hdb-postgres \
-e POSTGRES_USER=hdb_user \
-e POSTGRES_PASSWORD=hdb_password \
-e POSTGRES_DB=hdb \
-p 5432:5432 \
-d postgres:16Verify:
docker logs hdb-postgres --tail 50
psql "postgresql://hdb_user:hdb_password@localhost:5432/hdb" -c "select version();"