feat!: Urutau 2.0.0, ultralight probes and a single analysis hub
Each server runs an ultralight probe (scratch image, ~7 MiB RSS) that tails the logs, ships raw lines to the hub over HTTPS with an on-disk spool, and applies enforce decisions locally. The hub keeps one node per probe (primary node = the 1.x data dir, unchanged), does all analysis and serves the UI. Peer federation is removed. 'urutau import' brings 1.x data dirs in with hash and count verification. UI: probes page, host qualified incidents, IPs never wrap, egress heatmap labels, live and replay globes no longer auto-rotate, replay repeat, live traffic metrics. BREAKING CHANGE: URUTAU_PEERS, URUTAU_PEER_* and /api/v1/peer/* are gone; log path variables move from the hub to the probe. See docs/migration-2.0.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
23a7a5963a
commit
8546d14cef
130 files changed
+9396
-3311
No files matched your search
+15
-7
@@ -39,8 +39,12 @@ jobs:
|
||||
for f in glob.glob('.gitea/**/*.yml', recursive=True):
|
||||
yaml.safe_load(open(f))
|
||||
"
|
||||
- name: Docker compose config
|
||||
run: docker compose config --quiet
|
||||
- name: Docker compose config (hub and probe)
|
||||
run: |
|
||||
docker compose config --quiet
|
||||
URUTAU_HUB=https://hub.example.org URUTAU_PROBE_NAME=ci docker compose -f deploy/probe/docker-compose.yml config --quiet
|
||||
- name: shellcheck (host kit)
|
||||
run: docker run --rm -v "$PWD:/mnt:ro" koalaman/shellcheck:v0.10.0 deploy/host/install.sh
|
||||
- name: gofmt
|
||||
run: test -z "$(gofmt -l .)"
|
||||
- run: go vet ./...
|
||||
@@ -70,15 +74,19 @@ jobs:
|
||||
govulncheck ./...
|
||||
|
||||
image:
|
||||
name: Docker image (build and smoke test)
|
||||
name: Docker images (build and smoke test)
|
||||
if: ${{ gitea.event_name == 'pull_request' }}
|
||||
runs-on: linux-arm64
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- name: Build
|
||||
run: docker build -t "urutau-ci:${{ gitea.run_id }}" .
|
||||
- name: Smoke test
|
||||
- name: Build hub
|
||||
run: docker build --target hub -t "urutau-ci:${{ gitea.run_id }}" .
|
||||
- name: Build probe
|
||||
run: docker build --target probe -t "urutau-probe-ci:${{ gitea.run_id }}" .
|
||||
- name: Smoke test (hub)
|
||||
run: scripts/smoke-image.sh "urutau-ci:${{ gitea.run_id }}"
|
||||
- name: Smoke test (probe, under 15 MB)
|
||||
run: scripts/smoke-probe.sh "urutau-probe-ci:${{ gitea.run_id }}"
|
||||
- name: Clean up
|
||||
if: always()
|
||||
run: docker rmi -f "urutau-ci:${{ gitea.run_id }}" >/dev/null 2>&1 || true
|
||||
run: docker rmi -f "urutau-ci:${{ gitea.run_id }}" "urutau-probe-ci:${{ gitea.run_id }}" >/dev/null 2>&1 || true
|
||||
@@ -1,9 +1,10 @@
|
||||
name: Release
|
||||
|
||||
# Publishes the multi-arch Urutau image (linux/amd64 + linux/arm64) to the Gitea
|
||||
# container registry. A merge into main publishes `edge`; a v* tag re-points the
|
||||
# image already built for the same inputs to X.Y.Z, X.Y and latest (no rebuild)
|
||||
# and creates the Gitea Release. Needs the secret REGISTRY_TOKEN (Gitea token
|
||||
# Publishes the two multi-arch Urutau images (linux/amd64 + linux/arm64) to the
|
||||
# Gitea container registry: the hub (<repo>) and the probe (<repo>-probe), both
|
||||
# built from the same Dockerfile. A merge into main publishes `edge`; a v* tag
|
||||
# re-points the images already built for the same inputs to X.Y.Z, X.Y and
|
||||
# latest (no rebuild) and creates the Gitea Release. Needs the secret REGISTRY_TOKEN (Gitea token
|
||||
# with write:package) visible to this repository.
|
||||
on:
|
||||
push:
|
||||
@@ -19,8 +20,8 @@ env:
|
||||
REGISTRY: git.lucasrguerra.dev.br
|
||||
|
||||
jobs:
|
||||
# The image is built only from these paths, so their tree hashes identify it.
|
||||
# When inputs-<hash> already exists (docs-only merge, workflow change, or a tag
|
||||
# The images are built only from these paths, so their tree hashes identify
|
||||
# them. When inputs-<hash> already exists for BOTH images (docs-only merge, workflow change, or a tag
|
||||
# on a commit main already published), nothing is built or tested again.
|
||||
plan:
|
||||
name: Plan (reuse the published image?)
|
||||
@@ -29,6 +30,7 @@ jobs:
|
||||
inputs: ${{ steps.plan.outputs.inputs }}
|
||||
reuse: ${{ steps.plan.outputs.reuse }}
|
||||
image: ${{ steps.plan.outputs.image }}
|
||||
probe_image: ${{ steps.plan.outputs.probe_image }}
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- id: plan
|
||||
@@ -40,26 +42,30 @@ jobs:
|
||||
git cat-file -e HEAD:go.sum 2>/dev/null && paths="$paths go.sum"
|
||||
inputs=$(for p in $paths; do git rev-parse "HEAD:$p"; done | sha256sum | cut -c1-16)
|
||||
ns="${REPO,,}"
|
||||
token=$(curl -fsS "https://$REGISTRY/v2/token?service=container_registry&scope=repository:$ns:pull" | jq -r .token)
|
||||
code=$(curl -s -o /dev/null -w '%{http_code}' -I \
|
||||
-H "Authorization: Bearer $token" \
|
||||
-H 'Accept: application/vnd.oci.image.index.v1+json,application/vnd.docker.distribution.manifest.list.v2+json' \
|
||||
"https://$REGISTRY/v2/$ns/manifests/inputs-$inputs")
|
||||
echo "inputs-$inputs -> HTTP $code"
|
||||
reuse=false; [ "$code" = 200 ] && reuse=true
|
||||
reuse=true
|
||||
for repo in "$ns" "$ns-probe"; do
|
||||
token=$(curl -fsS "https://$REGISTRY/v2/token?service=container_registry&scope=repository:$repo:pull" | jq -r .token)
|
||||
code=$(curl -s -o /dev/null -w '%{http_code}' -I \
|
||||
-H "Authorization: Bearer $token" \
|
||||
-H 'Accept: application/vnd.oci.image.index.v1+json,application/vnd.docker.distribution.manifest.list.v2+json' \
|
||||
"https://$REGISTRY/v2/$repo/manifests/inputs-$inputs")
|
||||
echo "$repo inputs-$inputs -> HTTP $code"
|
||||
[ "$code" = 200 ] || reuse=false
|
||||
done
|
||||
echo "inputs=$inputs" >> "$GITHUB_OUTPUT"
|
||||
echo "reuse=$reuse" >> "$GITHUB_OUTPUT"
|
||||
echo "image=$REGISTRY/$ns" >> "$GITHUB_OUTPUT"
|
||||
echo "probe_image=$REGISTRY/$ns-probe" >> "$GITHUB_OUTPUT"
|
||||
|
||||
ci:
|
||||
needs: plan
|
||||
if: ${{ needs.plan.outputs.reuse != 'true' }}
|
||||
uses: ./.gitea/workflows/ci.yml
|
||||
|
||||
# Each architecture is built on a native runner (no QEMU) and pushed under a
|
||||
# per-architecture tag; publish joins them into one manifest list.
|
||||
# Each architecture of each image is built on a native runner (no QEMU) and
|
||||
# pushed under a per-architecture tag; publish joins them into one manifest list.
|
||||
build:
|
||||
name: Build image (${{ matrix.arch }})
|
||||
name: Build ${{ matrix.target }} image (${{ matrix.arch }})
|
||||
needs: [plan, ci]
|
||||
if: ${{ needs.plan.outputs.reuse != 'true' }}
|
||||
runs-on: ${{ matrix.runner }}
|
||||
@@ -67,8 +73,10 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- { arch: amd64, platform: linux/amd64, runner: linux-amd64 }
|
||||
- { arch: arm64, platform: linux/arm64, runner: linux-arm64 }
|
||||
- { target: hub, arch: amd64, platform: linux/amd64, runner: linux-amd64 }
|
||||
- { target: hub, arch: arm64, platform: linux/arm64, runner: linux-arm64 }
|
||||
- { target: probe, arch: amd64, platform: linux/amd64, runner: linux-amd64 }
|
||||
- { target: probe, arch: arm64, platform: linux/arm64, runner: linux-arm64 }
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: docker/setup-buildx-action@v4
|
||||
@@ -82,23 +90,33 @@ jobs:
|
||||
# Same end result, no action to clone.
|
||||
- name: Build and push (per architecture)
|
||||
run: |
|
||||
image='${{ matrix.target == 'probe' && needs.plan.outputs.probe_image || needs.plan.outputs.image }}'
|
||||
docker buildx build \
|
||||
--target "${{ matrix.target }}" \
|
||||
--platform "${{ matrix.platform }}" \
|
||||
--push \
|
||||
-t "${{ needs.plan.outputs.image }}:build-${{ gitea.sha }}-${{ matrix.arch }}" \
|
||||
--cache-from "type=registry,ref=${{ needs.plan.outputs.image }}:buildcache-${{ matrix.arch }}" \
|
||||
--cache-to "type=registry,ref=${{ needs.plan.outputs.image }}:buildcache-${{ matrix.arch }},mode=max" \
|
||||
-t "$image:build-${{ gitea.sha }}-${{ matrix.arch }}" \
|
||||
--cache-from "type=registry,ref=$image:buildcache-${{ matrix.arch }}" \
|
||||
--cache-to "type=registry,ref=$image:buildcache-${{ matrix.arch }},mode=max" \
|
||||
.
|
||||
# Runs the image that was just pushed, on its own architecture.
|
||||
- name: Smoke test
|
||||
run: scripts/smoke-image.sh "${{ needs.plan.outputs.image }}:build-${{ gitea.sha }}-${{ matrix.arch }}"
|
||||
run: |
|
||||
image='${{ matrix.target == 'probe' && needs.plan.outputs.probe_image || needs.plan.outputs.image }}'
|
||||
scripts/smoke-${{ matrix.target == 'probe' && 'probe' || 'image' }}.sh "$image:build-${{ gitea.sha }}-${{ matrix.arch }}"
|
||||
|
||||
publish:
|
||||
name: Publish tags
|
||||
name: Publish tags (${{ matrix.target }})
|
||||
needs: [plan, build]
|
||||
# build is skipped, not successful, when the image is reused.
|
||||
if: ${{ !cancelled() && needs.plan.result == 'success' && (needs.build.result == 'success' || needs.plan.outputs.reuse == 'true') }}
|
||||
runs-on: linux-arm64
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
target: [hub, probe]
|
||||
env:
|
||||
IMAGE: ${{ matrix.target == 'probe' && needs.plan.outputs.probe_image || needs.plan.outputs.image }}
|
||||
steps:
|
||||
- uses: docker/setup-buildx-action@v4
|
||||
- uses: docker/login-action@v4
|
||||
@@ -110,7 +128,7 @@ jobs:
|
||||
id: meta
|
||||
uses: docker/metadata-action@v6
|
||||
with:
|
||||
images: ${{ needs.plan.outputs.image }}
|
||||
images: ${{ env.IMAGE }}
|
||||
flavor: latest=false
|
||||
tags: |
|
||||
type=semver,pattern={{version}}
|
||||
@@ -120,7 +138,7 @@ jobs:
|
||||
type=sha,format=long
|
||||
- name: Apply tags
|
||||
run: |
|
||||
image='${{ needs.plan.outputs.image }}'
|
||||
image="$IMAGE"
|
||||
tags=$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< '${{ steps.meta.outputs.json }}')
|
||||
inputs='${{ needs.plan.outputs.inputs }}'
|
||||
if [ '${{ needs.plan.outputs.reuse }}' = true ]; then
|
||||
@@ -131,14 +149,14 @@ jobs:
|
||||
fi
|
||||
- name: Check architectures
|
||||
run: |
|
||||
docker buildx imagetools inspect "${{ needs.plan.outputs.image }}:inputs-${{ needs.plan.outputs.inputs }}" \
|
||||
docker buildx imagetools inspect "$IMAGE:inputs-${{ needs.plan.outputs.inputs }}" \
|
||||
--format '{{json .Manifest}}' \
|
||||
| jq -r '.manifests[] | select(.platform.os == "linux") | "\(.platform.os)/\(.platform.architecture)"' \
|
||||
| tee platforms.txt
|
||||
grep -qx linux/amd64 platforms.txt && grep -qx linux/arm64 platforms.txt
|
||||
- name: Summary
|
||||
run: |
|
||||
{ echo "### Urutau image published (linux/amd64, linux/arm64)"; echo; echo '```'
|
||||
{ echo "### Urutau ${{ matrix.target }} image published (linux/amd64, linux/arm64)"; echo; echo '```'
|
||||
echo "${{ steps.meta.outputs.tags }}"; echo '```'; } >> "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
gitea-release:
|
||||
@@ -156,11 +174,12 @@ jobs:
|
||||
TOKEN: ${{ gitea.token }}
|
||||
API: ${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}
|
||||
IMAGE: ${{ needs.plan.outputs.image }}
|
||||
PROBE_IMAGE: ${{ needs.plan.outputs.probe_image }}
|
||||
run: |
|
||||
if curl -fsS -H "Authorization: token $TOKEN" "$API/releases/tags/$TAG" >/dev/null 2>&1; then
|
||||
echo "release $TAG already exists"; exit 0
|
||||
fi
|
||||
{ scripts/release-notes.sh "$TAG"; echo; echo '```bash'; echo "docker pull $IMAGE:${TAG#v}"; echo '```'; } > notes.md
|
||||
{ scripts/release-notes.sh "$TAG"; echo; echo '```bash'; echo "docker pull $IMAGE:${TAG#v}"; echo "docker pull $PROBE_IMAGE:${TAG#v}"; echo '```'; } > notes.md
|
||||
pre=false; case "$TAG" in *-*) pre=true ;; esac
|
||||
jq -n --arg tag "$TAG" --arg name "Urutau ${TAG#v}" --rawfile body notes.md --argjson pre "$pre" \
|
||||
'{tag_name:$tag, name:$name, body:$body, prerelease:$pre}' > release.json
|
||||
|
||||
Reference in new issue
Block a user