🛡️ Synchronize AdGuard Home config to replicas
Find a file
dependabot[bot] cbcc85dc93
Bump helm/kind-action from 1.4.0 to 1.5.0 (#133)
Bumps [helm/kind-action](https://github.com/helm/kind-action) from 1.4.0 to 1.5.0.
- [Release notes](https://github.com/helm/kind-action/releases)
- [Commits](https://github.com/helm/kind-action/compare/v1.4.0...v1.5.0)

---
updated-dependencies:
- dependency-name: helm/kind-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-19 07:02:45 +01:00
.github Bump helm/kind-action from 1.4.0 to 1.5.0 (#133) 2022-12-19 07:02:45 +01:00
cmd add version option to cli #85 2022-07-24 18:23:17 +02:00
pkg force content type json #121 2022-11-07 18:37:55 +01:00
systemd add systemd script 2021-03-28 20:25:25 +02:00
testdata reuse e2e scripts 2022-10-07 07:32:20 +02:00
version add build time to version 2021-08-09 19:00:34 +02:00
.gitignore fix dependencies 2022-03-14 06:58:11 +01:00
.golangci.yml do delete first before add - fixes #95 2022-09-07 22:10:11 +02:00
.goreleaser.yml #124 don't upx windows binaries as they make trouble with virus scanners 2022-11-18 18:50:42 +01:00
Dockerfile go 1.18 2022-04-19 07:51:33 +02:00
go.mod Bump github.com/onsi/ginkgo/v2 from 2.5.1 to 2.6.0 (#129) 2022-12-12 08:09:22 +01:00
go.sum Bump github.com/onsi/ginkgo/v2 from 2.5.1 to 2.6.0 (#129) 2022-12-12 08:09:22 +01:00
LICENSE Update LICENSE 2021-08-12 14:28:20 +02:00
main.go use cobra/viper 2021-03-28 14:09:31 +02:00
Makefile log content type #121 2022-11-07 18:05:59 +01:00
README.md Update README.md 2022-11-20 18:49:36 +01:00

Go Go Report Card Coverage Status

AdGuardHome sync

Synchronize AdGuardHome config to replica 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.

Setup of initial instances

New AdGuardHome replica instances can be automatically installed if enabled via the config autoSetup. During automatic installation, the admin interface will be listening on port 3000 in runtime.

To skip automatic setup

Install

Get from releases or install from source

go install github.com/bakito/adguardhome-sync@latest

Prerequisites

Both the origin instance must be initially setup via the AdguardHome installation wizard.

Run Linux/Mac


export ORIGIN_URL=https://192.168.1.2:3000
export ORIGIN_USERNAME=username
export ORIGIN_PASSWORD=password
export REPLICA_URL=http://192.168.1.3
export REPLICA_USERNAME=username
export REPLICA_PASSWORD=password

# run once
adguardhome-sync run

# run as daemon
adguardhome-sync run --cron "*/10 * * * *"

Run Windows

@ECHO OFF
@TITLE AdGuardHome-Sync

REM set LOG_LEVEL=debug
set LOG_LEVEL=info
REM set LOG_LEVEL=warn
REM set LOG_LEVEL=error

set ORIGIN_URL=http://192.168.1.2:3000
set ORIGIN_USERNAME=username
set ORIGIN_PASSWORD=password

set REPLICA_URL=http://192.168.2.2:3000
set REPLICA_USERNAME=username
set REPLICA_PASSWORD=password

set FEATURES_DHCP=false
set FEATURES_DHCP_SERVERCONFIG=false
set FEATURES_DHCP_STATICLEASES=false

# run once
adguardhome-sync run

# run as daemon
adguardhome-sync run --cron "*/10 * * * *"

docker cli

docker run -d \
  --name=adguardhome-sync \
  -p 8080:8080 \
  -v /path/to/appdata/config/adguardhome-sync.yaml:/config/adguardhome-sync.yaml \
  --restart unless-stopped \
  ghcr.io/bakito/adguardhome-sync:latest

docker compose

config file

---
version: "2.1"
services:
  adguardhome-sync:
    image: ghcr.io/bakito/adguardhome-sync
    container_name: adguardhome-sync
    command: run --config /config/adguardhome-sync.yaml
    volumes:
      - /path/to/appdata/config/adguardhome-sync.yaml:/config/adguardhome-sync.yaml
    ports:
      - 8080:8080
    restart: unless-stopped

env

---
version: "2.1"
services:
  adguardhome-sync:
    image: ghcr.io/bakito/adguardhome-sync
    container_name: adguardhome-sync
    command: run
    environment:
      ORIGIN_URL: 'https://192.168.1.2:3000'
      ORIGIN_USERNAME: 'username'
      ORIGIN_PASSWORD: 'password'
      REPLICA_URL: 'http://192.168.1.3'
      REPLICA_USERNAME: 'username'
      REPLICA_PASSWORD: 'password'
      REPLICA1_URL: 'http://192.168.1.4'
      REPLICA1_USERNAME: 'username'
      REPLICA1_PASSWORD: 'password'
      REPLICA1_APIPATH: '/some/path/control'
      # REPLICA1_AUTOSETUP: true # if true, AdGuardHome is automatically initialized.
      # REPLICA1_INTERFACENAME: 'ens18' # use custom dhcp interface name
      CRON: '*/10 * * * *' # run every 10 minutes
      RUNONSTART: true
      # Configure sync features; by default all features are enabled.
      # FEATURES_GENERALSETTINGS: true
      # FEATURES_QUERYLOGCONFIG: true
      # FEATURES_STATSCONFIG: true
      # FEATURES_CLIENTSETTINGS: true
      # FEATURES_SERVICES: true
      # FEATURES_FILTERS: true
      # FEATURES_DHCP_SERVERCONFIG: true
      # FEATURES_DHCP_STATICLEASES: true
      # FEATURES_DNS_SERVERCONFIG: true
      # FEATURES_DNS_ACCESSLISTS: true
      # FEATURES_DNS_REWRITES: true
    ports:
      - 8080:8080
    restart: unless-stopped

Config file

location: $HOME/.adguardhome-sync.yaml

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

# runs the synchronisation on startup
runOnStart: true

origin:
  # url of the origin instance
  url: https://192.168.1.2:3000
  # apiPath: define an api path if other than "/control"
  # insecureSkipVerify: true # disable tls check
  username: username
  password: password

# replica instance (optional, if only one)
replica:
  # url of the replica instance
  url: http://192.168.1.3
  username: username
  password: password

# replicas instances (optional, if more than one)
replicas:
  # url of the replica instance
  - url: http://192.168.1.3
    username: username
    password: password
  - url: http://192.168.1.4
    username: username
    password: password
    # autoSetup: true # if true, AdGuardHome is automatically initialized. 

# 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: username
  password: password

# 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

Log Level

The log level can be set with the environment variable: LOG_LEVEL

The following log levels are supported (default: info)

  • debug
  • info
  • warn
  • error