DocHub/storage/README.md
Tianyang 360e9e5a14 refactor: rename all minio references to garage, drop minio SDK for boto3
The backend no longer mentions MinIO anywhere: MinioClient -> GarageClient
(minio_client.py -> garage_client.py), MINIO_* env vars -> GARAGE_*, and
the `minio` Python package is replaced with `boto3` (AWS's generic S3
client) since Garage is the only storage backend this project targets
now. S3 API semantics are unchanged, so document_service.py's behavior
is identical — this is a naming and dependency swap, not a logic change.

Also updates test fixtures/names (FakeMinioClient -> FakeGarageClient,
FakeMinioSDK -> FakeS3SDK) and storage/README.md, which no longer frames
Garage as a MinIO replacement (that migration note has served its purpose
now that no MinIO reference remains in the codebase).

Backend: 54/54 tests passing. Frontend: 38/38 tests passing (unaffected,
verified for regressions since it talks to the backend only through the
unchanged REST API).
2026-08-01 10:51:49 +08:00

37 lines
1.1 KiB
Markdown

# DocHub Storage (Garage)
S3-compatible object storage for DocHub, deployed independently from the
app stack in `docker-compose.yml` at the repo root, using
[Garage](https://garagehq.deuxfleurs.fr/) — a fully open source (AGPL)
object store purpose-built for self-hosting. `backend/app/garage_client.py`
talks to it over the standard S3 API via `boto3`.
Single-node setup, matching this project's learning/small-team scope
(`replication_factor = 1` in `garage.toml` — no data redundancy across
nodes, since there's only one node).
## First-time setup
```bash
cd storage
docker compose up -d
./init-garage.sh
docker compose exec garage /garage key info dochub-backend
```
The last command prints an access key ID and secret key. Set those as
`GARAGE_ACCESS_KEY` / `GARAGE_SECRET_KEY` for the DocHub backend.
## Connecting the backend
From the repo root, when running `docker compose up` there:
```bash
GARAGE_ENDPOINT=<this-server-ip>:3900 \
GARAGE_ACCESS_KEY=<from init-garage.sh> \
GARAGE_SECRET_KEY=<from init-garage.sh> \
docker compose up -d
```
Garage's S3 API listens on port `3900`.