AdguardHome – synchronizing multiple instances

AdGuardHome is the privacy protection center for you and your devices. Free and open source, powerful network-wide ads & trackers blocking DNS server. What if you would like to restart AdGuard or it goes down for whatever reason? You should have another instance running, with the same configuration of your adblock-lists, DHCP settings and custom DNS-rewrites. 

The AdGuardHome-sync is a tool to synchronize AdGuardHome config to multiple replica instances. The AdGuardHome-Sync Docker image is a containerized solution designed specifically for synchronizing AdGuard instances. 

Current sync features

  • General Settings
  • Filters
  • Rewrites
  • Services
  • Clients
  • DNS Config
  • DHCP Config

By default, all features are enabled. Single features can be disabled in the config.
Sample configuration, you will need to save it as /docker/adguardhome-sync/adguardhome-sync.yaml for example:

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

# 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: http://192.168.1.1:30000
  # apiPath: define an api path if other than "/control"
  insecureSkipVerify: true
  username: yourAdguardUser
  password: yourAdguardPassword
  # cookie: Origin-Cookie-Name=CCCOOOKKKIIIEEE

# replicas instances
replicas:
  - url: http://192.168.1.4:3000
    username: yourAdguardUser
    password: yourAdguardPassword
    # cookie: Replica1-Cookie-Name=CCCOOOKKKIIIEEE

# 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: your-sync-web-user
  password: your-sync-web-password
  # enable api dark mode
  darkMode: true

# 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

Running the container

docker run -d \
 --name=adguard-sync \
 --hostname=adguard-sync \
 --detach=true \
 -e TZ=Europe/Warsaw \
 -v /docker/adguardhome-sync/adguardhome-sync.yaml:/config/adguardhome-sync.yaml \
 --restart unless-stopped \
 ghcr.io/bakito/adguardhome-sync:latest

This Docker run command is creating and starting a Docker container for the AdGuard Home Sync tool using the “bakito/adguardhome-sync:latest” Docker image. Let’s break down the components of the command:

  1. docker run -d: This instructs Docker to run the container in detached mode, meaning it runs in the background.
  2. --name=adguard-sync: Assigns the name adguard-sync to the Docker container.
  3. --hostname=adguard-sync: Sets the hostname of the container to adguard-sync.
  4. --detach=true: Specifies that the container should run in detached mode, similar to -d.
  5. -e TZ=Europe/Warsaw: Sets the time zone inside the container to Europe/Warsaw. This is important for applications that rely on accurate time information.
  6. -v /docker/adguardhome-sync/adguardhome-sync.yaml:/config/adguardhome-sync.yaml: Mounts the host file /docker/adguardhome-sync/adguardhome-sync.yaml to the container’s /config/adguardhome-sync.yaml file. This is used to provide configuration settings to the application and persist them.
  7. --restart unless-stopped: Configures the container to restart automatically unless explicitly stopped.
  8. ghcr.io/bakito/adguardhome-sync:latest: Specifies the Docker image (ghcr.io/bakito/adguardhome-sync:latest) to be used for creating the container. The :latest tag indicates the use of the latest version of the image.

After you run the adguard-home-sync container, it’s web UI will be available on port 8080 of your Docker host.

Source

https://github.com/bakito/adguardhome-sync?ref=selfhostblog.com

Leave a Reply

Your email address will not be published. Required fields are marked *