easterbrooka/mike: storage layer generalized to support AWS S3, ECS-ready Dockerfile added

easterbrooka extended the backend storage client so it can talk to either Cloudflare R2 or native AWS S3 without code changes, then added a multi-stage Dockerfile aimed at ECS Fargate. Both pieces landed in PR #1.

infrastructure

The storage.ts rewrite makes endpoint and credentials optional. When R2_ENDPOINT_URL is absent the SDK talks directly to S3; when R2_ACCESS_KEY_ID and R2_SECRET_ACCESS_KEY are absent, the SDK's default credential provider chain runs instead, picking up an ECS task role automatically. Region resolution is layered: R2_REGION wins, then AWS_REGION (auto-set inside ECS), then "auto" as the R2 fallback. Existing R2 deployments pass through unchanged as long as R2_ENDPOINT_URL is still set.

One behavioral shift worth noting: storageEnabled now returns true when AWS_REGION is set even without explicit credentials. Previously it required all three cred vars. Any code that gates upload paths on storageEnabled will start seeing true in an AWS-ambient environment even before credentials are explicitly configured.

The Dockerfile is a two-stage build on node:22-bookworm-slim. The runtime layer installs libreoffice-core, libreoffice-writer, fonts-liberation, and tini. LibreOffice runs as the node user, which requires /home/node/.config to be writable - the Dockerfile handles that explicitly. Signal handling goes through tini so the soffice subprocess gets cleaned up correctly. The .dockerignore keeps the build context to source and lockfiles; dev artifacts, secrets, and the old nixpacks.toml are excluded.

The env example was rewritten to document the two deployment shapes side by side, with inline comments explaining when to omit credentials for task-role auth.

So what Worth a look if you're moving toward AWS hosting or want S3 as a storage option alongside R2. The storage diff is small and backwards-compatible. The Dockerfile is a clean baseline for any backend that needs LibreOffice - the only ECS-specific assumption is `AWS_REGION` being present at runtime.

View this fork on GitHub →

Spotted something wrong? Or know the PR text has fresher detail than the writeup above?

Commits in this thread

3 commits from easterbrooka/mike, oldest first. Source extracted verbatim from the harvested git log.

SHA Subject Author Date
ddc07e1e Support AWS S3 alongside Cloudflare R2 in storage layer Claude 2026-05-04 ↗ GitHub
commit body
Make endpoint and explicit credentials optional so the SDK falls back to
AWS default endpoints and the default credential provider chain (which
picks up the ECS task role automatically). Add R2_REGION env var that
falls back to AWS_REGION (auto-set inside ECS) and finally to "auto" for
R2 compatibility.

Needed because we're deploying on AWS App Runner's successor (ECS
Fargate + ALB) rather than Cloudflare.
754529de Add backend Dockerfile for ECS Fargate deploy Claude 2026-05-04 ↗ GitHub
commit body
Multi-stage build on node:22-bookworm-slim. Runtime layer installs the
minimal LibreOffice (core + writer) needed for DOCX -> PDF conversion,
plus tini for proper signal handling around the soffice subprocess.
Runs as the non-root `node` user with a writable home so LibreOffice
can create its profile.

.dockerignore keeps the build context to source + lock files only.
cc5ebc97 Merge pull request #1 from easterbrooka/claude/setup-supabase-integration-aCV7X Andrew 2026-05-05 ↗ GitHub
Add AWS S3 support and backend Docker image for ECS deployment

Capture this thread into my fork

Download a single Markdown prompt that tells Claude how to port every commit above into your working tree — adapting paths and structure to match your repo. Run it via claude -p < capture-thread-55.md from inside the repo you want the changes in.

⬇ Download capture-thread-55.md