Commit graph

10 commits

Author SHA1 Message Date
19468d38d8
refactor: migrate from S3 to Attic binary cache
Replace low-level S3 operations with native Attic client for better
performance, simplicity, and proper Nix binary cache protocol support.

Changes:
- Replace 'nix copy' + S3 with 'attic push'
- Remove S3_ACCESS_KEY, S3_SECRET_KEY, NIX_SIGNING_KEY requirements
- Add ATTIC_TOKEN requirement (explicit per-repo security)
- Default to 'ci' cache instead of 'toph'
- Update Nomad fetch task to pull from Attic instead of S3
- Simplify push-nix-cache to single attic push command
- Update documentation with new security model

Security:
- ATTIC_TOKEN must be explicitly provided as Forgejo secret
- Prevents untrusted repos from pushing to cache
- Separate ci/toph caches for different trust levels

Benefits:
- Simpler: Single command instead of sign + copy + sync
- Faster: Native Attic protocol vs S3 object storage
- Safer: Explicit opt-in prevents unauthorized cache writes
- Standards-compliant: Proper Nix binary cache protocol

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-27 21:19:09 +01:00
72569d2a53
fix: forward NOMAD_TOKEN to $GITHUB_ENV for shell access
Job-level env vars from secrets aren't injected as real shell env
vars in Docker-based composite actions. Bridge via $GITHUB_ENV,
same pattern as NOMAD_ADDR.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 01:22:08 +01:00
ee3dfcb19a
feat: add NOMAD_TOKEN support and static-sites namespace
Jobs now target the static-sites namespace (required by the CI ACL
policy) and docs include NOMAD_TOKEN in all workflow examples.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 00:18:34 +01:00
76c0b483c8
fix: indent heredoc content to satisfy YAML block scalar parser
YAML ends a block scalar when it sees content less indented than
the first content line. The JSON heredoc at column 0 caused the
parser to bail out mid-block. Indenting to 8 spaces keeps it inside
the run: | scalar; YAML strips that indentation before handing the
script to the shell, so the NOMAD_EOF terminator lands at column 0
as required.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-17 11:06:04 +01:00
22ad13e061
fix: correct nomad job run flags and JSON format in deploy-nix-site
- Add -json flag to nomad job run (API JSON uses PascalCase, not HCL2)
- Quote heredoc to prevent shell from mangling Nomad interpolations
- Use Forgejo template expressions for S3 creds in fetch task env
- Fix Volumes to map format (Nomad API JSON, not array)
- Remove unused shell variable assignments

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-17 11:03:05 +01:00
a8e0e936fc
Fix binary cache secret key handling
Write NIX_SIGNING_KEY to temp file since --secret-key expects a path.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-16 15:37:49 +01:00
6d75ec10f6
Remove Nomad installation from action
Already available in runner image.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-16 15:36:10 +01:00
297001e5fd
Implement prestart fetch with S3 cache for dependencies
- Prestart task fetches from S3 binary cache into shared volume
- Server task serves from shared volume (read-only)
- Build uses S3 cache as substituter (ultra-fast builds for shared deps)
- Push entire closure to cache (derivation + dependencies)
- No host involvement, pure container isolation

Architecture:
- Site A builds nodejs_20 + vite → pushed to cache
- Site B builds → pulls nodejs_20 + vite from cache (instant)
- Only builds site-specific code

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-16 15:02:21 +01:00
01d6a3e779
Switch to S3 binary cache with isolated store paths
- Build in isolated Nix container
- Push to S3 binary cache (no host /nix/store access)
- Pull specific store paths to alvin
- Mount only specific /nix/store/hash to /var/www (read-only)
- Generate signing keys for cache authentication
- Update documentation with binary cache setup

Security improvements:
- Build container has no access to host /nix/store
- Web server only mounts its specific store path
- Proper isolation at every layer

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-16 14:53:11 +01:00
33c8946041
Add Nix-based deploy action for isolated builds
- New deploy-nix-site action using Nix flakes
- Runs in nixos/nix:latest container for proper isolation
- Builds using flake.nix, uploads to S3, deploys to Nomad
- Update deploy-site action to install Nomad CLI
- Document both actions in README

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-16 14:39:25 +01:00