RETIRED: replaced by SiaFoundation s3d (see README)
  • Go 98.6%
  • Dockerfile 1.4%
Find a file
taskuler-infra-bot b56db8de4a Retire adapter-sia: point to s3d and the MinIO->s3d runbook (M0.9)
Signed-off-by: taskuler-infra-bot <george.peterson+taskuler-infra-bot@taskuler.com>
2026-10-22 17:16:40 -05:00
cmd Rename visible text Ourcld → Taskuler Infra, MeritForge → Taskuler Forge (identifiers unchanged; dated docs get a legacy-name note) 2026-10-16 18:38:26 -05:00
configs Rename visible text Ourcld → Taskuler Infra, MeritForge → Taskuler Forge (identifiers unchanged; dated docs get a legacy-name note) 2026-10-16 18:38:26 -05:00
internal Initial import from Ourcld workspace 2026-09-29 14:19:43 -05:00
docker-compose.yml Initial import from Ourcld workspace 2026-09-29 14:19:43 -05:00
Dockerfile Initial import from Ourcld workspace 2026-09-29 14:19:43 -05:00
go.mod Initial import from Ourcld workspace 2026-09-29 14:19:43 -05:00
go.sum Initial import from Ourcld workspace 2026-09-29 14:19:43 -05:00
README.md Retire adapter-sia: point to s3d and the MinIO->s3d runbook (M0.9) 2026-10-22 17:16:40 -05:00

adapter-sia — RETIRED (Oct 22, 2026)

This repository is retired and archived. Taskuler Infra uses the Sia Foundation's official s3d (one instance per tenant) instead of this S3 facade. Decision: architecture §1 row 5 and §4 "Retired" (task M0.9 #28); evidence: s3d passed 19/20 Forgejo tests on Sia Zen.

  • migrate-minio is replaced by the rclone runbook ops/docs/runbooks/minio-to-s3d.md.
  • The AppKey trust note now lives in that runbook and in the architecture doc §7.
  • The code below is kept for reference only. Do not deploy it.

adapter-sia — Taskuler Infra S3 gateway for Sia (Forgejo / MinIO cutover)

Ourcld is now Taskuler Infra (2026-10-11), a Taskuler project (https://infra.taskuler.com), and MeritForge is now Taskuler Forge. Code identifiers (ourcld-s3-gateway, the Go module path, meritforge-prod) are unchanged.

Local workspace prototype (not a git remote / Origin repo).

Forgejo speaks MinIO/S3. Modern Sia speaks SDK + indexd (Object IDs), not a drop-in AWS endpoint. This module is the S3-compatible façade Forgejo already understands, with a pluggable Sia StorageBackend underneath.

Forgejo  --S3/MinIO API-->  ourcld-s3-gateway (adapter-sia)
                                |  SQLite (bucket,key) → objectId
                                |  StorageBackend (MemoryStub today)
                                v
                             [TODO] indexd + Sia hosts via SDK

Module path: github.com/ourcld/adapter-sia (may exist without a remote).

What works in this prototype

API Status
HeadBucket / CreateBucket Yes — default meritforge-prod on start
PutObject / GetObject / HeadObject / DeleteObject Yes
ListObjectsV2 Yes (prefix + delimiter)
Multipart Yes — Create/UploadPart/Complete/Abort/ListParts (assemble-on-disk → single Upload)
Auth Static ACCESS_KEY / SECRET_KEY: AWS SigV4 (credential check), Basic, simple headers — rejects unauthenticated writes
Backend MemoryStub (content-hash object IDs under STUB_DATA_DIR)

Bucket prefixes stay stable with Taskuler Forge / MinIO: lfs/, attachments/, avatars/, repo-avatars/, packages/, actions/, tmp/.

Build & test

cd /workspace/adapter-sia
go test ./...

Run the gateway (local)

cp configs/example.env .env   # edit placeholders
export $(grep -v '^#' configs/example.env | xargs)   # or use your own env
mkdir -p data/stub
go run ./cmd/s3-gateway
# listens on :9000 by default

Docker (stub + SQLite volume):

docker compose up --build

Point Forgejo at the gateway

At MinIO → Sia cutover, keep STORAGE_TYPE=minio (or equivalent) and change only endpoint/credentials:

Env Value
S3_ENDPOINT / MinIO endpoint ourcld-s3-gateway:9000 (or TLS URL)
MINIO_ACCESS_KEY / access key same as gateway ACCESS_KEY
MINIO_SECRET_KEY / secret same as gateway SECRET_KEY
S3_BUCKET meritforge-prod (unchanged)
S3_USE_SSL as appropriate

No Forgejo app redesign — same bucket + key prefixes.

MinIO → Sia migration outline

  1. Phase 0: Forgejo → MinIO on VPS (bring-up).
  2. Phase 1: Deploy this gateway + empty meritforge-prod view.
  3. Phase 2: Copy — cmd/migrate-minio (stub today: --dry-run prints plan). For each object: GET MinIO → PUT gateway (same key) → verify size/checksum. Optional dual-write window.
  4. Phase 3: Maintenance / final delta → point Forgejo S3_ENDPOINT at gateway → smoke LFS / attachments / avatars → keep MinIO volume read-only for N days.
go run ./cmd/migrate-minio -h
go run ./cmd/migrate-minio --dry-run --src-endpoint http://minio:9000

AppKey trust note

The Sia AppKey is a Taskuler Infra project runtime secret injected into the adapter only. Client-side encryption happens in the (future) SDK — providers/indexd never see plaintext. The gateway is a trusted decryptor for that Taskuler Forge project: the Taskuler Infra operator can read mutable Git blobs for the project, same class as “we host your MinIO.” Document honestly; future options include per-tenant keys / customer-held AppKey. Never put AppKey or S3 secrets in Filecoin Pin / ArNS descriptors.

TODO — real Sia SDK

Replace internal/sia.MemoryStub with a production implementation of StorageBackend:

  • Upload + pin via @siafoundation/sia-storage (JS worker) or go.sia.tech Go SDK
  • Download / unpin (delete) against hosted or self-hosted indexd
  • Wire SIA_APP_KEY + indexd credentials from env/secrets
  • Multipart v1 uses assemble-on-disk then single Upload; multipart-native Sia strategy later
  • ETag policy: content MD5 (current) vs hash(objectId) — confirm Forgejo sensitivity

Until then, docker-compose and local runs use the in-process stub only.

Layout

adapter-sia/
  cmd/s3-gateway/       # HTTP gateway
  cmd/migrate-minio/    # MinIO → gateway copier (stub CLI)
  internal/s3/          # S3/MinIO handlers
  internal/sia/         # StorageBackend + MemoryStub
  internal/index/       # SQLite key → objectId
  internal/auth/        # static access/secret
  internal/config/      # env loading
  configs/example.env
  Dockerfile
  docker-compose.yml