Commit graph

57 commits

Author SHA1 Message Date
3ff832a982
fix: use /tmp for TMPDIR instead of PWD/tmp
/tmp should always be writable in containers, whereas PWD/tmp
might not be accessible from nested containers.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-04 17:19:27 +01:00
318db31b94
fix: set TMPDIR for skopeo to writable location 2026-03-04 15:02:02 +01:00
29739f3d4d
feat: make registry auth optional in docker-build-nix
Support unauthenticated registries (e.g., Tailscale-protected internal
registries) by making username/password optional. Only passes credentials
to skopeo if both are provided.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-04 14:56:40 +01:00
255fe0fdcc
fix: use registry.toph.so as default registry 2026-03-04 14:54:26 +01:00
7f3b4032f9
feat: use skopeo instead of docker for image push
Replace docker load + docker push with skopeo copy to push OCI
images directly to the registry. Benefits:
- No Docker daemon required in runner
- More secure (no socket mounting needed)
- Simpler - direct OCI tarball to registry copy
- Works in any environment with skopeo

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-04 14:53:10 +01:00
cd4c6208cc
fix: use if statement instead of continue-on-error for Attic 2026-03-04 14:35:02 +01:00
6534bcfe08
fix: make Attic push non-fatal in docker-build-nix 2026-03-04 14:22:20 +01:00
e702f56d87
fix: add --refresh to nix build to bust eval cache 2026-03-04 13:52:26 +01:00
346b693bc7
fix: use single-user Nix builds in docker-build-nix
Set build-users-group to empty to disable multi-user builds,
which require nixbld group and build users. This allows the
action to work in single-user Nix environments like containers.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-04 12:20:47 +01:00
098e2c0586
fix: enable Nix experimental features in docker-build-nix
Add Nix config step to enable nix-command and flakes features
before building. Also configures Attic substituters for faster builds.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-04 12:14:30 +01:00
b163ffa64b
feat: add docker-build-nix action for reproducible OCI images
Add reusable action for building Docker images with Nix flakes:
- Full reproducibility with Nix derivations
- Attic cache integration for build artifacts
- Optimized layering with dockerTools.buildLayeredImage
- Automatic Nix binary cache usage

Use this instead of docker-build when you want:
- Bit-for-bit identical builds
- Better caching via Attic/Nix
- Smaller, optimized images

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-04 12:11:29 +01:00
ac56aac0a7
feat: add docker-build reusable action
Add reusable action for building and pushing Docker images with:
- S3 build cache support (SeaweedFS)
- Optional Nix/Attic cache configuration
- Auto-tagging based on branches, PRs, and semver tags
- Multi-registry support

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-04 12:05:31 +01:00
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
694c591332
debug: check NOMAD_ADDR and reachability in deploy step 2026-02-19 01:43:27 +01:00
b7ba4c1c0a
fix(deploy-static-site): inject NOMAD_ADDR via runner, use shared nomad/jobs var
Remove hardcoded nomad-addr input — NOMAD_ADDR is now injected by the
Forgejo runner via container.options using host.docker.internal.

