Skip to content

JkLondon/ddns-porkbun-worker

Repository files navigation

DDNS Updater

Go + Telegram utility to keep Porkbun A-records in sync with your current public IP.

How it works

  • Main .env stores secrets and base settings.
  • Private runtime env stores mutable state: update mode and tracked subdomains.
  • Telegram commands update the runtime env directly, so no service restart is needed.
  • Manual edits in the runtime env are picked up on the next /update and after restart.

Recommended layout:

  • /etc/ddns-updater/.env
  • /etc/ddns-updater/.runtime.env

Runtime env format

MODE=selected
SUBDOMAINS=home,nas,@
  • MODE=selected: update only subdomains from the list.
  • MODE=all: update all existing A-records in Porkbun.
  • @ means the root domain.

The runtime env is written with 0600 permissions and the install target creates /etc/ddns-updater with 0700.

Telegram commands

  • /update runs sync immediately.
  • /list shows current runtime env.
  • /add <subdomain> adds a subdomain to SUBDOMAINS.
  • /remove <subdomain> removes a subdomain from SUBDOMAINS.
  • /mode selected switches to list-based mode.
  • /mode all switches to update-all mode.
  • /help shows help.

Important:

  • /add and /remove do not create or delete DNS records in Porkbun.
  • If the A-record already exists in Porkbun, /add only updates local runtime env.
  • If the A-record does not exist, the service keeps the subdomain in runtime env and reports it as missing during update.

Install

sudo mkdir -p /etc/ddns-updater
sudo cp .env.example /etc/ddns-updater/.env
sudo cp runtime.env.example /etc/ddns-updater/.runtime.env
sudoedit /etc/ddns-updater/.env
sudoedit /etc/ddns-updater/.runtime.env
make install

Legacy migration:

  • If .runtime.env does not exist yet, the service bootstraps it from SUBDOMAINS in the main .env.

Check timer status:

systemctl status ddns-updater.timer

Remove completely:

make uninstall

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors