feat: Urutau 1.0.0, lightweight threat intelligence and web analytics
Release / Plan (reuse the published image?) (push) Successful in 4s
CI / Docker image (build and smoke test) (push) Skipped
CI / Format and vet (push) Successful in 1m29s
CI / Tests (Linux, race detector) (push) Failing after 1m48s
CI / Dependency audit (push) Successful in 21s
Release / ci (push) Failing after 1m50s
Release / Build image (amd64) (push) Skipped
Release / Build image (arm64) (push) Skipped
Release / Publish tags (push) Skipped
Release / Gitea release (push) Skipped
Release / Plan (reuse the published image?) (push) Successful in 4s
CI / Docker image (build and smoke test) (push) Skipped
CI / Format and vet (push) Successful in 1m29s
CI / Tests (Linux, race detector) (push) Failing after 1m48s
CI / Dependency audit (push) Successful in 21s
Release / ci (push) Failing after 1m50s
Release / Build image (amd64) (push) Skipped
Release / Build image (arm64) (push) Skipped
Release / Publish tags (push) Skipped
Release / Gitea release (push) Skipped
Always-on Go service (stdlib only) that follows the Traefik JSON access log, the sshd log and the fail2ban log of a host, classifies attacks, scores sources, keeps bounded aggregates with snapshots, and serves an embedded dashboard with live updates, offline geolocation (DB-IP Lite), privacy-friendly traffic analytics, an exportable blocklist and token-authenticated federation between instances. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
b4a2c2c9ec
99 files changed
+15403
No files matched your search
@@ -0,0 +1,17 @@
|
||||
name: Report a bug
|
||||
description: Something did not work as expected
|
||||
labels: [bug]
|
||||
body:
|
||||
- type: textarea
|
||||
id: what-happened
|
||||
attributes: { label: "What happened?", description: "Steps to reproduce, expected behavior, and actual behavior." }
|
||||
validations: { required: true }
|
||||
- type: input
|
||||
id: system
|
||||
attributes: { label: "Operating system and Urutau version", placeholder: "Ubuntu 24.04 / urutau 1.0.0" }
|
||||
- type: input
|
||||
id: source
|
||||
attributes: { label: "Log source involved", placeholder: "Traefik access log / sshd auth.log / fail2ban.log / peer federation" }
|
||||
- type: textarea
|
||||
id: log
|
||||
attributes: { label: "Output of urutau doctor --json and the container logs (redact IPs and tokens)", render: shell }
|
||||
@@ -0,0 +1,9 @@
|
||||
## What changes and why
|
||||
|
||||
## Checklist
|
||||
- [ ] `gofmt -l .` prints nothing, `go vet ./...` and `go test -race ./...` pass
|
||||
- [ ] Log fields are treated as hostile input (bounded, escaped, never executed or interpolated)
|
||||
- [ ] Classification and scoring changes come with a test that pins the expected category
|
||||
- [ ] Commits follow Conventional Commits in English and code/comments are in English
|
||||
- [ ] CHANGELOG updated (if there is a user-visible change)
|
||||
- [ ] Documentation kept in the English/Portuguese pair
|
||||
@@ -0,0 +1,84 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
# Documentation-only or local agent state changes do not trigger CI jobs.
|
||||
pull_request:
|
||||
paths-ignore: ['**.md', 'docs/**', 'LICENSE*', '.gitignore', '.githooks/**', '.wolf/**', '.claude/**', '.opencode/**', '.codex/**', '.cursor/**', '.superpowers/**', '.superset/**', '.gitea/ISSUE_TEMPLATE/**', 'scripts/release-notes.sh', '.gitea/workflows/release.yml']
|
||||
workflow_call:
|
||||
|
||||
concurrency:
|
||||
group: ci-${{ gitea.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
GOCACHE: /opt/hostedtoolcache/go-build
|
||||
GOMODCACHE: /opt/hostedtoolcache/go-mod
|
||||
GOPATH: /opt/hostedtoolcache/gopath
|
||||
NPM_CONFIG_CACHE: /opt/hostedtoolcache/npm-cache
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Format and vet
|
||||
runs-on: linux-arm64
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
- uses: actions/setup-node@v7
|
||||
with:
|
||||
node-version: 22
|
||||
- name: UI translation coverage
|
||||
run: node scripts/check-ui-i18n.mjs
|
||||
- name: Workflows and templates (valid YAML)
|
||||
run: |
|
||||
python3 -c 'import yaml' 2>/dev/null \
|
||||
|| python3 -m pip install --quiet --user --break-system-packages pyyaml
|
||||
python3 -c "
|
||||
import glob, yaml
|
||||
for f in glob.glob('.gitea/**/*.yml', recursive=True):
|
||||
yaml.safe_load(open(f))
|
||||
"
|
||||
- name: Docker compose config
|
||||
run: docker compose config --quiet
|
||||
- name: gofmt
|
||||
run: test -z "$(gofmt -l .)"
|
||||
- run: go vet ./...
|
||||
|
||||
test:
|
||||
name: Tests (Linux, race detector)
|
||||
runs-on: linux-arm64
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
- run: go test -race ./...
|
||||
|
||||
audit:
|
||||
name: Dependency audit
|
||||
runs-on: linux-arm64
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
- name: govulncheck
|
||||
run: |
|
||||
command -v govulncheck >/dev/null || go install golang.org/x/vuln/cmd/govulncheck@latest
|
||||
export PATH="$PATH:$(go env GOPATH)/bin"
|
||||
govulncheck ./...
|
||||
|
||||
image:
|
||||
name: Docker image (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
|
||||
run: scripts/smoke-image.sh "urutau-ci:${{ gitea.run_id }}"
|
||||
- name: Clean up
|
||||
if: always()
|
||||
run: docker rmi -f "urutau-ci:${{ gitea.run_id }}" >/dev/null 2>&1 || true
|
||||
@@ -0,0 +1,168 @@
|
||||
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
|
||||
# with write:package) visible to this repository.
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
tags: ['v*']
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: release-${{ gitea.ref }}
|
||||
cancel-in-progress: false
|
||||
|
||||
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
|
||||
# on a commit main already published), nothing is built or tested again.
|
||||
plan:
|
||||
name: Plan (reuse the published image?)
|
||||
runs-on: linux-arm64
|
||||
outputs:
|
||||
inputs: ${{ steps.plan.outputs.inputs }}
|
||||
reuse: ${{ steps.plan.outputs.reuse }}
|
||||
image: ${{ steps.plan.outputs.image }}
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- id: plan
|
||||
env:
|
||||
REPO: ${{ gitea.repository }}
|
||||
run: |
|
||||
paths="Dockerfile .dockerignore go.mod cmd internal logo.png"
|
||||
# go.sum only exists once a dependency is added (the code is stdlib-only today).
|
||||
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
|
||||
echo "inputs=$inputs" >> "$GITHUB_OUTPUT"
|
||||
echo "reuse=$reuse" >> "$GITHUB_OUTPUT"
|
||||
echo "image=$REGISTRY/$ns" >> "$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.
|
||||
build:
|
||||
name: Build image (${{ matrix.arch }})
|
||||
needs: [plan, ci]
|
||||
if: ${{ needs.plan.outputs.reuse != 'true' }}
|
||||
runs-on: ${{ matrix.runner }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- { arch: amd64, platform: linux/amd64, runner: linux-amd64 }
|
||||
- { arch: arm64, platform: linux/arm64, runner: linux-arm64 }
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: docker/setup-buildx-action@v4
|
||||
- uses: docker/login-action@v4
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ gitea.actor }}
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
# Plain `docker buildx build` instead of docker/build-push-action: that
|
||||
# action's large upstream repo reliably hangs the act runner's clone.
|
||||
# Same end result, no action to clone.
|
||||
- name: Build and push (per architecture)
|
||||
run: |
|
||||
docker buildx build \
|
||||
--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" \
|
||||
.
|
||||
# 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 }}"
|
||||
|
||||
publish:
|
||||
name: Publish tags
|
||||
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
|
||||
steps:
|
||||
- uses: docker/setup-buildx-action@v4
|
||||
- uses: docker/login-action@v4
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ gitea.actor }}
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
- name: Tags
|
||||
id: meta
|
||||
uses: docker/metadata-action@v6
|
||||
with:
|
||||
images: ${{ needs.plan.outputs.image }}
|
||||
flavor: latest=false
|
||||
tags: |
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=raw,value=latest,enable=${{ startsWith(gitea.ref, 'refs/tags/v') && !contains(gitea.ref_name, '-') }}
|
||||
type=raw,value=edge,enable=${{ gitea.ref == 'refs/heads/main' }}
|
||||
type=sha,format=long
|
||||
- name: Apply tags
|
||||
run: |
|
||||
image='${{ needs.plan.outputs.image }}'
|
||||
tags=$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< '${{ steps.meta.outputs.json }}')
|
||||
inputs='${{ needs.plan.outputs.inputs }}'
|
||||
if [ '${{ needs.plan.outputs.reuse }}' = true ]; then
|
||||
docker buildx imagetools create $tags "$image:inputs-$inputs"
|
||||
else
|
||||
docker buildx imagetools create $tags -t "$image:inputs-$inputs" \
|
||||
"$image:build-${{ gitea.sha }}-amd64" "$image:build-${{ gitea.sha }}-arm64"
|
||||
fi
|
||||
- name: Check architectures
|
||||
run: |
|
||||
docker buildx imagetools inspect "${{ needs.plan.outputs.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 "${{ steps.meta.outputs.tags }}"; echo '```'; } >> "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
gitea-release:
|
||||
name: Gitea release
|
||||
needs: [plan, publish]
|
||||
if: ${{ !cancelled() && needs.publish.result == 'success' && startsWith(gitea.ref, 'refs/tags/v') }}
|
||||
runs-on: linux-arm64
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Release
|
||||
env:
|
||||
TAG: ${{ gitea.ref_name }}
|
||||
TOKEN: ${{ gitea.token }}
|
||||
API: ${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}
|
||||
IMAGE: ${{ needs.plan.outputs.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
|
||||
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
|
||||
curl -fsS -X POST "$API/releases" -H "Authorization: token $TOKEN" \
|
||||
-H 'Content-Type: application/json' -d @release.json >/dev/null
|
||||
@@ -0,0 +1,42 @@
|
||||
name: Weekly
|
||||
|
||||
# Checks that do not depend on a push: a new Go vulnerability advisory can land
|
||||
# on a dependency or on the toolchain while the code stands still.
|
||||
on:
|
||||
schedule:
|
||||
- cron: '17 6 * * 1'
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: weekly
|
||||
cancel-in-progress: false
|
||||
|
||||
env:
|
||||
GOCACHE: /opt/hostedtoolcache/go-build
|
||||
GOMODCACHE: /opt/hostedtoolcache/go-mod
|
||||
GOPATH: /opt/hostedtoolcache/gopath
|
||||
|
||||
jobs:
|
||||
audit:
|
||||
name: Dependency audit
|
||||
runs-on: linux-arm64
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
- name: govulncheck
|
||||
run: |
|
||||
command -v govulncheck >/dev/null || go install golang.org/x/vuln/cmd/govulncheck@latest
|
||||
export PATH="$PATH:$(go env GOPATH)/bin"
|
||||
govulncheck ./...
|
||||
|
||||
race:
|
||||
name: Tests (race detector, repeated)
|
||||
runs-on: linux-arm64
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
- run: go test -race -count=5 ./...
|
||||
Reference in new issue
Block a user