/docker-gandi-dns-update

automatic gandi dns update service

Primary LanguageShell

Gandi DNS updater

Dockerised service updating your Gandi domain's A & CNAME records.

Running

Used environment variables for configuration:

  • API_KEY: gandi api key
  • DOMAIN: managed domain (eg example.com)
  • A_RECORDS: space separated A records to update (eg @ www blog); optional if only C_RECORDS are wanted
  • C_RECORDS: space separated CNAME records to update (eg www blog target.com); optional if only A_RECORDS are wanted; note this takes semicolon-separated list of records in format name1 name2 nameN target, eg ftp target1.example.com.;blog web mail target2.example.com. would create CNAME record for ftp pointing to target1.example.com, and blog, web, mail subdomains pointing to target2.example.com
  • OVERWRITE: true|false; pass true if configured records should replace all the existing records at every execution. optional - defaults to false
  • ALWAYS_PUBLISH_CNAME: true|false; pass true if CNAME records should be published with every execution, not only with the one ran at the container startup; forced to true if OVERWRITE=true; optional - defaults to false
  • PUBLISH_ONLY_ON_IP_CHANGE: true|false; pass false if gandi api should be called with every execution, not only when our IP has changed from previously known IP; optional - defaults to true
  • TTL: dns entry ttl; optional - defaults to 10800
  • CRON_PATTERN: cron pattern to be used to execute the script. optional - execution defaults to every 15 min (eg */5 * * * * to execute every 5 minutes)

Note at the container startup it immediately tries updating the records, and container will halt on any error; this is for sanity check to make sure you don't launch the service with invalid settings. Downside is the container can't be started without Internet connection.

Example docker command:

docker run -d \
	--name gandi-dns-update \
	-e API_KEY=your_gandi_api_key \
	-e DOMAIN=example.com \
	-e A_RECORDS='@ www' \
	-e C_RECORDS='ftp example.com.;blog web mail target2.example.com.' \
	-e CRON_PATTERN='*/5 * * * *' \
	layr/gandi-dns-update