rumd3x / dns-updater
Updates your DNS records on your DNS provider when it changes.
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 0
Type:project
Requires
- php: >=7.2
- cloudflare/sdk: ^1.1
- guzzlehttp/guzzle: ^6.3
- monolog/monolog: ^1.24
- rumd3x/php-baseobject: ^1.0
- tightenco/collect: ^5.8
- toin0u/digitalocean-v2: ^2.3
- vlucas/phpdotenv: ^2
Requires (Dev)
- phpunit/phpunit: ^8.0
This package is auto-updated.
Last update: 2025-03-29 00:44:46 UTC
README
Updates your DNS records on your DNS provider when it changes.
About
This project is a PHP utility used to update DNS Records on multiple DNS providers. It is basically used to keep an DNS "A" Record in sync with your public IP automatically, on any provider.
Currently available providers are:
- Cloudflare
- DigitalOcean
Usage
Running Locally
This tool does not ensure that your configurations are correct. Configure your DNS settings correctly on your provider first, and use this tool only to keep the record updated.
- Download the project locally
git clone https://github.com/rumd3x/dns-updater.git
# or
composer create-project rumd3x/dns-updater
Make sure to install the dependencies with composer install
when using git clone.
- Copy the
.env.example
file to.env
and fill in the necessary parameters.
PROVIDER
should be eitherdigitalocean
orcloudflare
.KEY
Your API key of the provider. If your provider is cloudflare it should beemail@email.com;your-api-key
.DOMAIN
The domain that your record belongs to, likemysite.com
.RECORD
The record that will be updated E.g.'ddns'
for updating the record atddns.mysite.com
.
- Now run the
app/bootstrap.php
file and watch your DNS records get updated. - Put the command to call the project on a schedule (Like a cron running it every 5 minutes or so) to make sure it is always up to date.
Running the docker way
You can also run this project using docker. It will run the project on a schedule (every 5 mins) by default. Just run the following command and you are good to go (refer for the environment variables definitions in the section above).
docker run --name dns-updater-mysite-ddns \
--env PROVIDER=cloudflare \
--env KEY=email@email.com;my-api-key-here \
--env DOMAIN=mysite.com \
--env RECORD=ddns \
--restart unless-stopped \
edmur/dns-updater
To check what's going on inside the container just run:
docker logs dns-updater-mysite-ddns