🛡️ Synchronize AdGuard Home config to replicas
Find a file
Marc Brugger 28782fc364
Merge pull request #7 from bakito/dependabot/go_modules/github.com/onsi/ginkgo-1.16.1
Bump github.com/onsi/ginkgo from 1.16.0 to 1.16.1
2021-04-12 10:15:17 +02:00
.github extend tests 2021-04-11 10:51:24 +02:00
cmd add client tests 2021-04-11 16:13:37 +02:00
pkg add sync tests 2021-04-11 18:35:03 +02:00
systemd add systemd script 2021-03-28 20:25:25 +02:00
testdata add client tests 2021-04-11 16:13:37 +02:00
version use external semver 2021-03-28 19:31:11 +02:00
.gitignore add API server to trigger sync remotely 2021-03-29 08:43:18 +02:00
.goreleaser.yml simplifiy 2021-04-03 20:19:34 +02:00
Dockerfile add docker build #4 2021-04-05 20:13:13 +02:00
go.mod Merge pull request #7 from bakito/dependabot/go_modules/github.com/onsi/ginkgo-1.16.1 2021-04-12 10:15:17 +02:00
go.sum Merge pull request #7 from bakito/dependabot/go_modules/github.com/onsi/ginkgo-1.16.1 2021-04-12 10:15:17 +02:00
LICENSE Create LICENSE 2021-03-28 10:23:34 +02:00
main.go use cobra/viper 2021-03-28 14:09:31 +02:00
Makefile prepare sync and client tests 2021-04-11 11:56:55 +02:00
README.md start writing tests 2021-04-06 21:31:26 +02:00

Go Go Report Card Coverage Status

AdGuardHome sync

Synchronize AdGuardHome config to a replica instance.

Current sync features

  • General Settings
  • Filters
  • Rewrites
  • Services
  • Clients

Install

go get -u github.com/bakito/adguardhome-sync

Prerequisites

Both the origin and replica mist be initially setup via the Adguard Home installation wizard.

Run


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 * * * *"

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 \
  quay.io/bakito/adguardhome-sync:latest

docker compose

config file

---
version: "2.1"
services:
  adguardhome-sync:
    image: quay.io/bakito/adguardhome-sync
    container_name: adguardhome-sync
    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: quay.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
      - CRON=*/10 * * * * # run every 10 minutes
    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 * * * *"

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

# 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