bakito / adguardhome-sync

🛡️ Synchronize AdGuard Home config to replicas
Apache License 2.0
912 stars 36 forks source link

tls+metrics sections parameter in yaml ignored #439

Open diaznet opened 5 hours ago

diaznet commented 5 hours ago

What happened?

I have set up adguardhome-sync and it syncs properly. I set everything via yaml file.

Then I also wanted to set up metrics and tls, and none of these parameters seem to be taken into account. The sync still works, but there is still no TLS configured on port 8080, still cleartext There is nothing at /metrics (404)

certs and files exist

Seems like tls and metrics in yaml file are ignored, as the output with PRINT_CONFIG_ONLY=true seems to indicate.

AdguardHome-Sync Version

0.6.13

AdguardHome Version

0.107.54

OS Information

docker

Configuration

Via yaml only

# cron expression to run in daemon mode. (default; "" = runs only once)
cron: "0 */2 * * *"

# runs the synchronisation on startup
runOnStart: true

# If enabled, the synchronisation task will not fail on single errors, but will log the errors and continue
continueOnError: false

origin:
  # url of the origin instance
  url: https://dns1.my.domain
  # apiPath: define an api path if other than "/control"
  # insecureSkipVerify: true # disable tls check
  username: admin
  password: xxx

# replicas instances
replicas:
  # url of the replica instance
  - url: https://dns2.my.domain
    username: admin
    password: xxx

# Configure the sync API server, disabled if api port is 0
api:
  # Port, default 8080
  port: 8080
  # if username and password are defined, basic auth is applied to the sync API
  username: admin
  password: xxx
  # enable api dark mode
  darkMode: true

 # enable metrics on path '/metrics' (api port must be != 0)
metrics:
  enabled: true
  scrapeInterval: 30s
  queryLogLimit: 10000

# enable tls for the api server
tls:
  # the directory of the provided tls certs
  certDir: /certs
  # the name of the cert file (default: tls.crt)
  certName: fullchain.pem
  # the name of the key file (default: tls.key)
  keyName: privkey.pem

# Configure sync features; by default all features are enabled.
features:
  generalSettings: true
  queryLogConfig: true
  statsConfig: true
  clientSettings: true
  services: true
  filters: true
  dhcp:
    serverConfig: true
    staticLeases: true
  dns:
    serverConfig: true
    accessLists: true
    rewrites: true

docker compose file
services:
  dns-sync:
    image: ghcr.io/bakito/adguardhome-sync
    container_name: dns-sync
    command: run --config /config/adguardhome-sync.yaml
    volumes:
      - /my/docker/path/dns-sync/adguardhome-sync.yaml:/config/adguardhome-sync.yaml
      - dns-sync-certs-live:/certs/live/dns-sync.my.domain
      - dns-sync-certs-archive:/certs/archive/dns-sync.my.domain
    environment:
      TZ: Europe/Zurich
    ports:
      - 8080:8080
    restart: unless-stopped
volumes:
  dns-sync-certs-live:
    name: dns-sync-certs-live
    driver: local
    driver_opts:
      o: bind
      type: none
      device: /my/cert/path/certbot/etc-letsencrypt/live/dns-sync.my.domain
  dns-sync-certs-archive:
    name: dns-sync-certs-archive
    driver: local
    driver_opts:
      o: bind
      type: none
      device: /my/cert/path/certbot/etc-letsencrypt/archive/dns-sync.my.domain

Current Applied Configuration

2024-11-15T22:13:13.170+0100    INFO    run     cmd/run.go:35   Printing adguardhome-sync config (THE APPLICATION WILL NOT START IN THIS MODE): 
origin:
    url: https://dns1.my.domain
    webURL: https://dns1.my.domain
    apiPath: /control
    username: admin
    password: xxx
    insecureSkipVerify: false
    autoSetup: false
replicas:
    - url: https://dns2.my.domain
      webURL: https://dns2.my.domain
      apiPath: /control
      username: admin
      password: xxx
      insecureSkipVerify: false
      autoSetup: false
cron: 0 */2 * * *
runOnStart: true
printConfigOnly: true
api:
    port: 8080
    username: admin
    password: xxx
    darkMode: true
features:
    dns:
        accessLists: true
        serverConfig: true
        rewrites: true
    dhcp:
        serverConfig: true
        staticLeases: true
    generalSettings: true
    queryLogConfig: true
    statsConfig: true
    clientSettings: true
    services: true
    filters: true
    theme: true

Relevant log output

2024-11-15T21:55:21.983+0100    INFO    sync    sync/sync.go:38 AdGuardHome sync    {"version": "v0.6.13", "build": "2024-09-28T07:07:12Z", "os": "linux", "arch": "amd64"}
2024-11-15T21:55:21.983+0100    INFO    sync    sync/sync.go:65 Setup cronjob   {"cron": "0 */2 * * *", "next-execution": "2024-11-15T22:00:00.000+0100"}
2024-11-15T21:55:21.983+0100    INFO    sync    sync/http.go:68 Starting API server {"port": 8080}
2024-11-15T21:55:21.983+0100    INFO    sync    sync/sync.go:75 Running sync on startup
2024-11-15T21:55:22.056+0100    INFO    sync    sync/sync.go:174    Connected to origin {"from": "dns1.my.domain", "version": "v0.107.54"}
2024-11-15T21:55:22.828+0100    INFO    sync    sync/sync.go:267    Start sync  {"from": "dns1.my.domain", "to": "dns2.my.domain"}
2024-11-15T21:55:22.900+0100    INFO    sync    sync/sync.go:275    Connected to replica    {"from": "dns1.my.domain", "to": "dns2.my.domain", "version": "v0.107.54"}
2024-11-15T21:55:23.686+0100    INFO    sync    sync/sync.go:303    Sync done   {"from": "dns1.my.domain", "to": "dns2.my.domain"}
2024-11-15T21:58:06.602+0100    INFO    sync    sync/http.go:31 Starting sync from API  {"remote-addr": "xx.xx.xx.xx:33948"}
2024-11-15T21:58:06.660+0100    INFO    sync    sync/sync.go:174    Connected to origin {"from": "dns1.my.domain", "version": "v0.107.54"}
2024-11-15T21:58:07.489+0100    INFO    sync    sync/sync.go:267    Start sync  {"from": "dns1.my.domain", "to": "dns2.my.domain"}
2024-11-15T21:58:07.564+0100    INFO    sync    sync/sync.go:275    Connected to replica    {"from": "dns1.my.domain", "to": "dns2.my.domain", "version": "v0.107.54"}
2024-11-15T21:58:08.347+0100    INFO    sync    sync/sync.go:303    Sync done   {"from": "dns1.my.domain", "to": "dns2.my.domain"}

Anything else?

No response

bakito commented 4 hours ago

Please check the indents. tls and metrics need to be under api.