Sign inSign up

techblog/aghsync

By techblog

Updated 4 months ago

Image
0

760

techblog/aghsync repository overview

AGHSync

AGHSync keeps your AdGuardHome instances in sync automatically. Designate one instance as the master — AGHSync propagates its configuration to every slave instance on a schedule, on demand, or via webhook.


Screenshots

Dashboard

Dashboard

Dark Mode

Dark Mode

Instances

Instances

Sync Configuration (master)

Sync Config

Sync History

History

Run Detail with Diff

History Detail

Settings

Settings


Features

Instance Management
  • Add, edit, and delete AdGuardHome instances
  • Designate one instance as Master — promoting a slave automatically demotes the current master and transfers its sync configuration
  • Connection test with live credential validation before saving
  • TLS skip-verify option per instance for self-signed certificates
  • Duplicate prevention — each address can only be added once; a clear error is shown if you try to add the same instance twice
  • Online/Offline status — a colored dot per instance refreshes every 60 seconds
Synchronisation
  • Granular sync config — the master controls which AdGuardHome configuration types are pushed to slaves via per-type checkboxes:
    • blocked_services, dhcp, dns, filtering, parental, rewrite, safebrowsing, safesearch, tls
  • Scheduled sync — user-configurable cron expression (e.g. 0 * * * * for hourly)
  • Manual run — trigger a sync instantly from the UI or via API
  • Webhook triggerPOST /api/v1/webhook/sync for external integrations (e.g. AdGuardHome post-update hooks)
  • Sync runs concurrently across all slave instances
Dashboard
  • Master instance summary, live sync status, and last run result
  • Per-instance stats cards showing:
    • AdGuardHome version
    • Total DNS queries
    • Blocked by filters
    • Blocked malware / phishing
    • Average DNS processing time
  • Stats refresh automatically every 60 seconds
History & Diff
  • Full sync run history with status (Success, Partial Failure, Error), trigger source, start time, and duration
  • Per-run detail view with a result row per config type and per slave
  • Change indicator — an amber icon flags config types where a change was actually applied
  • LCS-based diff viewer — click any row to expand a green/red unified diff showing exactly what changed, with +N / -N summary badge
Settings
  • UI Authentication — enable/disable Basic Auth for the web interface; username and password set via the UI
  • API Token — generate a secure token for protecting the REST API; shown once and never stored in plaintext
  • Backup & Restore — export all settings (auth config, API token hash, all instances, sync configuration) to a JSON file; import a backup to fully restore a previous state
API
  • Every UI action has an equivalent REST endpoint
  • Swagger / OpenAPI documentation served at /api/docs
  • Token-authenticated (X-API-Token header) or Basic Auth
  • See /api/docs for the full endpoint reference
Dark Mode
  • System-preference-aware dark/light toggle in the navbar

Quick Start

docker run -d \
  --name aghsync \
  -p 8080:8080 \
  -v aghsync-data:/app/data \
  t0mer/aghsync

Open http://localhost:8080

Docker Compose
services:
  aghsync:
    image: t0mer/aghsync
    ports:
      - "8080:8080"
    volumes:
      - aghsync-data:/app/data
    environment:
      LOG_LEVEL: info

volumes:
  aghsync-data:
docker compose up -d
Binary

Download the binary for your platform from the Releases page.

# Linux / macOS
chmod +x aghsync-linux-amd64
./aghsync-linux-amd64

# Windows
aghsync-windows-amd64.exe

Configuration

CLI Flags
FlagDescription
--port <n>Listening port. Default: 8080. Overridden by AGHSYNC_PORT.
--log-level <level>debug / info / warning / error. Default: warning.
--reset-passwordInteractively reset the UI login password.
--service <action>Manage the OS service: install / uninstall / start / stop / restart.
Environment Variables
VariableDescription
AGHSYNC_PORTServer port — takes precedence over --port.
LOG_LEVELLog level — takes precedence over --log-level.
AGHSYNC_DATADirectory for aghsync.db. Default: current working directory.

Port resolution order (highest → lowest): AGHSYNC_PORT--port → built-in default (8080).


Supported Platforms

OSArchitecture
Linuxamd64, arm64, armv7, armv6, 386
macOSamd64 (Intel), arm64 (Apple Silicon)
Windowsamd64, arm64

Docker images: linux/amd64, linux/arm64, linux/arm/v7


API

The full REST API is documented at /api/docs (Swagger UI).

Key endpoints:

MethodPathDescription
GET/api/v1/instancesList all instances
POST/api/v1/instancesAdd an instance
PUT/api/v1/instances/{id}Update an instance
DELETE/api/v1/instances/{id}Remove an instance
PUT/api/v1/instances/{id}/promotePromote slave to master
GET/api/v1/instances/{id}/sync-configGet master sync config
PUT/api/v1/instances/{id}/sync-configUpdate master sync config
GET/api/v1/instances/statusesOnline/offline status for all instances
GET/api/v1/instances/{id}/statsDNS stats for one instance
POST/api/v1/sync/runTrigger a manual sync
GET/api/v1/sync/statusCurrent and last run status
PUT/api/v1/sync/scheduleUpdate the cron schedule
POST/api/v1/webhook/syncWebhook trigger
GET/api/v1/historyList sync runs
GET/api/v1/history/{runId}Run detail with per-config diffs
GET/api/v1/settingsGet application settings
PUT/api/v1/settings/ui-authEnable/disable UI auth
POST/api/v1/settings/api-tokenGenerate API token
DELETE/api/v1/settings/api-tokenRemove API token
GET/api/v1/backup/exportDownload settings backup
POST/api/v1/backup/restoreRestore from backup

Authentication:

  • No token configured → all /api/v1 requests pass through (bootstrap mode)
  • Token configured → requests must include X-API-Token: <token> or valid Basic Auth credentials (when UI auth is enabled)

Development

# Prerequisites: Go 1.22+, Node 20+

# Start backend + frontend with hot reload
./scripts/dev.sh

# Run tests
go test ./...

# Build all release targets → dist/
./scripts/build.sh

# Build Docker image
docker build -t aghsync .

License

MIT

Tag summary

Content type

Image

Digest

sha256:c401d62dc

Size

10.2 MB

Last updated

4 months ago

docker pull techblog/aghsync