bakito / adguardhome-sync

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

Connection refused error #366

Closed maciejbisch closed 3 months ago

maciejbisch commented 3 months ago

What happened?

I've set up AdGuard Home container in two networks:

  1. macvlan
  2. bridge (named: ag_sync)

In the ag_sync network I have both AdGuard Home and AdGuard Home Sync containers, however when AdGuard Home Sync tries to get origin status it gets error (connect: connection refused).

AdguardHome-Sync Version

0.6.11

AdguardHome Version

0.107.52

Configuration

# docker-compose:

---
services:
  adguardhome-sync:
    image: lscr.io/linuxserver/adguardhome-sync:latest
    container_name: adguardhome-sync
    environment:
      - PUID=1004
      - PGID=100
      - TZ=Europe/Warsaw
      - CONFIGFILE=/config/adguardhome-sync.yaml
    volumes:
      - CHANGE_TO_COMPOSE_DATA_PATH/adguardhome-sync/config:/config
    ports:
      - 8080:8080
    restart: unless-stopped
    networks:
      - ag_sync

networks:
  ag_sync:
    external: true

# adguardhome-sync.yaml:

cron: "*/1 * * * *"

origin:
  url: http://adguardhome
  username: [username]
  password: [password]

replica:
  url: http://10.1.1.12
  username: [username]
  password: [password]

api:
  port: 8080
  username: [username]
  password: [password]

Relevant log output

2024-07-14T21:35:31.929+0200    INFO    sync    sync/http.go:31 Starting sync from API  {"remote-addr": "172.21.0.1:32934"}
2024-07-14T21:35:31.930+0200    ERROR   sync    sync/sync.go:165    Error getting origin status {"from": "adguardhome", "error": ": Get \"http://adguardhome/control/status\": dial tcp 172.21.0.2:80: connect: connection refused"}
github.com/bakito/adguardhome-sync/pkg/sync.(*worker).sync
    /home/bakito/go/src/github.com/bakito/adguardhome-sync/pkg/sync/sync.go:165
github.com/bakito/adguardhome-sync/pkg/sync.(*worker).handleSync
    /home/bakito/go/src/github.com/bakito/adguardhome-sync/pkg/sync/http.go:32
github.com/gin-gonic/gin.(*Context).Next
    /home/bakito/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
github.com/gin-gonic/gin.CustomRecoveryWithWriter.func1
    /home/bakito/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/recovery.go:102
github.com/gin-gonic/gin.(*Context).Next
    /home/bakito/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185
github.com/gin-gonic/gin.(*Engine).handleHTTPRequest
    /home/bakito/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/gin.go:633
github.com/gin-gonic/gin.(*Engine).ServeHTTP
    /home/bakito/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/gin.go:589
net/http.serverHandler.ServeHTTP
    /home/bakito/.gimme/versions/go1.22.3.linux.amd64/src/net/http/server.go:3137
net/http.(*conn).serve
    /home/bakito/.gimme/versions/go1.22.3.linux.amd64/src/net/http/server.go:2039

Anything else?

No response

bakito commented 3 months ago

On which port is the adguard home container (origin) listening?

maciejbisch commented 3 months ago

On which port is the adguard home container (origin) listening?

3000/TCP for the initial installation; 80/TCP for the web interface; 53/UDP for the DNS server.

Since it's on macvlan network (for DNS purposes) and simultanously in the same bridge network as AdGuard Home Sync (for sync purposes), I did not expose any ports.

bakito commented 3 months ago

This sounds to me like a configuration issue of your docker-compos setup and not directly an issue with adguardhome-sync.

Adguardhome-sync needs to be able to access the adguardhome instances on the port they expose.

Unfortunately I can not help you debugging your local setup. Sorry for that.