feat(devel): postgresql dev server
All checks were successful
ci/woodpecker/push/ci Pipeline was successful

This commit is contained in:
Daniel Lundin 2025-01-06 20:40:02 +01:00
parent d5ab8058f2
commit ffe95cb83c
Signed by: dln
SSH key fingerprint: SHA256:dQy1Xj3UiqJYpKR5ggQ2bxgz4jCH8IF+k3AB8o0kmdI
2 changed files with 29 additions and 1 deletions

View file

@ -1,3 +1,4 @@
nix_direnv_manual_reload
use flake
export DATABASE_URL=postgresql://patagia:swordfish@/patagia?host=$XDG_RUNTIME_DIR/patagia-postgres
dotenv_if_exists

View file

@ -49,8 +49,35 @@ open-api:
cargo xtask open-api
# Run all tests
check: check-nix
check: check-nix
# check-nix
check-nix:
nix flake check
# Run PostgreSQL for development and testing
dev-postgres:
mkdir -p "$XDG_RUNTIME_DIR/patagia-postgres"
podman volume exists patagia-postgres || podman volume create patagia-postgres
podman run \
--detach \
--replace \
--name patagia-postgres \
--env POSTGRES_DB=patagia \
--env POSTGRES_USER=patagia \
--env POSTGRES_PASSWORD=swordfish \
--volume patagia-postgres:/var/lib/postgresql/data \
--volume "$XDG_RUNTIME_DIR/patagia-postgres:/var/run/postgresql" \
docker.io/postgres:17
# Reset PostgreSQL data and start
dev-postgres-reset: dev-postgres-clean dev-postgres
# Clean up PostgreSQL data
dev-postgres-clean:
podman rm -f patagia-postgres || true
podman volume rm patagia-postgres || true
# Connect to PostgreSQL with psql
dev-postgres-psql:
podman exec -it patagia-postgres psql -U patagia