Switch Nomad Variable path from static-sites/s3 to nomad/jobs so all
jobs in the namespace can read it without explicit ACL policies.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-19 01:15:08 +01:00
bcca32baae
fix(deploy-static-site): remove nix profile install, tools provided by runner image 2026-02-19 00:24:36 +01:00
3f27f6b84f
fix(deploy-static-site): inline tool cache push to fix HOME expansion in with block 2026-02-18 22:25:06 +01:00
cc2f605905
fix(deploy-static-site): quote action_path in nix eval expr to handle @ in path 2026-02-18 22:03:55 +01:00
8edf272e90
fix(deploy-static-site): cache installed tools to S3 after first build 2026-02-18 22:02:29 +01:00
ae48e175e2
fix(deploy-static-site): remove namespace apply (pre-created in infra setup) 2026-02-18 21:52:45 +01:00
52c37b1fd5
fix(push-nix-cache): avoid nix S3 backend aws-chunked issue via file cache + aws s3 sync 2026-02-18 21:10:17 +01:00
c0ba8096ba
fix(deploy-static-site): add nix profile bin to PATH after install 2026-02-18 18:23:51 +01:00
f870ef0bf3
fix: pass S3 creds via env vars for nix copy, not URL params 2026-02-18 13:54:05 +01:00
5bb8b5a427
chore: disable VM smoke test pending KVM on runner
Some checks failed
Build and Push static-server Image / build (push) Failing after 44s
See #1

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-18 13:51:19 +01:00
b6a9eb1e84
fix: replace VM test with runCommand smoke test (no KVM in CI)
Some checks failed
Build and Push static-server Image / build (push) Failing after 46s
2026-02-18 13:41:44 +01:00
b094952455
feat: add push-nix-cache action, wire into deploy-static-site and build-static-server
Some checks failed
Build and Push static-server Image / build (push) Failing after 1m45s
Extracts sign+push logic into a reusable push-nix-cache action.
Both the site deploy and the image build now use it.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-18 13:38:06 +01:00
38792a985f
fix: pkgs.nixosTest -> pkgs.testers.nixosTest
Some checks failed
Build and Push static-server Image / build (push) Failing after 1m46s
2026-02-18 13:33:20 +01:00
e005ac38fd
fix: use pkgs.nixosTest, not nixpkgs.lib.nixosTest
Some checks failed
Build and Push static-server Image / build (push) Failing after 17s
2026-02-18 13:32:11 +01:00
e3df182616
ci: also trigger on workflow file changes
Some checks failed
Build and Push static-server Image / build (push) Failing after 17s
2026-02-18 13:31:04 +01:00
dc79590384
ci: run smoke check before build, trigger on flake.lock changes 2026-02-18 13:28:00 +01:00
dd382a5cc4
feat: add smoke check to images flake, lock nixpkgs
Some checks failed
Build and Push static-server Image / build (push) Failing after 43s
NixOS test boots a VM, loads the static-server image, starts it with
index.html + foo.html, and verifies that /foo routes to foo.html
(extensionless URL routing). Also adds flake.lock pinning nixpkgs.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-18 13:26:44 +01:00
bc2885c5c7
feat: pin server image to digest at deploy time 2026-02-18 13:23:18 +01:00
5b2c68c4ef
docs: add file links to README 2026-02-18 13:22:17 +01:00
ada83e01b5
docs: cold-start note for maintainer, simplify infra requirements 2026-02-18 13:21:23 +01:00
af9a4e3e29
feat: auto-create static-sites namespace on deploy 2026-02-18 13:19:44 +01:00
52015863a8
docs: add deploy-static-site README 2026-02-18 13:18:41 +01:00
4b1bbce9af
feat: make NIX_SIGNING_KEY optional, skip Nix cache push if unset 2026-02-18 13:18:11 +01:00
4af132296e
refactor: replace generate-job.py with nomad-job.nix, add flake-output input
Use nix eval --raw --impure + builtins.getEnv instead of Python for
Nomad job JSON generation. Add flake-output input (default: default)
so projects can build non-default outputs like docs.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-18 13:16:08 +01:00
95bf5517f7
fix: allow unfree for nomad install (BSL license) 2026-02-18 13:11:52 +01:00
644dfc4978
refactor: s3 endpoint+bucket as action inputs, secrets stay in env
S3_BUCKET and S3_ENDPOINT are config, not secrets. Move them to
inputs with defaults (s3.toph.so / nix-cache). Calling workflows
only need to supply AWS credentials, NIX_SIGNING_KEY, NOMAD_TOKEN.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-18 13:09:47 +01:00
f0b9c9b904
refactor: move images into deploy-static-site, root CI workflow
Some checks failed
Build and Push static-server Image / build (push) Failing after 46s
- deploy-static-site/images/flake.nix: moved from images/flake.nix
- .forgejo/workflows/build-static-server.yaml: moved from images/.forgejo/
  (Forgejo only picks up workflows from repo root .forgejo/workflows/)
- updated path reference in build workflow

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-18 11:39:19 +01:00
55652569b2
feat: add deploy-static-site action, site-lib, images; remove deploy-oci-site
Content now served from S3 at runtime via shared static-server image.
- deploy-static-site: reads creds from Nomad vars, builds site, pushes
  tarball to S3, generates per-domain Nomad job JSON, deploys
- generate-job.py: emits Nomad job JSON for a static site deployment
- site-lib/flake.nix: mkSite helper, packages.default + devShells only
- images/flake.nix: shared static-server OCI image (sws + awscli2 + tools)
- images CI: builds and pushes static-server on images/flake.nix changes
- deploy-oci-site: removed (superseded by deploy-static-site)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-18 11:27:27 +01:00
04c2b06c14
feat: add deploy-oci-site action
Composite action for deploying Nix flake OCI images to Nomad.
Owns the static-site parameterized Nomad job template, all infra
defaults (registry, S3, Nomad addr), and an optional smoke test.

Site repos only need to provide a flake with an ociImage output
and pass domain + 3 secrets (S3_ACCESS_KEY, S3_SECRET_KEY, NIX_SIGNING_KEY).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-18 10:29:08 +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