feat: anubis metrics #127

Open
fauno wants to merge 4 commits from anubis-metrics into master
6 changed files with 36 additions and 0 deletions
+3
View File
@@ -223,5 +223,8 @@ WRITE_TIMEOUT=0s
#ANUBIS_SERVE_ROBOTS_TXT=true
#ANUBIS_SLOG_LEVEL=INFO
## Anubis metrics
p4u1 marked this conversation as resolved Outdated
Outdated
Review

I think we now have two basic with secrets in traefik now. Is there a reason you did not reuse the existing one?

I think we now have two basic with secrets in traefik now. Is there a reason you did not reuse the existing one?
Outdated
Review

if you're refering to basic auth, that secret contains the whole usersfile:

https://git.coopcloud.tech/coop-cloud/traefik/src/branch/master/compose.basicauth.yml

if you're refering to basic auth, that secret contains the whole usersfile: https://git.coopcloud.tech/coop-cloud/traefik/src/branch/master/compose.basicauth.yml
Outdated
Review

OK so they are specified in a differnt way. But I would still prefer if we habe only one way to set the basicnauth for metrics. Maybe we should deprecate the old usersfile? Or if we keep both secrets the new secret should be named more specific

OK so they are specified in a differnt way. But I would still prefer if we habe only one way to set the basicnauth for metrics. Maybe we should deprecate the old usersfile? Or if we keep both secrets the new secret should be named more specific
Outdated
Review

not sure, you can have more than one user on the usersfile. should i rename it to metrics_basic_auth?

not sure, you can have more than one user on the usersfile. should i rename it to metrics_basic_auth?
Outdated
Review

what was the resolution @decentral1se ?

what was the resolution @decentral1se ?
Outdated
Review

not sure, you can have more than one user on the usersfile. should i rename it to metrics_basic_auth?

I think you can. Is there a way to also use a users file with you method of basic auth?
metrics_basic_auth sounds good and then we can make a breaking change to also use that for the traefik metrics

> not sure, you can have more than one user on the usersfile. should i rename it to metrics_basic_auth? I think you can. Is there a way to also use a users file with you method of basic auth? metrics_basic_auth sounds good and then we can make a breaking change to also use that for the traefik metrics
Outdated
Review

Btw. the traefik Middleware supports both users and usersFile https://doc.traefik.io/traefik/reference/routing-configuration/http/middlewares/basicauth/

Btw. the traefik Middleware supports both users and usersFile https://doc.traefik.io/traefik/reference/routing-configuration/http/middlewares/basicauth/
Outdated
Review

they're different things, one is the basic auth database that traefik protects routes with, and this new secret is for protecting anubis itself.

https://anubis.techaro.lol/docs/admin/policies#http-basic-authentication

since the metrics endpoint is only available locally, not exposed by traefik (thus not protected by basicauth middleware) and authentication is optional, i could remove it altogether to simplify things.

they're different things, one is the basic auth database that traefik protects routes with, and this new secret is for protecting anubis itself. https://anubis.techaro.lol/docs/admin/policies#http-basic-authentication since the metrics endpoint is only available locally, not exposed by traefik (thus not protected by basicauth middleware) and authentication is optional, i could remove it altogether to simplify things.
Outdated
Review

OK, my confusion is slowly clearing up 😀

I think I have a slight preference to remove the basic auth for now. We can always add it later and prevent confusion for now

OK, my confusion is slowly clearing up 😀 I think I have a slight preference to remove the basic auth for now. We can always add it later and prevent confusion for now
Outdated
Review

@p4u1 done, but i can't re-request review, the page reloads and the status doesn't change

@p4u1 done, but i can't re-request review, the page reloads and the status doesn't change
#COMPOSE_FILE="$COMPOSE_FILE:compose.anubis-metrics.yml"
## Enable onion service support
#ONION_ENABLED=1
+5
View File
@@ -72,6 +72,11 @@ After deploying these changes, go to each recipe that supports Anubis
and follow the process there. **Enabling Anubis here is not enough for
protection your apps.**
If you want to collect Prometheus metrics for Anubis, for instance with
[monitoring-ng](/monitoring-ng), uncomment the "Anubis metrics" section
and insert the basic auth password as a secret. The username will be
Review

The reference to basic with should be removed here

The reference to basic with should be removed here
"admin".
## Enabling onion service
Uncomment the line in the config setting `ONION_ENABLED=1`. This will create a new entrypoint on port 9052 which can be used to bypass forced SSL. For more details, see the [onion recipe](https://recipes.coopcloud.tech/onion).
+1
View File
@@ -1,3 +1,4 @@
export TRAEFIK_YML_VERSION=v32
export FILE_PROVIDER_YML_VERSION=v12
export ENTRYPOINT_VERSION=v5
export ANUBIS_YML_VERSION=v1
+7
View File
@@ -0,0 +1,7 @@
bots:
- import: (data)/meta/default-config.yaml
{{ if eq (env "ANUBIS_METRICS_ENABLED") "true" }}
metrics:
bind: ":9090"
network: "tcp"
{{ end }}
+11
View File
@@ -0,0 +1,11 @@
---
version: "3.8"
services:
anubis:
environment:
ANUBIS_METRICS_ENABLED: "true"
deploy:
labels:
- "prometheus.io/scrape=true"
decentral1se marked this conversation as resolved
Review

I think this might overwrite the other anubis lables?

deploy:
labels:
- "traefik.enable=true"
- "traefik.http.routers.anubis.rule=Host(`${ANUBIS_DOMAIN}`)"
- "traefik.http.routers.anubis.tls.certresolver=${LETS_ENCRYPT_ENV}"
- "traefik.http.routers.anubis.entrypoints=web-secure"
- "traefik.http.services.anubis.loadbalancer.server.port=8080"
- "traefik.http.routers.anubis.service=anubis"

I think this might overwrite the other `anubis` lables? https://git.coopcloud.tech/coop-cloud/traefik/src/commit/0ff4ef759bea353a2803edb0c4963d1de5f43811/compose.anubis.yml#L24-L31
Review

aren't they concatenated? that's my experience so far with labels!

aren't they concatenated? that's my experience so far with labels!
- "prometheus.io/port=9090"
- "prometheus.io/path=/metrics"
+9
View File
@@ -19,6 +19,10 @@ services:
OG_CACHE_CONSIDER_HOST: "${ANUBIS_OG_CACHE_CONSIDER_HOST}"
SERVE_ROBOTS_TXT: "${ANUBIS_SERVE_ROBOTS_TXT}"
SLOG_LEVEL: "${ANUBIS_SLOG_LEVEL:-INFO}"
POLICY_FNAME: "/data/cfg/botPolicy.yaml"
configs:
- source: anubis_yml
target: /data/cfg/botPolicy.yaml
networks:
- proxy
deploy:
@@ -29,3 +33,8 @@ services:
- "traefik.http.routers.anubis.entrypoints=web-secure"
- "traefik.http.services.anubis.loadbalancer.server.port=8080"
- "traefik.http.routers.anubis.service=anubis"
configs:
anubis_yml:
name: ${STACK_NAME}_anubis_yml_${ANUBIS_YML_VERSION}
file: anubis.yml.tmpl
template_driver: golang