mirror of
https://github.com/bitbaum/orangecat.git
synced 2026-12-04 03:17:16 +01:00
Public pictures still passed through the app box: storage-api answered every supabase.orangecat.ch/storage/v1/object/public/... request, and next/image fetched, resized and cached them there. orangecat-media holds private files too, so it never gets a public domain; public pictures go to the separate public bucket fleet-media under orangecat/<bucket>/<path>, served from MEDIA_PUBLIC_BASE. - src/lib/media/public-url.ts: the one URL helper. Direct address only for objects known to be copied (listing every 10 min + own writes), otherwise the Supabase address. Unset base: unchanged. - New uploads: server-side ones are written to fleet-media as stored; browser uploads ask POST /api/media/mirror. Stored URL is the direct one or, on any failure, the Supabase one. - Background copy from instrumentation: idempotent, throttled (MEDIA_BACKFILL_KBPS, 512), one process at a time under a lease taken with a Postgres advisory lock (new migration). Only buckets declared public in code AND marked public in storage.buckets. Removes copies of deleted originals after a complete scan, capped at a tenth per run. - next/image: with the base set at build, a custom loader draws R2 pictures unoptimized and sends Supabase public pictures to /api/media/object, which redirects to R2 once copied, else to the optimizer as before. - Docs: STORAGE_R2_BACKEND.md (how, switch-on, rollback, the pre-move disk copy an operator may remove), .env.example; three docs that named the removed auto-merge.yml now name the forge merge check. Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T Co-authored-by: Claude <noreply@anthropic.com>
DevOps Overview
This is the authoritative, up-to-date guide for OrangeCat DevOps. It summarizes environments, CI/CD, infrastructure, observability, security, and runbooks for both human engineers and AI coding agents.
- Read first: Deployment guide – docs/operations/deployment/DEPLOYMENT_PROCESS.md
- CI/CD Pipeline – docs/operations/devops/ci-cd.md
- Infrastructure (self-hosted Hetzner) – docs/operations/devops/infrastructure.md
- Observability (Health, Metrics, Logs) – docs/operations/devops/observability.md
- Runbooks (Backups/Restores) – docs/operations/devops/runbooks/backup-restore.md
- Supabase Connectivity – docs/operations/devops/supabase.md
Source of truth notes:
- Node.js: v20 across workflows and Docker.
- Tests and type-checks are blocking in CI with pragmatic coverage gates.
- Security: strict headers + CSP (reporting enabled), SVG disabled unless sanitized.
Environment Files Policy (Local)
.env.localis developer-owned and MUST NOT be deleted or overwritten by scripts or agents.- Automated backups live in
.env-backups/; usescripts/utils/env-manager.jsto backup/restore. - Prefer
env-manager validateandsetupover copying.env.exampleonto an existing file. - CI uses dummy env values for builds; the box's env lives in
/opt/orangecat/app/.env. GitHub Actions must not write to.env.local.