The 'TransIP Dynamic IP DNS fixer' checks every minute if your external IP has changed. If the IP has changed, it will update your desired TransIP DNS records with your current IP address.
In order to run the fixer, you need:
- a TransIP private API key
- a
records.jsonthat contains the DNS records you desire to upgrade - an environment variable holding your
TRANSIP_USERNAME
On https://www.transip.nl/cp/account/api/ you can create "key pairs". You need to create a key pair for this script to
use. Once you've created a key pair, a private key will be shown. Copy this private key and save it to a transip.key
file on your computer.
To let the fixer know what DNS records you want to upgrade, you need to create a records.json file witch contains an
array of the following values:
- domain: your domain name for the DNS record
- name: the DNS record name
- expire: is the "Time To Live" in seconds (300 is recommended)
- type: the DNS record type (A, AAAA, CNAME, MX, TXT, etc.)
The fixer script will update the value of the record to the current IP address detected via https://api.ipify.org
[
{
"domain": "futureportal.com",
"name": "@",
"expire": 300,
"type": "A"
},
{
"domain": "futureportal.com",
"name": "server",
"expire": 300,
"type": "A"
}
]There are multiple ways to run the fixer.
- Download this repository to your machine
- Add the
transip.keyfile andrecords.jsonto the same folder as themain.tsfile - Create a
.envfile that holds:TRANSIP_USERNAME=myusername - Then run
deno run -A --env-file main.tsto run the fixer script.
In order to run the fixer via docker, you need to mount your transip.key file and records.json file to the running
container. You can run the script with the following command:
docker run -ti \
--detach \
--restart unless-stopped \
--env TZ="europe/amsterdam" \
--env TRANSIP_USERNAME="myusername" \
--volume ./records.json:/opt/futureportal/transip-dynamic-ip-fixer/records.json \
--volume ./transip.key:/opt/futureportal/transip-dynamic-ip-fixer/transip.key \
futureportal/transip-dynamic-ip-fixer:latestIn order to run the fixer via docker compose, you need the following files in the same location:
docker-compose.ymltransip.keyrecords.json
The docker compose should contain:
services:
transip-dynamic-ip-fixer:
image: futureportal/transip-dynamic-ip-fixer:latest
restart: unless-stopped
environment:
TZ: 'Europe/Amsterdam'
TRANSIP_USERNAME: 'myusername'
volumes:
- ./records.json:/opt/futureportal/transip-dynamic-ip-fixer/records.json
- ./transip.key:/opt/futureportal/transip-dynamic-ip-fixer/transip.keyRun docker compose up --detach to start the script.
Run ./Taskfile to see the available development commands. You need to have deno installed locally.
A big thanks to all the contributors!