Skip to content

PostgreSQL backup tool with Point-In-Time-Recovery and restore verification

1.4 KB
Raw Blame

Before run

Copy .env.example to .env in the repo root (single source for backend, frontend, and docker compose)

Run

Commands run from the repository root, with the tools from mise.toml installed.

To run the backend together with the frontend, the dev database, the test fixtures and the WAL backup source:

just run

The backend runs under air, which rebuilds and restarts it when a Go file is saved; a build that fails leaves the previous backend serving. Once the backend accepts connections, the seed command creates the dev account and the seeded databases if they are missing. To run the seed again against the running app, from backend/:

go run ./cmd/seed_dev

To run tests:

just test

Before commit:

just lint

Migrations

The backend applies pending migrations on startup. To create a migration:

goose -dir backend/migrations create MIGRATION_NAME sql

To apply or roll back migrations on the dev database, with the variables from .env exported (goose reads GOOSE_DRIVER and GOOSE_DBSTRING from the environment):

goose -dir backend/migrations up

goose -dir backend/migrations down

Swagger

just run generates the swagger docs before the backend starts. To regenerate them by hand, from backend/:

swag init -d . -g cmd/main.go -o swagger

Swagger URL is:

http://localhost:4005/api/v1/docs/swagger/index.html#/