PostgreSQL Development Profile
GovOPlaN development now defaults to PostgreSQL:
postgresql+psycopg://govoplan_dev@127.0.0.1:5432/govoplan_dev
The matching pg-tools URL for psql, pg_dump, and pg_restore is:
postgresql://govoplan_dev@127.0.0.1:5432/govoplan_dev
Store the password in ~/.pgpass instead of committing it to a .env file.
The devserver and govoplan/tools/launch/launch-dev.sh honor an explicit
DATABASE_URL if you need a different database.
Host PostgreSQL Setup
Create the default local role and database from a host shell:
export GOVOPLAN_PG_DB=govoplan_dev
export GOVOPLAN_PG_USER=govoplan_dev
read -rsp "Password for ${GOVOPLAN_PG_USER}: " GOVOPLAN_PG_PASSWORD
echo
if ! sudo -u postgres psql -tAc "SELECT 1 FROM pg_roles WHERE rolname='${GOVOPLAN_PG_USER}'" | grep -q 1; then
sudo -u postgres createuser --pwprompt "${GOVOPLAN_PG_USER}"
else
sudo -u postgres psql -c "\\password ${GOVOPLAN_PG_USER}"
fi
if ! sudo -u postgres psql -tAc "SELECT 1 FROM pg_database WHERE datname='${GOVOPLAN_PG_DB}'" | grep -q 1; then
sudo -u postgres createdb -O "${GOVOPLAN_PG_USER}" "${GOVOPLAN_PG_DB}"
fi
sudo -u postgres psql -d "${GOVOPLAN_PG_DB}" -c "ALTER SCHEMA public OWNER TO ${GOVOPLAN_PG_USER};"
touch ~/.pgpass
chmod 600 ~/.pgpass
grep -v "^127.0.0.1:5432:${GOVOPLAN_PG_DB}:${GOVOPLAN_PG_USER}:" ~/.pgpass > ~/.pgpass.tmp || true
printf '127.0.0.1:5432:%s:%s:%s\n' "$GOVOPLAN_PG_DB" "$GOVOPLAN_PG_USER" "$GOVOPLAN_PG_PASSWORD" >> ~/.pgpass.tmp
mv ~/.pgpass.tmp ~/.pgpass
chmod 600 ~/.pgpass
Check access:
psql "postgresql://${GOVOPLAN_PG_USER}@127.0.0.1:5432/${GOVOPLAN_PG_DB}" \
-c 'select current_user, current_database();'
When running through the VS Codium Flatpak sandbox, host PostgreSQL tools are available through:
flatpak-spawn --host /usr/bin/psql --version
flatpak-spawn --host /usr/bin/pg_dump --version
flatpak-spawn --host /usr/bin/pg_restore --version
Run GovOPlaN Against Host PostgreSQL
cd /mnt/DATA/git/govoplan
./.venv/bin/python -m govoplan_core.commands.init_db \
--database-url postgresql+psycopg://govoplan_dev@127.0.0.1:5432/govoplan_dev \
--with-dev-data
./.venv/bin/python -m govoplan_core.devserver --smoke --no-reload
For the full backend and WebUI launcher:
cd /mnt/DATA/git/govoplan
tools/launch/launch-dev.sh
To force the old SQLite fallback for a disposable local run:
cd /mnt/DATA/git/govoplan
GOVOPLAN_DEV_DATABASE_BACKEND=sqlite tools/launch/launch-dev.sh
Disposable Docker Testbed
This testbed is for migration and module-permutation checks. It is not a production deployment profile.
cd /mnt/DATA/git/govoplan/dev/postgres
cp .env.example .env
docker compose --env-file .env up -d
Run the integration check from the meta checkout:
cd /mnt/DATA/git/govoplan
set -a
. dev/postgres/.env
set +a
tools/checks/postgres-integration-check.py \
--database-url "$GOVOPLAN_POSTGRES_DATABASE_URL" \
--reset-schema
--reset-schema drops and recreates the public schema before every module
set. Use it only against this disposable database.
Stop the testbed:
cd /mnt/DATA/git/govoplan/dev/postgres
docker compose --env-file .env down
Remove all test data:
docker compose --env-file .env down -v