No description
  • Shell 84.3%
  • Nix 15.7%
Find a file
Sergei Poljanski 61e93b64c8
All checks were successful
Deploy storage stack / deploy (push) Successful in 20s
Give the bingo photos their own bucket
The datacenter bingo photos sat under bingo/ in asxpio-invoices, next to
the invoice PDFs, guarded only by a prefix policy. Move them to a
datacenterbingo-photos bucket: asxpio's user gets read-write for the
admin's uploads, the bingo user read-only on the whole bucket.

Existing objects are mirrored over with their keys unchanged, so the
database rows stay valid. Both users keep their old access until the
apps are switched and the old prefix is removed.

Assisted-by: Claude:opus-5
2026-10-12 04:07:41 +04:00
.forgejo/workflows Provision read-only credentials for datacenterbingo 2026-10-12 03:47:57 +04:00
init Give the bingo photos their own bucket 2026-10-12 04:07:41 +04:00
.env.example Provision read-only credentials for datacenterbingo 2026-10-12 03:47:57 +04:00
.gitignore Initial commit 2026-05-26 17:13:14 +03:00
docker-compose.yml Provision read-only credentials for datacenterbingo 2026-10-12 03:47:57 +04:00
flake.lock Initial commit 2026-05-26 17:13:14 +03:00
flake.nix Initial commit 2026-05-26 17:13:14 +03:00
README.md Initial commit 2026-05-26 17:13:14 +03:00
SECRETS.md Give the bingo photos their own bucket 2026-10-12 04:07:41 +04:00

storage

Postgres + MinIO 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, minio, and one-shot init containers.
  • init/postgres-init.sh — idempotent role/DB bootstrap.
  • init/minio-bootstrap.sh — idempotent bucket + per-app service account.
  • .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 minio:9000.
  • traefik — existing reverse-proxy network. Only MinIO joins it, to expose the S3 API at https://s3.asxp.io.

The MinIO console (:9001) is not exposed externally. To use it, SSH-port-forward:

ssh -L 9001:storage-minio:9001 deploy@prod
# then open http://localhost:9001

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/minio-bootstrap.sh with ensure_bucket "foo-...", write_policy "foo-...-rw" "foo-...", ensure_user ... "foo-...-rw".
  6. Pass the new envs through in docker-compose.yml and the deploy workflow.
  7. Push.

State and backups

Two named Docker volumes are stateful:

  • pg_data (Postgres data dir) — /var/lib/docker/volumes/storage_pg_data/_data
  • minio_data (S3 object bytes) — /var/lib/docker/volumes/storage_minio_data/_data

Server-level backup covers both. If you ever move off whole-server backup, the minimum is pg_dumpall for Postgres and mc mirror for MinIO.

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.