No description
This repository has been archived on 2026-11-17. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
  • Shell 86.1%
  • Nix 13.9%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Sergei Poljanski 46b18ee2ae
All checks were successful
Deploy storage stack / deploy (push) Successful in 25s
Postgres 18.7
Move the shared Postgres from 17 to 18.7 by dump and restore into a new
volume, pg_data_18, mounted at /var/lib/postgresql as the 18 image
requires (PGDATA moved to /var/lib/postgresql/18/docker). The 17 data
volume stays as it was.

Procedure (2026-11-13): restic snapshot and pg_dumpall to S3; stop
asxpio, asxpio-monitor and datacenterbingo; final pg_dumpall; deploy
this; restore the dump; compare per-table row counts; start the apps.

Rollback: revert this commit and redeploy (17.12 on the untouched
pg_data), then start the apps. Writes made on 18 in between would need
a pg_dump from 18 to carry over.

Assisted-by: Claude:opus-5-5
2026-11-13 04:21:38 +04:00
.forgejo/workflows Pin exact versions of images and actions 2026-11-13 02:46:54 +04:00
init garage-bootstrap: let asxpio write to the public bucket 2026-11-12 05:46:48 +04:00
.env.example .env.example: describe Garage, not MinIO 2026-11-11 04:28:34 +04:00
.gitignore Initial commit 2026-05-26 17:13:14 +03:00
docker-compose.yml Postgres 18.7 2026-11-13 04:21:38 +04:00
flake.lock Initial commit 2026-05-26 17:13:14 +03:00
flake.nix Remove MinIO 2026-11-11 03:55:18 +04:00
garage.toml Add Garage beside MinIO 2026-11-11 03:41:03 +04:00
README.md garage-bootstrap: let asxpio write to the public bucket 2026-11-12 05:46:48 +04:00
renovate.json deps: add renovate.json 2026-11-12 20:33:11 +00:00
SECRETS.md Remove MinIO 2026-11-11 03:55:18 +04:00

storage

Postgres + Garage (S3) for asxp.io and any future small services that need a database or object storage. Single-host, no clustering. Deploys via Forgejo Actions to the same box that runs the apps.

What's here

  • docker-compose.yml — postgres, its one-shot init container, and garage.
  • garage.toml — Garage's config (single node, no secrets in it).
  • init/postgres-init.sh — idempotent role/DB bootstrap.
  • init/garage-bootstrap.sh — idempotent buckets, per-app keys and grants; run on the host by the deploy, through docker exec.
  • .forgejo/workflows/deploy.yaml — pushes compose + .env to the prod host and runs docker compose up -d.

Networking

Two Docker networks:

  • storage — internal-only; apps join this as an external network to reach postgres:5432 and garage:3900.
  • traefik — existing reverse-proxy network. Only Garage joins it, to expose the S3 API at https://s3.asxp.io.

Garage replaced MinIO in November 2026 (MinIO was abandoned upstream and its images removed from the registries).

The public bucket

Garage answers no anonymous S3 request. public is marked as a website instead, and Traefik sends unsigned GET/HEAD of https://s3.asxp.io/public/<key> to Garage's web endpoint. Anyone who knows a key can read it; nobody can list the bucket. Uploading needs the uploader key (see SECRETS.md) or asxpio's key, which may put and delete there for its admin's file uploads.

Looking inside

The image has no shell; use the CLI through docker exec:

ssh prod 'docker exec storage-garage /garage status'
ssh prod 'docker exec storage-garage /garage bucket list'
ssh prod 'docker exec storage-garage /garage key list'

Adding a new app

  1. Pick an app name, e.g. foo.
  2. Pick a DB password, S3 access key, S3 secret key for it (any random hex).
  3. Add Forgejo secrets FOO_DB_PASSWORD, FOO_S3_ACCESS_KEY, FOO_S3_SECRET_KEY to this repo and to the foo repo.
  4. Extend init/postgres-init.sh with ensure_role "foo" ... and ensure_db "foo" "foo".
  5. Extend init/garage-bootstrap.sh with ensure_bucket "foo-...", an ensure_key foo ... and a grant for it.
  6. Pass the new envs through in docker-compose.yml and the deploy workflow.
  7. Push.

State and backups

Three named Docker volumes are stateful:

  • pg_data (Postgres data dir) — /var/lib/docker/volumes/storage_pg_data/_data
  • garage_data (S3 object bytes) and garage_meta (Garage's database, with a snapshot every 6 h) — /var/lib/docker/volumes/storage_garage_*/_data

/opt/storage/secrets/garage_rpc_secret (Garage's node-to-node and CLI secret) is made on the host at the first deploy and is not in Forgejo.

Server-level backup covers all three. If you ever move off whole-server backup, the minimum is pg_dumpall for Postgres and rclone sync of each bucket.

The old storage_minio_data volume is still on the host from before the move; nothing uses it.

Secrets

See SECRETS.md for the full list of Forgejo secrets this repo needs. Apps that consume storage (asxpio, future) also need the per-app credentials added on their repo so they can connect.