Dockerised service updating your Gandi domain's A & CNAME records.
Used environment variables for configuration:
API_KEY: gandi api keyDOMAIN: managed domain (egexample.com)A_RECORDS: space separated A records to update (eg@ www blog); optional if onlyC_RECORDSare wantedC_RECORDS: space separated CNAME records to update (egwww blog target.com); optional if onlyA_RECORDSare wanted; note this takes semicolon-separated list of records in formatname1 name2 nameN target, egftp target1.example.com.;blog web mail target2.example.com.would create CNAME record forftppointing totarget1.example.com, andblog, web, mailsubdomains pointing totarget2.example.comOVERWRITE:true|false; passtrueif configured records should replace all the existing records at every execution. optional - defaults tofalseALWAYS_PUBLISH_CNAME:true|false; passtrueif CNAME records should be published with every execution, not only with the one ran at the container startup; forced totrueifOVERWRITE=true; optional - defaults tofalsePUBLISH_ONLY_ON_IP_CHANGE:true|false; passfalseif gandi api should be called with every execution, not only when our IP has changed from previously known IP; optional - defaults totrueTTL: dns entry ttl; optional - defaults to 10800CRON_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