digitalocean-dyndns/README.md

41 lines
1.8 KiB
Markdown
Raw Normal View History

2016-01-23 16:47:35 +00:00
# Dynamic DNS using DigitalOcean's DNS Services
2016-01-23 20:09:58 +00:00
2016-10-05 14:05:41 +00:00
[![](https://images.microbadger.com/badges/image/tunix/digitalocean-dyndns.svg)](https://microbadger.com/images/tunix/digitalocean-dyndns "Get your own image badge on microbadger.com")
2016-01-23 20:23:55 +00:00
A script that pushes the public IP address of the running machine to DigitalOcean's DNS API's. It requires an existing A record to update. The resulting container image is roughly around 7 MB (thanks to Alpine Linux).
2016-01-23 20:09:58 +00:00
## Setup
Assuming you already have a DigitalOcean account and your domain associated with it. Just add an A record with desired name and IP address. That's it!
## Usage
Pick one of the options below using the following settings:
* **DIGITALOCEAN_TOKEN:** The token you generate in DigitalOcean's API settings.
* **DOMAIN:** The domain your subdomain is registered at. (i.e. `foo.com` for `home.foo.com`)
2020-01-30 13:38:37 +00:00
* **NAME:** Subdomain to use. (name in A record) (i.e. `home` for `home.foo.com`). Multiple subdomains must be separated by semicolons `;`
2016-01-23 20:09:58 +00:00
* **SLEEP_INTERVAL:** Polling time in seconds. (default: 300)
2021-07-05 00:22:17 +00:00
* **REMOVE_DUPLICATES:** If set to `"true"`, removes extra DNS records if more than one A record is found on a subdomain. *Note that if this is not enabled, the script will NOT update subdomains with more than one A record* (default: false)
2016-01-23 20:09:58 +00:00
### Docker (Recommended)
```
2023-07-18 11:26:42 +00:00
$ docker pull code.tjo.space/mentos1386/digitalocean-dyndns:main
2016-01-23 20:20:28 +00:00
$ docker run -d --name dyndns \
2016-01-23 20:23:55 +00:00
-e DIGITALOCEAN_TOKEN="your_token_here" \
-e DOMAIN="yourdomain.com" \
-e NAME="subdomain" \
-e SLEEP_INTERVAL=2 \
2021-07-05 00:22:17 +00:00
-e REMOVE_DUPLICATES="true" \
2023-07-18 11:26:42 +00:00
code.tjo.space/mentos1386/digitalocean-dyndns:main
2016-01-23 20:09:58 +00:00
```
### Manual
You can also create a cronjob using below command:
```
$ DIGITALOCEAN_TOKEN="your_token_here" DOMAIN="yourdomain.com" NAME="subdomain" SLEEP_INTERVAL=2 ./dyndns.sh
```