Compare commits

...

13 commits
prod ... dev

Author SHA1 Message Date
Niels Göttsch
964b0be064 fix(docker): drop /var/run symlink from chisel rootfs for Kaniko
All checks were successful
Build & Publish / Check (push) Successful in 2m25s
Build & Publish / Build & Publish (push) Successful in 5m33s
The runtime stage copies the chisel rootfs onto `/` in a scratch stage.
chisel ships /var/run as a symlink to /run; Kaniko replacing it forces a
RemoveAll of the destination /var/run, which on the Forgejo act runner
holds a busy /var/run/act bind-mount -> 'unlinkat ... device or resource
busy'. The image does not need /var/run, so remove the symlink.
2026-07-17 10:40:05 +02:00
Niels Göttsch
3aa1abe175 ci: ignore busy /var/run/act mount during Kaniko scratch build
Some checks failed
Build & Publish / Check (push) Successful in 2m26s
Build & Publish / Build & Publish (push) Failing after 5m10s
The runtime stage is FROM scratch with COPY /rootfs /, so Kaniko
rebuilds the container root and tries to unlink the act runner's
/var/run/act bind-mount (device or resource busy). Pass
--ignore-path=/var/run/act so Kaniko skips that runner artifact.
2026-07-17 10:17:52 +02:00
Niels Göttsch
b83f9e95b6 ci: authenticate registry push with REGISTRY_USER/REGISTRY_TOKEN PAT
Some checks failed
Build & Publish / Check (push) Successful in 2m18s
Build & Publish / Build & Publish (push) Failing after 6m51s
Forgejo's auto GITHUB_TOKEN lacks package-write on the moby org, so the
Kaniko push 401s (reqPackageAccess). Use the write:package PAT secrets
for the registry auth (matching moby/uberbau_xyz and moby/claude-code);
the git-context clone stays on the auto token.
2026-07-17 10:02:15 +02:00
Niels Göttsch
1ea007d330 ci: point deploy pipeline at moby/brewlog after repo move
Some checks failed
Build & Publish / Check (push) Successful in 2m24s
Build & Publish / Build & Publish (push) Failing after 3s
The repo moved from the uberbau owner to moby on the zo forge. Update
the image registry path and Kaniko git context accordingly.
2026-07-17 09:52:06 +02:00
Niels Göttsch
ebb05ed9c1 Merge branch 'feat/additional-invite-links' into dev
Some checks failed
Build & Publish / Check (push) Successful in 2m19s
Build & Publish / Build & Publish (push) Failing after 3s
2026-07-17 09:25:21 +02:00
Niels Göttsch
c108a39f2c fix(cli): use Duration::from_mins for token wait timeout
Satisfies clippy::duration_suboptimal_units by expressing the 2-minute
browser-auth timeout with from_mins(2) instead of from_secs(120).
2026-07-17 09:20:01 +02:00
Niels Göttsch
2312315f34 docs(readme): document prek install via uv in Development Setup
prek is a standalone uv-installed binary, not provided by mise install.
When absent from PATH, `prek run -av` fails with a misleading
"failed to run cargo fmt -- --check" message. Add the `uv tool install
prek` step and a note clarifying the failure mode.
2026-07-17 09:06:25 +02:00
Niels Göttsch
2e55c72522 ci: grant the job token packages:write for the registry push
Some checks failed
Build & Publish / Check (push) Successful in 7m40s
Build & Publish / Build & Publish (push) Failing after 4s
Kaniko's up-front push-permission check 401'd (reqPackageAccess): the Forgejo
auto GITHUB_TOKEN has no package-write scope by default. Declare
`permissions: {contents: read, packages: write}` so the token can push to the
forge container registry (git clone still needs contents:read).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-16 18:09:32 +02:00
Niels Göttsch
423ddc7870 ci: build image daemonless with Kaniko (no Docker)
Some checks failed
Build & Publish / Check (push) Successful in 2m15s
Build & Publish / Build & Publish (push) Failing after 9s
Replace the docker buildx / build-push-action build job with Kaniko running as
the job container: it builds the Dockerfile from the git context and pushes to
the forge registry, with no Docker daemon, no buildx, and no privileged DinD.

