No description
- Shell 86.1%
- Nix 13.9%
There was no way to share a file by link: both buckets are private and the bootstrap forces anonymous access off on every run. Add a bucket named public whose objects anyone can GET by key, with no anonymous listing or writes, and an optional user that may only put and delete there, so a leaked uploader key reads nothing and reaches no other bucket. Assisted-by: Claude:fable-5-2 |
||
|---|---|---|
| .forgejo/workflows | ||
| init | ||
| .env.example | ||
| .gitignore | ||
| docker-compose.yml | ||
| flake.lock | ||
| flake.nix | ||
| README.md | ||
| SECRETS.md | ||
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 +.envto the prod host and runsdocker compose up -d.
Networking
Two Docker networks:
storage— internal-only; apps join this as an external network to reachpostgres:5432andminio:9000.traefik— existing reverse-proxy network. Only MinIO joins it, to expose the S3 API athttps://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
- Pick an app name, e.g.
foo. - Pick a DB password, S3 access key, S3 secret key for it (any random hex).
- Add Forgejo secrets
FOO_DB_PASSWORD,FOO_S3_ACCESS_KEY,FOO_S3_SECRET_KEYto this repo and to the foo repo. - Extend
init/postgres-init.shwithensure_role "foo" ...andensure_db "foo" "foo". - Extend
init/minio-bootstrap.shwithensure_bucket "foo-...",write_policy "foo-...-rw" "foo-...",ensure_user ... "foo-...-rw". - Pass the new envs through in
docker-compose.ymland the deploy workflow. - Push.
State and backups
Two named Docker volumes are stateful:
pg_data(Postgres data dir) —/var/lib/docker/volumes/storage_pg_data/_dataminio_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.