2021-04-07 03:27:33 +08:00
|
|
|
[![Go](https://github.com/bakito/adguardhome-sync/actions/workflows/go.yml/badge.svg)](https://github.com/bakito/adguardhome-sync/actions/workflows/go.yml)
|
|
|
|
[![Go Report Card](https://goreportcard.com/badge/github.com/bakito/adguardhome-sync)](https://goreportcard.com/report/github.com/bakito/adguardhome-sync)
|
|
|
|
[![Coverage Status](https://coveralls.io/repos/github/bakito/adguardhome-sync/badge.svg?branch=main)](https://coveralls.io/github/bakito/adguardhome-sync?branch=main)
|
2021-03-28 06:44:48 +08:00
|
|
|
# AdGuardHome sync
|
|
|
|
|
|
|
|
Synchronize [AdGuardHome](https://github.com/AdguardTeam/AdGuardHome) config to a replica instance.
|
2021-03-28 16:30:00 +08:00
|
|
|
|
|
|
|
## Current sync features
|
|
|
|
|
2021-03-31 08:28:18 +08:00
|
|
|
- General Settings
|
2021-03-28 16:30:00 +08:00
|
|
|
- Filters
|
|
|
|
- Rewrites
|
|
|
|
- Services
|
|
|
|
- Clients
|
|
|
|
|
|
|
|
## Install
|
|
|
|
|
|
|
|
```bash
|
|
|
|
go get -u github.com/bakito/adguardhome-sync
|
|
|
|
```
|
|
|
|
|
2021-04-05 19:33:21 +08:00
|
|
|
## Prerequisites
|
|
|
|
|
|
|
|
Both the origin and replica mist be initially setup via the Adguard Home installation wizard.
|
|
|
|
|
2021-03-28 16:30:00 +08:00
|
|
|
## Run
|
|
|
|
|
|
|
|
```bash
|
2021-03-28 22:29:18 +08:00
|
|
|
|
2021-03-28 20:09:31 +08:00
|
|
|
export ORIGIN_URL=https://192.168.1.2:3000
|
2021-03-28 16:30:00 +08:00
|
|
|
export ORIGIN_USERNAME=username
|
|
|
|
export ORIGIN_PASSWORD=password
|
2021-03-28 20:09:31 +08:00
|
|
|
export REPLICA_URL=http://192.168.1.3
|
2021-03-28 16:30:00 +08:00
|
|
|
export REPLICA_USERNAME=username
|
|
|
|
export REPLICA_PASSWORD=password
|
|
|
|
|
2021-03-28 22:29:18 +08:00
|
|
|
# run once
|
2021-03-28 20:09:31 +08:00
|
|
|
adguardhome-sync run
|
2021-03-28 22:29:18 +08:00
|
|
|
|
|
|
|
# run as daemon
|
|
|
|
adguardhome-sync run --cron "*/10 * * * *"
|
2021-03-28 23:04:41 +08:00
|
|
|
```
|
|
|
|
|
2021-04-06 01:26:35 +08:00
|
|
|
## docker cli
|
|
|
|
|
|
|
|
```bash
|
|
|
|
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
|
2021-04-06 03:04:01 +08:00
|
|
|
|
|
|
|
### config file
|
2021-04-06 01:26:35 +08:00
|
|
|
```yaml
|
|
|
|
---
|
|
|
|
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
|
2021-04-06 03:04:01 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
### env
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
---
|
|
|
|
version: "2.1"
|
|
|
|
services:
|
|
|
|
adguardhome-sync:
|
|
|
|
image: quay.io/bakito/adguardhome-sync
|
|
|
|
container_name: adguardhome-sync
|
2021-04-06 03:23:15 +08:00
|
|
|
command: run
|
2021-04-06 03:04:01 +08:00
|
|
|
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
|
2021-04-06 01:26:35 +08:00
|
|
|
```
|
|
|
|
|
2021-03-28 23:04:41 +08:00
|
|
|
### Config file
|
|
|
|
|
|
|
|
location: $HOME/.adguardhome-sync.yaml
|
|
|
|
|
|
|
|
```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
|
2021-03-29 02:39:19 +08:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2021-03-28 23:04:41 +08:00
|
|
|
```
|