mirror of
https://github.com/TecharoHQ/anubis.git
synced 2026-04-13 03:58:45 +00:00
Compare commits
2 Commits
Xe/valkey-
...
Xe/docker-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
50e48df993 | ||
|
|
5e38c7d730 |
25
.dockerignore
Normal file
25
.dockerignore
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
.env
|
||||||
|
*.deb
|
||||||
|
*.rpm
|
||||||
|
|
||||||
|
# Additional package locks
|
||||||
|
pnpm-lock.yaml
|
||||||
|
yarn.lock
|
||||||
|
|
||||||
|
# Go binaries and test artifacts
|
||||||
|
main
|
||||||
|
*.test
|
||||||
|
|
||||||
|
node_modules
|
||||||
|
|
||||||
|
# MacOS
|
||||||
|
.DS_store
|
||||||
|
|
||||||
|
# Intellij
|
||||||
|
.idea
|
||||||
|
|
||||||
|
# how does this get here
|
||||||
|
doc/VERSION
|
||||||
|
|
||||||
|
web/static/js/*
|
||||||
|
!web/static/js/.gitignore
|
||||||
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -1 +1 @@
|
|||||||
**/*_templ.go linguist-generated=true
|
web/index_templ.go linguist-generated
|
||||||
|
|||||||
6
.github/actions/spelling/expect.txt
vendored
6
.github/actions/spelling/expect.txt
vendored
@@ -6,7 +6,6 @@ amazonbot
|
|||||||
anthro
|
anthro
|
||||||
anubis
|
anubis
|
||||||
anubistest
|
anubistest
|
||||||
apk
|
|
||||||
Applebot
|
Applebot
|
||||||
archlinux
|
archlinux
|
||||||
badregexes
|
badregexes
|
||||||
@@ -69,7 +68,6 @@ duckduckbot
|
|||||||
eerror
|
eerror
|
||||||
ellenjoe
|
ellenjoe
|
||||||
enbyware
|
enbyware
|
||||||
euo
|
|
||||||
everyones
|
everyones
|
||||||
evilbot
|
evilbot
|
||||||
evilsite
|
evilsite
|
||||||
@@ -119,7 +117,6 @@ imgproxy
|
|||||||
inp
|
inp
|
||||||
iss
|
iss
|
||||||
isset
|
isset
|
||||||
itv
|
|
||||||
ivh
|
ivh
|
||||||
Jenomis
|
Jenomis
|
||||||
JGit
|
JGit
|
||||||
@@ -199,7 +196,6 @@ qwant
|
|||||||
qwantbot
|
qwantbot
|
||||||
rac
|
rac
|
||||||
rcvar
|
rcvar
|
||||||
rdb
|
|
||||||
redir
|
redir
|
||||||
redirectscheme
|
redirectscheme
|
||||||
relayd
|
relayd
|
||||||
@@ -250,10 +246,8 @@ traefik
|
|||||||
uberspace
|
uberspace
|
||||||
unixhttpd
|
unixhttpd
|
||||||
unmarshal
|
unmarshal
|
||||||
uuidgen
|
|
||||||
uvx
|
uvx
|
||||||
UXP
|
UXP
|
||||||
valkey
|
|
||||||
Varis
|
Varis
|
||||||
Velen
|
Velen
|
||||||
vendored
|
vendored
|
||||||
|
|||||||
7
.github/workflows/docker.yml
vendored
7
.github/workflows/docker.yml
vendored
@@ -3,8 +3,8 @@ name: Docker image builds
|
|||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches: ["main"]
|
branches: [ "main" ]
|
||||||
tags: ["v*"]
|
tags: [ "v*" ]
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DOCKER_METADATA_SET_OUTPUT_ENV: "true"
|
DOCKER_METADATA_SET_OUTPUT_ENV: "true"
|
||||||
@@ -55,7 +55,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
brew bundle
|
brew bundle
|
||||||
|
|
||||||
- name: Log into registry
|
- name: Log into registry
|
||||||
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
|
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
@@ -77,6 +77,7 @@ jobs:
|
|||||||
DOCKER_REPO: ${{ env.IMAGE }}
|
DOCKER_REPO: ${{ env.IMAGE }}
|
||||||
SLOG_LEVEL: debug
|
SLOG_LEVEL: debug
|
||||||
|
|
||||||
|
|
||||||
- name: Generate artifact attestation
|
- name: Generate artifact attestation
|
||||||
uses: actions/attest-build-provenance@db473fddc028af60658334401dc6fa3ffd8669fd # v2.3.0
|
uses: actions/attest-build-provenance@db473fddc028af60658334401dc6fa3ffd8669fd # v2.3.0
|
||||||
with:
|
with:
|
||||||
|
|||||||
36
.github/workflows/ssh-ci-runner-cron.yml
vendored
36
.github/workflows/ssh-ci-runner-cron.yml
vendored
@@ -1,36 +0,0 @@
|
|||||||
name: Regenerate ssh ci runner image
|
|
||||||
|
|
||||||
on:
|
|
||||||
# pull_request:
|
|
||||||
# branches: ["main"]
|
|
||||||
schedule:
|
|
||||||
- cron: "0 0 1,8,15,22 * *"
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
pull-requests: write
|
|
||||||
contents: write
|
|
||||||
packages: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
ssh-ci-rebuild:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
||||||
with:
|
|
||||||
fetch-tags: true
|
|
||||||
fetch-depth: 0
|
|
||||||
persist-credentials: false
|
|
||||||
- name: Log into registry
|
|
||||||
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.repository_owner }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
|
|
||||||
- name: Build and push
|
|
||||||
run: |
|
|
||||||
cd ./test/ssh-ci
|
|
||||||
docker buildx bake --push
|
|
||||||
36
.github/workflows/ssh-ci.yml
vendored
36
.github/workflows/ssh-ci.yml
vendored
@@ -1,36 +0,0 @@
|
|||||||
name: SSH CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: ["main"]
|
|
||||||
# pull_request:
|
|
||||||
# branches: ["main"]
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
ssh:
|
|
||||||
runs-on: ubuntu-24.04
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
host:
|
|
||||||
- ubuntu@riscv64.techaro.lol
|
|
||||||
- ci@ppc64le.techaro.lol
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
||||||
with:
|
|
||||||
fetch-tags: true
|
|
||||||
fetch-depth: 0
|
|
||||||
persist-credentials: false
|
|
||||||
- name: Install CI target SSH key
|
|
||||||
uses: shimataro/ssh-key-action@d4fffb50872869abe2d9a9098a6d9c5aa7d16be4 # v2.7.0
|
|
||||||
with:
|
|
||||||
key: ${{ secrets.CI_SSH_KEY }}
|
|
||||||
name: id_rsa
|
|
||||||
known_hosts: ${{ secrets.CI_SSH_KNOWN_HOSTS }}
|
|
||||||
- name: Run CI
|
|
||||||
run: bash test/ssh-ci/rigging.sh ${{ matrix.host }}
|
|
||||||
env:
|
|
||||||
GITHUB_RUN_ID: ${{ github.run_id }}
|
|
||||||
30
Dockerfile
Normal file
30
Dockerfile
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
ARG ALPINE_VERSION=edge
|
||||||
|
FROM --platform=${BUILDPLATFORM} alpine:${ALPINE_VERSION} AS build
|
||||||
|
|
||||||
|
ARG TARGETOS
|
||||||
|
ARG TARGETARCH
|
||||||
|
ARG COMPONENT=anubis
|
||||||
|
ARG VERSION=devel-docker
|
||||||
|
|
||||||
|
RUN apk -U add go nodejs git build-base git npm bash zstd brotli gzip
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY go.mod go.sum ./
|
||||||
|
RUN go mod download
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
RUN --mount=type=cache,target=/root/.cache npm ci && npm run assets
|
||||||
|
RUN --mount=type=cache,target=/root/.cache GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=0 GOARM=7 go build -gcflags "all=-N -l" -o /app/bin/${COMPONENT} -ldflags "-s -w -extldflags -static -X github.com/TecharoHQ/anubis.Version=${VERSION}" ./cmd/${COMPONENT}
|
||||||
|
|
||||||
|
FROM alpine:${ALPINE_VERSION} AS run
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
RUN apk -U add ca-certificates mailcap
|
||||||
|
|
||||||
|
COPY --from=build /app/bin/anubis /app/bin/anubis
|
||||||
|
|
||||||
|
CMD ["/app/bin/anubis"]
|
||||||
|
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD [ "/app/bin/anubis", "--healthcheck" ]
|
||||||
|
|
||||||
|
LABEL org.opencontainers.image.source="https://github.com/TecharoHQ/anubis"
|
||||||
@@ -67,7 +67,6 @@ var (
|
|||||||
ogCacheConsiderHost = flag.Bool("og-cache-consider-host", false, "enable or disable the use of the host in the Open Graph tag cache")
|
ogCacheConsiderHost = flag.Bool("og-cache-consider-host", false, "enable or disable the use of the host in the Open Graph tag cache")
|
||||||
extractResources = flag.String("extract-resources", "", "if set, extract the static resources to the specified folder")
|
extractResources = flag.String("extract-resources", "", "if set, extract the static resources to the specified folder")
|
||||||
webmasterEmail = flag.String("webmaster-email", "", "if set, displays webmaster's email on the reject page for appeals")
|
webmasterEmail = flag.String("webmaster-email", "", "if set, displays webmaster's email on the reject page for appeals")
|
||||||
valkeyURL = flag.String("valkey-url", "", "Valkey URL for Anubis' state layer")
|
|
||||||
versionFlag = flag.Bool("version", false, "print Anubis version")
|
versionFlag = flag.Bool("version", false, "print Anubis version")
|
||||||
xffStripPrivate = flag.Bool("xff-strip-private", true, "if set, strip private addresses from X-Forwarded-For")
|
xffStripPrivate = flag.Bool("xff-strip-private", true, "if set, strip private addresses from X-Forwarded-For")
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
variable "ALPINE_VERSION" { default = "3.22" }
|
variable "ALPINE_VERSION" { default = "3.22" }
|
||||||
|
variable "GITHUB_SHA" { default = "devel" }
|
||||||
|
|
||||||
group "default" {
|
group "default" {
|
||||||
targets = [
|
targets = [
|
||||||
"ci-runner",
|
"anubis",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "ci-runner" {
|
target "anubis" {
|
||||||
args = {
|
args = {
|
||||||
ALPINE_VERSION = "3.22"
|
ALPINE_VERSION = "3.22"
|
||||||
}
|
}
|
||||||
@@ -21,6 +22,6 @@ target "ci-runner" {
|
|||||||
]
|
]
|
||||||
pull = true
|
pull = true
|
||||||
tags = [
|
tags = [
|
||||||
"ghcr.io/techarohq/anubis/ci-runner:latest"
|
"ghcr.io/techarohq/anubis:${GITHUB_SHA}"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -41,7 +41,6 @@ This page contains a non-exhaustive list with all websites using Anubis.
|
|||||||
- https://minihoot.site
|
- https://minihoot.site
|
||||||
- https://catgirl.click/
|
- https://catgirl.click/
|
||||||
- https://wiki.dolphin-emu.org/
|
- https://wiki.dolphin-emu.org/
|
||||||
- https://squirreljme.cc/
|
|
||||||
- <details>
|
- <details>
|
||||||
<summary>FreeCAD</summary>
|
<summary>FreeCAD</summary>
|
||||||
- https://forum.freecad.org/
|
- https://forum.freecad.org/
|
||||||
|
|||||||
4
go.mod
4
go.mod
@@ -9,7 +9,6 @@ require (
|
|||||||
github.com/google/cel-go v0.25.0
|
github.com/google/cel-go v0.25.0
|
||||||
github.com/playwright-community/playwright-go v0.5200.0
|
github.com/playwright-community/playwright-go v0.5200.0
|
||||||
github.com/prometheus/client_golang v1.22.0
|
github.com/prometheus/client_golang v1.22.0
|
||||||
github.com/redis/go-redis/v9 v9.9.0
|
|
||||||
github.com/sebest/xff v0.0.0-20210106013422-671bd2870b3a
|
github.com/sebest/xff v0.0.0-20210106013422-671bd2870b3a
|
||||||
github.com/yl2chen/cidranger v1.0.2
|
github.com/yl2chen/cidranger v1.0.2
|
||||||
golang.org/x/net v0.41.0
|
golang.org/x/net v0.41.0
|
||||||
@@ -39,10 +38,9 @@ require (
|
|||||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||||
github.com/cli/browser v1.3.0 // indirect
|
github.com/cli/browser v1.3.0 // indirect
|
||||||
github.com/cli/go-gh v0.1.0 // indirect
|
github.com/cli/go-gh v0.1.0 // indirect
|
||||||
github.com/cloudflare/circl v1.6.1 // indirect
|
github.com/cloudflare/circl v1.6.0 // indirect
|
||||||
github.com/cyphar/filepath-securejoin v0.4.1 // indirect
|
github.com/cyphar/filepath-securejoin v0.4.1 // indirect
|
||||||
github.com/deckarep/golang-set/v2 v2.8.0 // indirect
|
github.com/deckarep/golang-set/v2 v2.8.0 // indirect
|
||||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
|
||||||
github.com/dlclark/regexp2 v1.11.4 // indirect
|
github.com/dlclark/regexp2 v1.11.4 // indirect
|
||||||
github.com/dop251/goja v0.0.0-20250309171923-bcd7cc6bf64c // indirect
|
github.com/dop251/goja v0.0.0-20250309171923-bcd7cc6bf64c // indirect
|
||||||
github.com/emirpasic/gods v1.18.1 // indirect
|
github.com/emirpasic/gods v1.18.1 // indirect
|
||||||
|
|||||||
12
go.sum
12
go.sum
@@ -46,10 +46,6 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
|||||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||||
github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb h1:m935MPodAbYS46DG4pJSv7WO+VECIWUQ7OJYSoTrMh4=
|
github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb h1:m935MPodAbYS46DG4pJSv7WO+VECIWUQ7OJYSoTrMh4=
|
||||||
github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb/go.mod h1:PkYb9DJNAwrSvRx5DYA+gUcOIgTGVMNkfSCbZM8cWpI=
|
github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb/go.mod h1:PkYb9DJNAwrSvRx5DYA+gUcOIgTGVMNkfSCbZM8cWpI=
|
||||||
github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
|
|
||||||
github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
|
|
||||||
github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
|
|
||||||
github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
|
|
||||||
github.com/caarlos0/testfs v0.4.4 h1:3PHvzHi5Lt+g332CiShwS8ogTgS3HjrmzZxCm6JCDr8=
|
github.com/caarlos0/testfs v0.4.4 h1:3PHvzHi5Lt+g332CiShwS8ogTgS3HjrmzZxCm6JCDr8=
|
||||||
github.com/caarlos0/testfs v0.4.4/go.mod h1:bRN55zgG4XCUVVHZCeU+/Tz1Q6AxEJOEJTliBy+1DMk=
|
github.com/caarlos0/testfs v0.4.4/go.mod h1:bRN55zgG4XCUVVHZCeU+/Tz1Q6AxEJOEJTliBy+1DMk=
|
||||||
github.com/cavaliergopher/cpio v1.0.1 h1:KQFSeKmZhv0cr+kawA3a0xTQCU4QxXF1vhU7P7av2KM=
|
github.com/cavaliergopher/cpio v1.0.1 h1:KQFSeKmZhv0cr+kawA3a0xTQCU4QxXF1vhU7P7av2KM=
|
||||||
@@ -67,8 +63,8 @@ github.com/cli/go-gh v0.1.0 h1:kMqFmC3ECBrV2UKzlOHjNOTTchExVc5tjNHtCqk/zYk=
|
|||||||
github.com/cli/go-gh v0.1.0/go.mod h1:eTGWl99EMZ+3Iau5C6dHyGAJRRia65MtdBtuhWc+84o=
|
github.com/cli/go-gh v0.1.0/go.mod h1:eTGWl99EMZ+3Iau5C6dHyGAJRRia65MtdBtuhWc+84o=
|
||||||
github.com/cli/safeexec v1.0.0/go.mod h1:Z/D4tTN8Vs5gXYHDCbaM1S/anmEDnJb1iW0+EJ5zx3Q=
|
github.com/cli/safeexec v1.0.0/go.mod h1:Z/D4tTN8Vs5gXYHDCbaM1S/anmEDnJb1iW0+EJ5zx3Q=
|
||||||
github.com/cli/shurcooL-graphql v0.0.1/go.mod h1:U7gCSuMZP/Qy7kbqkk5PrqXEeDgtfG5K+W+u8weorps=
|
github.com/cli/shurcooL-graphql v0.0.1/go.mod h1:U7gCSuMZP/Qy7kbqkk5PrqXEeDgtfG5K+W+u8weorps=
|
||||||
github.com/cloudflare/circl v1.6.1 h1:zqIqSPIndyBh1bjLVVDHMPpVKqp8Su/V+6MeDzzQBQ0=
|
github.com/cloudflare/circl v1.6.0 h1:cr5JKic4HI+LkINy2lg3W2jF8sHCVTBncJr5gIIq7qk=
|
||||||
github.com/cloudflare/circl v1.6.1/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs=
|
github.com/cloudflare/circl v1.6.0/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs=
|
||||||
github.com/creack/pty v1.1.24 h1:bJrF4RRfyJnbTJqzRLHzcGaZK1NeM5kTC9jGgovnR1s=
|
github.com/creack/pty v1.1.24 h1:bJrF4RRfyJnbTJqzRLHzcGaZK1NeM5kTC9jGgovnR1s=
|
||||||
github.com/creack/pty v1.1.24/go.mod h1:08sCNb52WyoAwi2QDyzUCTgcvVFhUzewun7wtTfvcwE=
|
github.com/creack/pty v1.1.24/go.mod h1:08sCNb52WyoAwi2QDyzUCTgcvVFhUzewun7wtTfvcwE=
|
||||||
github.com/cyphar/filepath-securejoin v0.4.1 h1:JyxxyPEaktOD+GAnqIqTf9A8tHyAG22rowi7HkoSU1s=
|
github.com/cyphar/filepath-securejoin v0.4.1 h1:JyxxyPEaktOD+GAnqIqTf9A8tHyAG22rowi7HkoSU1s=
|
||||||
@@ -79,8 +75,6 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1
|
|||||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/deckarep/golang-set/v2 v2.8.0 h1:swm0rlPCmdWn9mESxKOjWk8hXSqoxOp+ZlfuyaAdFlQ=
|
github.com/deckarep/golang-set/v2 v2.8.0 h1:swm0rlPCmdWn9mESxKOjWk8hXSqoxOp+ZlfuyaAdFlQ=
|
||||||
github.com/deckarep/golang-set/v2 v2.8.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4=
|
github.com/deckarep/golang-set/v2 v2.8.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4=
|
||||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
|
|
||||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
|
|
||||||
github.com/dlclark/regexp2 v1.11.4 h1:rPYF9/LECdNymJufQKmri9gV604RvvABwgOA8un7yAo=
|
github.com/dlclark/regexp2 v1.11.4 h1:rPYF9/LECdNymJufQKmri9gV604RvvABwgOA8un7yAo=
|
||||||
github.com/dlclark/regexp2 v1.11.4/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
|
github.com/dlclark/regexp2 v1.11.4/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
|
||||||
github.com/dop251/goja v0.0.0-20250309171923-bcd7cc6bf64c h1:mxWGS0YyquJ/ikZOjSrRjjFIbUqIP9ojyYQ+QZTU3Rg=
|
github.com/dop251/goja v0.0.0-20250309171923-bcd7cc6bf64c h1:mxWGS0YyquJ/ikZOjSrRjjFIbUqIP9ojyYQ+QZTU3Rg=
|
||||||
@@ -234,8 +228,6 @@ github.com/prometheus/common v0.62.0 h1:xasJaQlnWAeyHdUBeGjXmutelfJHWMRr+Fg4QszZ
|
|||||||
github.com/prometheus/common v0.62.0/go.mod h1:vyBcEuLSvWos9B1+CyL7JZ2up+uFzXhkqml0W5zIY1I=
|
github.com/prometheus/common v0.62.0/go.mod h1:vyBcEuLSvWos9B1+CyL7JZ2up+uFzXhkqml0W5zIY1I=
|
||||||
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
|
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
|
||||||
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
|
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
|
||||||
github.com/redis/go-redis/v9 v9.9.0 h1:URbPQ4xVQSQhZ27WMQVmZSo3uT3pL+4IdHVcYq2nVfM=
|
|
||||||
github.com/redis/go-redis/v9 v9.9.0/go.mod h1:huWgSWd8mW6+m0VPhJjSSQ+d6Nh1VICQ6Q5lHuCH/Iw=
|
|
||||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||||
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
|
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
|
||||||
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
|
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
package store
|
|
||||||
|
|
||||||
import "context"
|
|
||||||
|
|
||||||
type Impl interface {
|
|
||||||
GetInt(ctx context.Context, segments []string) (int, error)
|
|
||||||
MultiGetInt(ctx context.Context, segments [][]string) ([]int, error)
|
|
||||||
|
|
||||||
Increment(ctx context.Context, segments []string) error
|
|
||||||
}
|
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
package valkey
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"errors"
|
|
||||||
"fmt"
|
|
||||||
"strconv"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/TecharoHQ/anubis/internal/store"
|
|
||||||
valkey "github.com/redis/go-redis/v9"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
_ store.Impl = &Store{}
|
|
||||||
)
|
|
||||||
|
|
||||||
type Store struct {
|
|
||||||
rdb *valkey.Client
|
|
||||||
}
|
|
||||||
|
|
||||||
func New(rdb *valkey.Client) *Store {
|
|
||||||
return &Store{rdb: rdb}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *Store) Increment(ctx context.Context, segments []string) error {
|
|
||||||
key := fmt.Sprintf("anubis:%s", strings.Join(segments, ":"))
|
|
||||||
if err := s.rdb.Incr(ctx, key).Err(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *Store) GetInt(ctx context.Context, segments []string) (int, error) {
|
|
||||||
key := fmt.Sprintf("anubis:%s", strings.Join(segments, ":"))
|
|
||||||
numStr, err := s.rdb.Get(ctx, key).Result()
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
|
|
||||||
num, err := strconv.Atoi(numStr)
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return num, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *Store) MultiGetInt(ctx context.Context, segments [][]string) ([]int, error) {
|
|
||||||
var keys []string
|
|
||||||
for _, segment := range segments {
|
|
||||||
key := fmt.Sprintf("anubis:%s", strings.Join(segment, ":"))
|
|
||||||
keys = append(keys, key)
|
|
||||||
}
|
|
||||||
|
|
||||||
values, err := s.rdb.MGet(ctx, keys...).Result()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
var errs []error
|
|
||||||
|
|
||||||
result := make([]int, len(values))
|
|
||||||
for i, val := range values {
|
|
||||||
if val == nil {
|
|
||||||
result[i] = 0
|
|
||||||
errs = append(errs, fmt.Errorf("can't get key %s: value is null", keys[i]))
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := val.(type) {
|
|
||||||
case string:
|
|
||||||
num, err := strconv.Atoi(v)
|
|
||||||
if err != nil {
|
|
||||||
errs = append(errs, fmt.Errorf("can't parse key %s: %w", keys[i], err))
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
result[i] = num
|
|
||||||
default:
|
|
||||||
errs = append(errs, fmt.Errorf("can't parse key %s: wanted type string but got type %T", keys[i], val))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(errs) != 0 {
|
|
||||||
return nil, fmt.Errorf("can't read from valkey: %w", errors.Join(errs...))
|
|
||||||
}
|
|
||||||
|
|
||||||
return result, nil
|
|
||||||
}
|
|
||||||
@@ -24,7 +24,6 @@ import (
|
|||||||
"github.com/TecharoHQ/anubis/internal"
|
"github.com/TecharoHQ/anubis/internal"
|
||||||
"github.com/TecharoHQ/anubis/internal/dnsbl"
|
"github.com/TecharoHQ/anubis/internal/dnsbl"
|
||||||
"github.com/TecharoHQ/anubis/internal/ogtags"
|
"github.com/TecharoHQ/anubis/internal/ogtags"
|
||||||
"github.com/TecharoHQ/anubis/internal/store"
|
|
||||||
"github.com/TecharoHQ/anubis/lib/challenge"
|
"github.com/TecharoHQ/anubis/lib/challenge"
|
||||||
"github.com/TecharoHQ/anubis/lib/policy"
|
"github.com/TecharoHQ/anubis/lib/policy"
|
||||||
"github.com/TecharoHQ/anubis/lib/policy/config"
|
"github.com/TecharoHQ/anubis/lib/policy/config"
|
||||||
@@ -71,7 +70,6 @@ type Server struct {
|
|||||||
priv ed25519.PrivateKey
|
priv ed25519.PrivateKey
|
||||||
pub ed25519.PublicKey
|
pub ed25519.PublicKey
|
||||||
opts Options
|
opts Options
|
||||||
store store.Impl
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) challengeFor(r *http.Request, difficulty int) string {
|
func (s *Server) challengeFor(r *http.Request, difficulty int) string {
|
||||||
@@ -290,15 +288,15 @@ func (s *Server) MakeChallenge(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
lg = lg.With("check_result", cr)
|
lg = lg.With("check_result", cr)
|
||||||
chal := s.challengeFor(r, rule.Challenge.Difficulty)
|
challenge := s.challengeFor(r, rule.Challenge.Difficulty)
|
||||||
|
|
||||||
s.SetCookie(w, anubis.TestCookieName, chal, "/")
|
s.SetCookie(w, anubis.TestCookieName, challenge, "/")
|
||||||
|
|
||||||
err = encoder.Encode(struct {
|
err = encoder.Encode(struct {
|
||||||
Rules *config.ChallengeRules `json:"rules"`
|
Rules *config.ChallengeRules `json:"rules"`
|
||||||
Challenge string `json:"challenge"`
|
Challenge string `json:"challenge"`
|
||||||
}{
|
}{
|
||||||
Challenge: chal,
|
Challenge: challenge,
|
||||||
Rules: rule.Challenge,
|
Rules: rule.Challenge,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -306,7 +304,7 @@ func (s *Server) MakeChallenge(w http.ResponseWriter, r *http.Request) {
|
|||||||
w.WriteHeader(http.StatusInternalServerError)
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
lg.Debug("made challenge", "challenge", chal, "rules", rule.Challenge, "cr", cr)
|
lg.Debug("made challenge", "challenge", challenge, "rules", rule.Challenge, "cr", cr)
|
||||||
challengesIssued.WithLabelValues("api").Inc()
|
challengesIssued.WithLabelValues("api").Inc()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,7 +317,7 @@ func (s *Server) PassChallenge(w http.ResponseWriter, r *http.Request) {
|
|||||||
cookiePath = strings.TrimSuffix(anubis.BasePrefix, "/") + "/"
|
cookiePath = strings.TrimSuffix(anubis.BasePrefix, "/") + "/"
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := r.Cookie(anubis.TestCookieName); errors.Is(err, http.ErrNoCookie) {
|
if _, err := r.Cookie(anubis.TestCookieName); err == http.ErrNoCookie {
|
||||||
s.ClearCookie(w, s.cookieName, cookiePath)
|
s.ClearCookie(w, s.cookieName, cookiePath)
|
||||||
s.ClearCookie(w, anubis.TestCookieName, "/")
|
s.ClearCookie(w, anubis.TestCookieName, "/")
|
||||||
lg.Warn("user has cookies disabled, this is not an anubis bug")
|
lg.Warn("user has cookies disabled, this is not an anubis bug")
|
||||||
@@ -367,7 +365,7 @@ func (s *Server) PassChallenge(w http.ResponseWriter, r *http.Request) {
|
|||||||
challengeStr := s.challengeFor(r, rule.Challenge.Difficulty)
|
challengeStr := s.challengeFor(r, rule.Challenge.Difficulty)
|
||||||
|
|
||||||
if err := impl.Validate(r, lg, rule, challengeStr); err != nil {
|
if err := impl.Validate(r, lg, rule, challengeStr); err != nil {
|
||||||
failedValidations.WithLabelValues(rule.Challenge.Algorithm).Inc()
|
failedValidations.WithLabelValues(string(rule.Challenge.Algorithm)).Inc()
|
||||||
var cerr *challenge.Error
|
var cerr *challenge.Error
|
||||||
s.ClearCookie(w, s.cookieName, cookiePath)
|
s.ClearCookie(w, s.cookieName, cookiePath)
|
||||||
lg.Debug("challenge validate call failed", "err", err)
|
lg.Debug("challenge validate call failed", "err", err)
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package lib
|
package lib
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"crypto/ed25519"
|
"crypto/ed25519"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"errors"
|
"errors"
|
||||||
@@ -19,12 +18,10 @@ import (
|
|||||||
"github.com/TecharoHQ/anubis/internal"
|
"github.com/TecharoHQ/anubis/internal"
|
||||||
"github.com/TecharoHQ/anubis/internal/dnsbl"
|
"github.com/TecharoHQ/anubis/internal/dnsbl"
|
||||||
"github.com/TecharoHQ/anubis/internal/ogtags"
|
"github.com/TecharoHQ/anubis/internal/ogtags"
|
||||||
"github.com/TecharoHQ/anubis/internal/store/valkey"
|
|
||||||
"github.com/TecharoHQ/anubis/lib/challenge"
|
"github.com/TecharoHQ/anubis/lib/challenge"
|
||||||
"github.com/TecharoHQ/anubis/lib/policy"
|
"github.com/TecharoHQ/anubis/lib/policy"
|
||||||
"github.com/TecharoHQ/anubis/web"
|
"github.com/TecharoHQ/anubis/web"
|
||||||
"github.com/TecharoHQ/anubis/xess"
|
"github.com/TecharoHQ/anubis/xess"
|
||||||
"github.com/redis/go-redis/v9"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Options struct {
|
type Options struct {
|
||||||
@@ -43,7 +40,6 @@ type Options struct {
|
|||||||
OGPassthrough bool
|
OGPassthrough bool
|
||||||
CookiePartitioned bool
|
CookiePartitioned bool
|
||||||
ServeRobotsTXT bool
|
ServeRobotsTXT bool
|
||||||
ValkeyURL string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func LoadPoliciesOrDefault(fname string, defaultDifficulty int) (*policy.ParsedConfig, error) {
|
func LoadPoliciesOrDefault(fname string, defaultDifficulty int) (*policy.ParsedConfig, error) {
|
||||||
@@ -71,9 +67,6 @@ func LoadPoliciesOrDefault(fname string, defaultDifficulty int) (*policy.ParsedC
|
|||||||
}(fin)
|
}(fin)
|
||||||
|
|
||||||
anubisPolicy, err := policy.ParseConfig(fin, fname, defaultDifficulty)
|
anubisPolicy, err := policy.ParseConfig(fin, fname, defaultDifficulty)
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("can't parse policy file %s: %w", fname, err)
|
|
||||||
}
|
|
||||||
var validationErrs []error
|
var validationErrs []error
|
||||||
|
|
||||||
for _, b := range anubisPolicy.Bots {
|
for _, b := range anubisPolicy.Bots {
|
||||||
@@ -118,23 +111,6 @@ func New(opts Options) (*Server, error) {
|
|||||||
cookieName: cookieName,
|
cookieName: cookieName,
|
||||||
}
|
}
|
||||||
|
|
||||||
if opts.ValkeyURL != "" {
|
|
||||||
vkOpts, err := redis.ParseURL(opts.ValkeyURL)
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("can't parse valkey URL: %q: %w", opts.ValkeyURL, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
cli := redis.NewClient(vkOpts)
|
|
||||||
if _, err := cli.Ping(ctx).Result(); err != nil {
|
|
||||||
return nil, fmt.Errorf("can't ping valkey: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
result.store = valkey.New(cli)
|
|
||||||
}
|
|
||||||
|
|
||||||
mux := http.NewServeMux()
|
mux := http.NewServeMux()
|
||||||
xess.Mount(mux)
|
xess.Mount(mux)
|
||||||
|
|
||||||
@@ -178,7 +154,7 @@ func New(opts Options) (*Server, error) {
|
|||||||
// make-challenge is only used in tests. Only enable while version is devel
|
// make-challenge is only used in tests. Only enable while version is devel
|
||||||
registerWithPrefix(anubis.APIPrefix+"make-challenge", http.HandlerFunc(result.MakeChallenge), "POST")
|
registerWithPrefix(anubis.APIPrefix+"make-challenge", http.HandlerFunc(result.MakeChallenge), "POST")
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, implKind := range challenge.Methods() {
|
for _, implKind := range challenge.Methods() {
|
||||||
impl, _ := challenge.Get(implKind)
|
impl, _ := challenge.Get(implKind)
|
||||||
impl.Setup(mux)
|
impl.Setup(mux)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ require (
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
cel.dev/expr v0.24.0 // indirect
|
cel.dev/expr v0.24.0 // indirect
|
||||||
github.com/a-h/templ v0.3.898 // indirect
|
github.com/a-h/templ v0.3.865 // indirect
|
||||||
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
|
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
|
||||||
github.com/beorn7/perks v1.0.1 // indirect
|
github.com/beorn7/perks v1.0.1 // indirect
|
||||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||||
@@ -32,9 +32,9 @@ require (
|
|||||||
github.com/stoewer/go-strcase v1.3.0 // indirect
|
github.com/stoewer/go-strcase v1.3.0 // indirect
|
||||||
github.com/yl2chen/cidranger v1.0.2 // indirect
|
github.com/yl2chen/cidranger v1.0.2 // indirect
|
||||||
golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 // indirect
|
golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 // indirect
|
||||||
golang.org/x/net v0.41.0 // indirect
|
golang.org/x/net v0.40.0 // indirect
|
||||||
golang.org/x/sys v0.33.0 // indirect
|
golang.org/x/sys v0.33.0 // indirect
|
||||||
golang.org/x/text v0.26.0 // indirect
|
golang.org/x/text v0.25.0 // indirect
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20250519155744-55703ea1f237 // indirect
|
google.golang.org/genproto/googleapis/api v0.0.0-20250519155744-55703ea1f237 // indirect
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250519155744-55703ea1f237 // indirect
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250519155744-55703ea1f237 // indirect
|
||||||
google.golang.org/protobuf v1.36.6 // indirect
|
google.golang.org/protobuf v1.36.6 // indirect
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ cel.dev/expr v0.24.0 h1:56OvJKSH3hDGL0ml5uSxZmz3/3Pq4tJ+fb1unVLAFcY=
|
|||||||
cel.dev/expr v0.24.0/go.mod h1:hLPLo1W4QUmuYdA72RBX06QTs6MXw941piREPl3Yfiw=
|
cel.dev/expr v0.24.0/go.mod h1:hLPLo1W4QUmuYdA72RBX06QTs6MXw941piREPl3Yfiw=
|
||||||
github.com/a-h/templ v0.3.865 h1:nYn5EWm9EiXaDgWcMQaKiKvrydqgxDUtT1+4zU2C43A=
|
github.com/a-h/templ v0.3.865 h1:nYn5EWm9EiXaDgWcMQaKiKvrydqgxDUtT1+4zU2C43A=
|
||||||
github.com/a-h/templ v0.3.865/go.mod h1:oLBbZVQ6//Q6zpvSMPTuBK0F3qOtBdFBcGRspcT+VNQ=
|
github.com/a-h/templ v0.3.865/go.mod h1:oLBbZVQ6//Q6zpvSMPTuBK0F3qOtBdFBcGRspcT+VNQ=
|
||||||
github.com/a-h/templ v0.3.898/go.mod h1:oLBbZVQ6//Q6zpvSMPTuBK0F3qOtBdFBcGRspcT+VNQ=
|
|
||||||
github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ=
|
github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ=
|
||||||
github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw=
|
github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw=
|
||||||
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
||||||
@@ -74,12 +73,10 @@ golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 h1:y5zboxd6LQAqYIhHnB48p0ByQ
|
|||||||
golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6/go.mod h1:U6Lno4MTRCDY+Ba7aCcauB9T60gsv5s4ralQzP72ZoQ=
|
golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6/go.mod h1:U6Lno4MTRCDY+Ba7aCcauB9T60gsv5s4ralQzP72ZoQ=
|
||||||
golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY=
|
golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY=
|
||||||
golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds=
|
golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds=
|
||||||
golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA=
|
|
||||||
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
|
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
|
||||||
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||||
golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4=
|
golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4=
|
||||||
golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA=
|
golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA=
|
||||||
golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA=
|
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20250519155744-55703ea1f237 h1:Kog3KlB4xevJlAcbbbzPfRG0+X9fdoGM+UBRKVz6Wr0=
|
google.golang.org/genproto/googleapis/api v0.0.0-20250519155744-55703ea1f237 h1:Kog3KlB4xevJlAcbbbzPfRG0+X9fdoGM+UBRKVz6Wr0=
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20250519155744-55703ea1f237/go.mod h1:ezi0AVyMKDWy5xAncvjLWH7UcLBB5n7y2fQ8MzjJcto=
|
google.golang.org/genproto/googleapis/api v0.0.0-20250519155744-55703ea1f237/go.mod h1:ezi0AVyMKDWy5xAncvjLWH7UcLBB5n7y2fQ8MzjJcto=
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250519155744-55703ea1f237 h1:cJfm9zPbe1e873mHJzmQ1nwVEeRDU/T1wXDK2kUSU34=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250519155744-55703ea1f237 h1:cJfm9zPbe1e873mHJzmQ1nwVEeRDU/T1wXDK2kUSU34=
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
ARG ALPINE_VERSION=3.22
|
|
||||||
|
|
||||||
FROM alpine:${ALPINE_VERSION}
|
|
||||||
RUN apk add -U go nodejs git build-base git npm bash zstd brotli gzip
|
|
||||||
LABEL org.opencontainers.image.source="https://github.com/TecharoHQ/anubis"
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#!/usr/bin/env sh
|
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
set -x
|
|
||||||
|
|
||||||
npm ci
|
|
||||||
npm run build
|
|
||||||
SKIP_INTEGRATION=1 go test ./...
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
[ ! -z "${DEBUG:-}" ] && set -x
|
|
||||||
|
|
||||||
if [ "$#" -ne 1 ]; then
|
|
||||||
echo "Usage: rigging.sh <user@host>"
|
|
||||||
fi
|
|
||||||
|
|
||||||
CIRunnerImage="ghcr.io/techarohq/anubis/ci-runner:latest"
|
|
||||||
RunID=${GITHUB_RUN_ID:-$(uuidgen)}
|
|
||||||
RunFolder="anubis/runs/${RunID}"
|
|
||||||
Target="${1}"
|
|
||||||
|
|
||||||
ssh "${Target}" uname -av
|
|
||||||
ssh "${Target}" mkdir -p "${RunFolder}"
|
|
||||||
git archive HEAD | ssh "${Target}" tar xC "${RunFolder}"
|
|
||||||
|
|
||||||
ssh "${Target}" << EOF
|
|
||||||
set -euo pipefail
|
|
||||||
set -x
|
|
||||||
mkdir -p "anubis/cache/{go,go-build,node}"
|
|
||||||
podman pull ${CIRunnerImage}
|
|
||||||
podman run --rm -it \
|
|
||||||
-v "\$HOME/${RunFolder}:/app/anubis" \
|
|
||||||
-v "\$HOME/anubis/cache/go:/root/go" \
|
|
||||||
-v "\$HOME/anubis/cache/go-build:/root/.cache/go-build" \
|
|
||||||
-v "\$HOME/anubis/cache/node:/root/.npm" \
|
|
||||||
-w /app/anubis \
|
|
||||||
${CIRunnerImage} \
|
|
||||||
sh /app/anubis/test/ssh-ci/in-container.sh
|
|
||||||
ssh "${Target}" rm -rf "${RunFolder}"
|
|
||||||
EOF
|
|
||||||
Reference in New Issue
Block a user