Kaniko cannot handle BuildKit `RUN --mount=type=cache`, so drop the two cache
mounts on the cargo build layer (plain `cargo build` now). Document the pipeline
and this gotcha (plus the node20-only runner and full-github-URL action rules) in
the README so it isn't reintroduced.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-16 17:17:09 +02:00
Niels Göttsch
168b674efe ci: source build-job actions from github.com, not the forge mirror
Some checks failed
Build & Publish / Check (push) Successful in 2m12s
Build & Publish / Build & Publish (push) Failing after 13m37s
The build job aborted during action preparation while cloning the docker/*
actions from code.forgejo.org (the checkout clone already warned "some refs
were not updated"). The check job proved that full github.com `uses:` URLs
clone reliably on this runner (mise-action@v2 worked), so pull checkout and the
docker actions from github.com directly. All are node20, which the runner
supports.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-16 16:38:16 +02:00
Niels Göttsch
e6555bd873 ci: install only Rust in the check job, drop sudo
Some checks failed
Build & Publish / Check (push) Successful in 7m36s
Build & Publish / Build & Publish (push) Failing after 13m36s
The check job failed inside mise: mise.toml pulls the full dev toolchain
(tailwind, cargo-watch, flyctl, shellcheck, mvdan/sh, ...) and resolves most of
it via api.github.com, which 401s on the runner (no github.com token) ->
"Failed to install tools" -> exit 1.

CI only needs Rust for fmt/clippy/test, so restrict mise to `install_args: rust`
(rust resolves through rustup, no GitHub API). Also drop `sudo` (the runner
image runs as root and has none) and the redundant `rustup component add`
(mise installs rustfmt/clippy from mise.toml). Keep mold — the .cargo linker
flag requires it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-16 16:02:53 +02:00
Niels Göttsch
d904689b38 ci: pin actions to the node20 generation for the forge runner
Some checks failed
Build & Publish / Check (push) Failing after 3m28s
Build & Publish / Build & Publish (push) Has been skipped
The forge's forgejo-runner (v6.3.1) only supports node runtimes up to node20,
but resolves bare `uses:` from code.forgejo.org where checkout@v6 (and the
other @v5/v6/v7 actions) declare `runs.using: node24` -> "must be one of
[... node20 ...], got node24" -> job failed before any step ran.

- checkout@v6->v4, cache@v5->v4, docker/{setup-buildx@v4->v3, login@v4->v3,
  build-push@v7->v6}: all node20.
- jdx/mise-action isn't mirrored on code.forgejo.org; reference it by full
  github URL, pinned to @v2 (node20).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-16 15:55:22 +02:00
Niels Göttsch
97b1d580e3 ci: repair build pipeline for the zo forge fork
Some checks failed
Build & Publish / Check (push) Failing after 16s
Build & Publish / Build & Publish (push) Has been skipped
The workflows were still the upstream GitHub ones and never ran here:
Deploy triggered on `main` (this fork's branch is `dev`), pushed to
`ghcr.io/jnsgruk/brewlog` (unreachable from this forge), and deployed to
jnsgruk's Fly.io.

- Deploy → build on push to `dev`, publish to this forge's own registry
  (git.ziemlichoptimal.de/uberbau/brewlog:{sha,dev}) via the auto GITHUB_TOKEN.
- Drop the Fly.io deploy step and the dead version-extract step; the moby
  homelab deploys the image via Flux GitOps, not from this pipeline.
- Retarget PR CI (push.yml) from `main` to `dev`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-16 15:50:58 +02:00
5 changed files with 130 additions and 58 deletions

View file

@ -1,25 +1,53 @@
name: Deploy
name: Build & Publish
# Fork build pipeline for the "zo" forge (git.ziemlichoptimal.de/moby/brewlog).
# On every push to `dev` this checks the code, then builds the container and
# publishes it to this forge's own container registry. The moby homelab
# (git.ziemlichoptimal.de/moby/cluster-moby) deploys the resulting image via
# Flux GitOps — this pipeline does NOT deploy anything itself (the upstream
# Fly.io deploy step was removed).
on:
push:
branches: ["main"]
branches: ["dev"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# The registry push uses a PAT with `write:package` scope, supplied via the
# REGISTRY_USER / REGISTRY_TOKEN Actions secrets (same as moby/uberbau_xyz and
# moby/claude-code). Forgejo's auto GITHUB_TOKEN lacks org package-write, so a
# push authenticated with it 401s (reqPackageAccess). `contents: read` keeps the
# Kaniko git-context clone (over the auto token) working; `packages: write` is
# belt-and-suspenders on the auto token.
permissions:
contents: read
packages: write
env:
# This forge's built-in container registry, same host as the git server.
REGISTRY: git.ziemlichoptimal.de
IMAGE: git.ziemlichoptimal.de/moby/brewlog
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
uses: actions/checkout@v4
- name: Install mise
uses: jdx/mise-action@v4
# The repo's mise.toml pulls the whole dev toolchain (tailwind, cargo-watch,
# flyctl, shellcheck, ...), and mise resolves most of those via the GitHub
# API — which 401s on this runner (it has no github.com token), failing the
# entire install. CI only needs the pinned Rust toolchain, so install it
# directly via mise (rust resolves through rustup, no GitHub API).
- name: Install Rust toolchain
uses: https://github.com/jdx/mise-action@v2
with:
install_args: rust
- name: Cache Cargo artifacts
uses: actions/cache@v5
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
@ -31,11 +59,10 @@ jobs:
cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}-
cargo-${{ runner.os }}-
# No sudo on the node:20-bookworm runner image (job runs as root). mold is
# required by .cargo/config.toml's linker flag (-fuse-ld=mold).
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y clang lld mold libssl-dev pkg-config
- name: Ensure Rust components
run: rustup component add rustfmt clippy
run: apt-get update && apt-get install -y --no-install-recommends clang lld mold pkg-config
- name: Check formatting
run: cargo fmt -- --check
@ -46,44 +73,46 @@ jobs:
- name: Run tests
run: cargo test -- --show-output
deploy:
name: Deploy
build:
name: Build & Publish
runs-on: ubuntu-latest
needs: [check]
# Build the image DAEMONLESS with Kaniko — no Docker, no buildx, no
# privileged DinD. The job runs *inside* the Kaniko executor image, which
# builds the Dockerfile and pushes straight to the forge registry.
container:
image: gcr.io/kaniko-project/executor:v1.24.0-debug
defaults:
run:
# The kaniko -debug image is busybox-only (no bash).
shell: sh
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install mise
uses: jdx/mise-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract version from Cargo.toml
id: version
run: echo "version=$(grep '^version = ' Cargo.toml | head -1 | cut -d'"' -f2)" >> "$GITHUB_OUTPUT"
- name: Build and push container
uses: docker/build-push-action@v7
with:
context: .
push: true
tags: |
ghcr.io/jnsgruk/brewlog:${{ github.sha }}
ghcr.io/jnsgruk/brewlog:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Deploy to Fly.io
run: |
flyctl deploy -i "ghcr.io/jnsgruk/brewlog:${{ github.sha }}"
- name: Build and push (Kaniko)
env:
FLY_ACCESS_TOKEN: ${{ secrets.FLY_API_TOKEN }}
# Registry push uses a PAT with write:package scope (Forgejo's auto
# GITHUB_TOKEN lacks org package-write -> 401 reqPackageAccess).
FORGE_USER: ${{ secrets.REGISTRY_USER }}
FORGE_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
# Kaniko clones the `--context` git URL over the auto token (read).
GIT_USERNAME: ${{ github.actor }}
GIT_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
run: |
set -eu
# Registry auth for the push (docker config.json format).
AUTH=$(printf '%s:%s' "$FORGE_USER" "$FORGE_TOKEN" | base64 | tr -d '\n')
mkdir -p /kaniko/.docker
printf '{"auths":{"%s":{"auth":"%s"}}}' "$REGISTRY" "$AUTH" > /kaniko/.docker/config.json
# Kaniko clones the context itself (this job has no node for JS actions
# like checkout). `dev` is the moving branch tag; the commit SHA is the
# immutable ref the moby Deployment pins by digest.
# The runtime stage is `FROM scratch` + `COPY /rootfs /`, so Kaniko
# rebuilds the container root. The act runner bind-mounts /var/run/act
# into the job container; Kaniko can't unlink that busy mount while
# laying down the rootfs (unlinkat ... device or resource busy), so
# ignore it. It is a runner artifact and must not be in the image.
/kaniko/executor \
--context "git://${REGISTRY}/moby/brewlog.git#refs/heads/dev" \
--dockerfile Dockerfile \
--ignore-path=/var/run/act \
--destination "${IMAGE}:${GITHUB_SHA}" \
--destination "${IMAGE}:dev"

View file

@ -1,7 +1,7 @@
name: CI
on:
pull_request:
branches: ["main"]
branches: ["dev"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@ -13,13 +13,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
uses: actions/checkout@v4
- name: Install mise
uses: jdx/mise-action@v4
uses: https://github.com/jdx/mise-action@v2
- name: Cache Cargo artifacts
uses: actions/cache@v5
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
@ -51,13 +51,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
uses: actions/checkout@v4
- name: Install mise
uses: jdx/mise-action@v4
uses: https://github.com/jdx/mise-action@v2
- name: Cache Cargo artifacts
uses: actions/cache@v5
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/

View file

@ -30,9 +30,10 @@ RUN mkdir -p /usr/local/bin \
WORKDIR /app
COPY . .
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/app/target \
cargo build --release --locked \
# NB: no `RUN --mount=type=cache` here on purpose. The CI image builder is
# Kaniko (daemonless, no Docker/BuildKit), which does not support BuildKit cache
# mounts — it errors on them. Keep this RUN plain. See README "CI / build".
RUN cargo build --release --locked \
&& mkdir -p /out \
&& cp target/release/brewlog /out/brewlog
@ -61,6 +62,14 @@ RUN useradd --root /rootfs -u 1000 -U -M -s /bin/false brewlog \
&& mkdir -p /rootfs/home/brewlog /rootfs/data \
&& chown 1000:1000 /rootfs/home/brewlog /rootfs/data
# chisel's base-files ships /var/run as a symlink to /run. When the CI builder
# (Kaniko) lays this rootfs onto `/` for the scratch stage, replacing that
# symlink forces a RemoveAll of the destination /var/run — which on the Forgejo
# act runner is a directory holding a busy /var/run/act bind-mount, so the copy
# fails with "unlinkat /var/run/act: device or resource busy". The runtime image
# does not need /var/run, so drop the symlink to avoid the collision.
RUN rm -rf /rootfs/var/run
# ---------------------------------------------------------------------------
# Runtime — scratch with chisel rootfs
# ---------------------------------------------------------------------------

View file

@ -147,9 +147,12 @@ sudo apt install -y clang mold pkg-config libssl-dev \
mise trust
mise install # Install all dev tools
mise run install-e2e # Install Chrome for Testing + ChromeDriver
uv tool install prek # Install prek (git hook runner) as a standalone tool
prek install # Install git hooks
```
> **Note:** `prek` is a standalone binary installed via [`uv`](https://docs.astral.sh/uv/) and must be on `PATH`. If it is missing, `prek run -av` cannot invoke `cargo fmt -- --check` and reports `failed to run cargo fmt -- --check` — this is the missing `prek`/toolchain, not a formatting error. Installing `prek` resolves it.
## Contributing
```bash
@ -162,6 +165,37 @@ cargo build # Build
See [CLAUDE.md](CLAUDE.md) for architecture, code patterns, and development conventions.
## CI / build pipeline (this fork)
This fork lives on the **zo** Forgejo forge
(`git.ziemlichoptimal.de/uberbau/brewlog`, default branch **`dev`**) and is
deployed to the **moby** homelab via Flux GitOps. `.github/workflows/deploy.yml`
runs on every push to `dev`: it lints/tests (`check`), then builds and publishes
the container image to the forge's own registry as
`git.ziemlichoptimal.de/uberbau/brewlog:{dev,<sha>}`. The moby deployment pins
that image by digest and bumps it per release.
The build is **daemonless — it does not use Docker**. It runs
[Kaniko](https://github.com/GoogleContainerTools/kaniko) as the job container,
building the `Dockerfile` (context pulled straight from git) and pushing to the
registry. No `docker`, no buildx, no privileged Docker-in-Docker.
### Gotchas (learned the hard way)
- **Kaniko does not support BuildKit `RUN --mount=type=cache`.** The build fails
on it. Keep every `RUN` in the `Dockerfile` plain — no BuildKit cache mounts.
(This is why the Rust build layer is a plain `cargo build`; we have been bitten
by this before, so do not "re-add caching" to the Dockerfile.)
- **The forge's Actions runner is node20-only.** Pin JS actions to their node20
generation (`actions/checkout@v4`, `actions/cache@v4`, and if you reintroduce
docker actions, `@v3`/`@v6`) — the newer `@v5/@v6/@v7` releases declare
`runs.using: node24`, which the runner rejects (`must be one of [… node20 …]`).
- **Reference actions by full `github.com` URL**
(`uses: https://github.com/owner/repo@ref`). The runner's default action
mirror (`code.forgejo.org`) is incomplete/flaky and aborts clones mid-run.
- The `check` job installs only Rust via mise (`install_args: rust`); the full
`mise.toml` toolchain pulls tools from the GitHub API, which 401s on the runner.
## License
[Apache License 2.0](LICENSE)

View file

@ -83,7 +83,7 @@ pub async fn create_token(client: &BrewlogClient, cmd: CreateTokenCommand) -> Re
result = rx => {
result.context("callback server closed without receiving a token")?
}
() = tokio::time::sleep(std::time::Duration::from_secs(120)) => {
() = tokio::time::sleep(std::time::Duration::from_mins(2)) => {
return Err(anyhow!("timed out waiting for browser authentication (2 minutes)"));
}
};