Coder Social home page Coder Social logo

ozamosi / dyn-gandi Goto Github PK

View Code? Open in Web Editor NEW

This project forked from danamir/dyn-gandi

0.0 0.0 0.0 56 KB

Use Gandi LiveDNS API to update DNS records with a dynamic IP.

License: GNU General Public License v3.0

Python 99.37% Dockerfile 0.63%

dyn-gandi's Introduction

dyn-gandi

Use Gandi LiveDNS API to update DNS records with a dynamic IP.

Prequisites

  • Generate a Gandi Personal Access Token (PAT) via either https://account.gandi.net/en/users/USER/security (where USER is your username), or Gandi Dashboard > Organizations > Manage > Create a token :
    • Choose a mandatory duration (Gandi allows one year max)
    • Give access at least to the resource DNS configuration
  • Python 3.x
Note

I recommend creating a repeating alarm in a calendar to be sure to renew the PAT before it is revoked.

Installation

Installation from release :
  • Download and extract the latest release.
  • Open a terminal to the extracted directory.
Installation from sources :
$ curl --location https://github.com/Danamir/dyn-gandi/archive/master.zip --output dyn-gandi-master.zip
$ unzip dyn-gandi-master.zip
$ mv dyn-gandi-master/ dyn-gandi
$ cd dyn-gandi
Setup :

(Optional) Configure Python virtual environment :

$ python -m venv .env
$ . .env/bin/activate (Linux) 
-or-
$ .env\Scripts\activate.bat (Windows)

Install :

$ python setup.py develop
$ copy config.ini-dist config.ini
$ dyn_gandi --help
-or-
$ python dyn_gandi.py --help

Complete the config.ini file, in particular check the lines :

[api]
key =

[dns]
domain = 
records = @,www

Running

Note: dyn_gandi can be substituted with python dyn_gandi.py if the former doesn't work.

Display help :

$ dyn_gandi --help

Dry run (without modifications) :

$ dyn_gandi --dry-run

Normal launch:

$ dyn_gandi

The log line will end by [OK] if no update was needed, [UPDATE] on successful update, and [ERROR] on error. On success, the automatic backup snapshot is deleted ; on error the snapshot uuid is displayed in the log for you to restore if needed.

Cron

Either create a scheduled task on windows, or add a crontab line. ie:

$ crontab -e
* */2 * * * dyn_gandi --log /var/log/dyn-gandi.log

NB: If you used a Python virtual environment, replace the script by <dyn-gandi-path>/.env/bin/dyn_gandi .

Using Docker :

To use the docker image, create a new directory for the configuration, and put the config file in it:

$ mkdir config
$ cp config.ini-dist config/config.ini

Update config/config.ini to contain the appropriate settings (see previous sections).

Finally, run the image, with the config image:

docker run -it --rm -v ./config:/etc/dyn-gandi:ro ghcr.io/ozamosi/dyn-gandi:master
Notes
Common errors
  • Ensure that your domain is correctly handled by Gandi LiveDNS API by following this guide.

dyn-gandi's People

Contributors

baymonin avatar comxd avatar danamir avatar francoisfreitag avatar gbrd avatar ozamosi avatar pieterhelsen avatar pipoprods avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.