The following provides a utility to update a NearlyFreeSpeech.NET DNS record with a dynamic IP address. The default process when invoking this utility will perform the following:
- Selecting a random provider to query for a public IP of the running host.
- Query a NearlyFreeSpeech.NET API for a configured IP on DNS record.
- Compare the address, and update if they do not match.
- (optional) Cache the detected public address set on NearlyFreeSpeech.NET for a couple of days (configurable) to limit API requests.
This tool can be installed using pip:
pip install nfsn-ddns
(or)
python -m pip install nfsn-ddns
This tool can be invoked from a command line using:
nfsn-ddns --help
(or)
python -m nfsn-ddns --help
This utility can be configured using a file, command line arguments or
environment variables. An example configuration file (config.yaml
) is
as follows:
nfsn-ddns:
api-login: <api-login>
api-token: <api-token>
domains:
- <domain>
timeout: 10
A user can use a combination of ways to configure this utility. For example, most options can be configured from the command line, but some options (such as the API token) can be configured from an environment variable:
export NFSN_DDNS_API_TOKEN=myapitoken
nfsn-ddns --api-login myaccount --ddns-domain ddns.example.com
All available configuration options are listed as follows:
This project supports multiple ways to use this utility inside a Docker environment. A recommended choice is to use a pre-built image available from GitHub's container registry.
A pre-built image can be acquired using the following command:
docker pull ghcr.io/jdknight/nfsn-ddns
Prepare a configuration environment for this container by creating a
file /etc/nfsn-ddns
with the contents defined in env.default
(users can use any path or filename they desire, as long as the following
docker run
command points to this file). Adjust these options to the
configuration desired.
The container than can be run using the following command:
docker run --name nfsn-ddns --detach --restart unless-stopped \
--env-file /etc/nfsn-ddns ghcr.io/jdknight/nfsn-ddns
Users who wish to manage their own image can do so with the Docker definitions found inside this repository. This can be done by cloning this repository on the host wanting to run the container. A Docker build can be run on the
docker build -t ghcr.io/jdknight/nfsn-ddns --detach -f docker/Dockerfile .
Then running the same docker run
call mentioned above.
Users can also take advantage of the Docker compose definition. First, copy
the environment template (env.default
) to .nfsn-ddns.env
, followed by
editing required options.
cp env.default .nfsn-ddns.env
Next, load up the container using docker compose
:
docker compose build
docker compose up --detach
Both Docker build calls will by default load a container with the
PyPI version of nfsn-ddns. Users wanting to use the local implementation
in their container can do so by performing a Docker build with the
--build-arg local
argument.
For example:
docker compose build --build-arg BUILD_MODE=local
docker compose up --detach