Service worker that updates the Google DDNS registry from time to time, runs as a Docker standalone service.
Google provides to anyone who has a domain within the domains.google to create subdomains and associate them to any publuc IP address via DDNS, the main differente to usual DNS is that we can easily update the IP in which the subdomain points to. That's a great thing for people and companies who don't yet have a "static" public IP Address.
Go to Google Registrar and find the domain you want to create the subdomain, then select on the left menu the DNS item as shown:
On the bottom of the page click on "Show Advanced Settings":
Then a Dynamic DNS option will be available for you, click on "Manage Dynamic DNS" and create your own:
Please take a note of the:
- Endpoint/subdomain you've selected (e.g.: lks.proxfield.com);
- Username (available at the button "View credentials");
- Password (available at the button "View credentials").
To pull the image from this project go to your terminal (either Linux, Windows/WSL ou Unix/MacOs) and pull the image:
docker pull proxfield/proxfieldgoogleddnsupdater
or visit the image repository on DockerHub available at proxfield/proxfieldgoogleddnsupdater.
The docker-compose.yaml
should look a little something like the following:
version: "3.4"
services:
googleddns:
environment:
- 'DdnsSettings__Hosts__0__Endpoint=${DDNS_ENDPOINT}'
- 'DdnsSettings__Hosts__0__User=${DDNS_USER}'
- 'DdnsSettings__Hosts__0__Password=${DDNS_PASSWORD}'
- 'DdnsSettings__Hosts__0__OverrideIp=${DDNS_OVERRIDE_IP}'
- 'DdnsSettings__UpdateInterval=${DDNS_UPDATE_INTERVAL}'
- 'DdnsSettings__MaxParallelExecutions=${DDNS_MAX_PARALLEL_EXECUTIONS}'
image: proxfield/proxfieldgoogleddnsupdater
restart: unless-stopped
container_name: googleddns
- Endpoint: subdomain in which the IP will be bind to;
- User: username provided when clicking on "View Credentials";
- Password: password provided when clicking on "View Credentials";
- OverrideIp: IP to set as the point, leave it empty for using the actual newtork public address;
- UpdateInterval: given in seconds, stabilishes from what amount of time the worker should update the Google Registry (please do not select a value that is necessary to your application, so not to be banned or something);
- MaxParallelExecutions: allows the service to update more than one endpoint at the same time, at the maximum of 10 (so not to flood the Google Servers) and minimal of 1 (for obvious reasons).
There is a file named secrets.example.env
, copy it to secrets.env
:
cp secrets.example.env secrets.env
Edit the secrets.env
file with the following data grabbed from the Google Domains:
ENDPOINT=
USER=
PASSWORD=
OVERRIDE_IP=null
UPDATE_INTERVAL=300
MAX_PARALLEL_EXECUTIONS=10
Then run the application either using the up.sh
script or creating the image yourself by running the following commands:
docker build -t googleddnsupdater .
docker tag googleddnsupdater:latest googleddnsupdater:staging
docker compose --env-file ./secrets.env up -d
This worker has logging implemented, so we can track what is happening in real time (ish), feel free to use it.
docker logs -f googleddnsupdater
Using this service to update the Google registry couldn't be applicable to your scenario, this was developed to run on a docker environment we already have; if you need to create your own updater for some reason, here's how it works on a nutshell:
The service sends a request to the following URL: https://domains.google.com/nic/update?hostname={hostName}
, in which the hostname is the subdomain you've created.
The credentials are passed either by the URL itself, as in https://username:password@domains.google.com/nic/update?hostname=subdomain.yourdomain.com&myip=1.2.3.4
, which is not that safe. Also note that it is not necessary to pass your IP address on the myip query parameter, it is completely optional, since when not provided it will assume your own IP.
Proxfield and its affiliates have no direct connection with Google or any of its companies, this project was created to be used inside the Proxfield labs and its distributed via MIT license.