Skip to main content

Application to keep DNS records updated when external IP-address change using the Loopia-API for the domain provider Loopia

Project description

Loopia update ip

Utility to keep your domains pointing to the current external IP-adress using the Loopia-API to update your adresses.

Required privileges for API-key in the LoopiaAPI control panel

Required privileges:

  • addSubdomain
  • removeZoneRecord
  • updateZoneRecord
  • addZoneRecord
  • getSubdomains
  • getZoneRecords
  • removeSubdomain

Docker - Preferred usage

The preferred way to run this service is a Docker container with the configuration provided as a docker-compose file.

Create the following file structure


\ loopia-update-ip
├──\ config
│  ├── config.yaml
├──\ logs
├── docker-compose.yaml

Docker compose file: docker-compose.yaml

services:
  ftp:
    image: registry.gitlab.com/niklasme/loopia-update-ip
    container_name: loopia-update-ip
    volumes:
      - ./config:/config
      - ./logs:/logs
    restart: unless-stopped

Service configuration file: config.yaml

credentials:
    loopia_username: xyz@loopiaapi
    loopia_password: abc
domains:
  'mydomain.com':
    sub_domains:
      - www
      - video
    ttl: 3600

Start Docker container service

docker compose up

Verify that no errors are thrown and that your credentials are accepted. Press Ctrl-C to stop the service and relaunch in detached mode.

docker compose up -d

You can always check logs in the output file:

cat ./logs/loopia_update_ip.log

or by ouputing the logs from the Docker container

#> docker ps
CONTAINER ID   IMAGE                                           COMMAND                  CREATED          STATUS                 PORTS                                                                                      NAMES  
fc1a6ff4debd   registry.gitlab.com/niklasme/loopia-update-ip   "loopia-update-ip-se…"   10 minutes ago   Up 9 minutes                                                                                                      loopia-update-ip

#> docker logs fc1a6ff4debd

Example of log output:

 Starting service
 Logging to: /logs/loopia_update_ip.log
 Docker configuration file found!
 Domain: www.mydomain.com: Zone record 123.123.123.123 - External IP 123.123.123.123
	 No update required!
 Domain: video.mydomain.com: Zone record 123.123.123.123 - External IP 123.123.123.123
	 No update required!
 Domain: ftp.mydomain.com: Zone record 123.123.123.123 - External IP 123.123.123.123
	 No update required!
 Domain: docs.mydomain.com: Zone record 213.213.213.213 - External IP 123.123.123.123

 Updating zone record to 123.123.123.123 for docs.mydomain.com
 Domain: security.mydomain.com: Zone record 123.123.123.123 - External IP 123.123.123.123
	 No update required!
2024-03-30 17:14:37,637 - root - INFO - External IP-address is still 123.123.123.123
2024-03-30 17:14:55,707 - root - INFO - External IP-address is still 123.123.123.123
2024-03-30 17:15:13,765 - root - INFO - External IP-address is still 123.123.123.123

Python module usage

In default mode the external IP-adress will be fetched from internet and applied to the full domain name with ttl=3600

loopia-update-ip --username xyz@loopiaapi --password YourToken --domain www.mydomain.com

To set a specific IP-address and not resolve from internet

loopia-update-ip --username xyz@loopiaapi --password YourToken --domain www.mydomain.com  --ip 123.123.123.123

To start the service to continuously monitor if the external IP-address changes

loopia-update-ip-service --username xyz@loopiaapi --password YourToken --domain www.mydomain.com

You may save your configuration in the same way as for the Docker configuration. The configuration should the in your home folder at the following location:

~/.config/loopia_update_ip/config.yaml

Use the same syntax as described for Docker under section Service configuration file: config.yaml

Development only

Build Docker image locally

docker build -t loopia-update-ip
docker compose up

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

loopia_update_ip-0.5.5.tar.gz (23.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

loopia_update_ip-0.5.5-py3-none-any.whl (23.6 kB view details)

Uploaded Python 3

File details

Details for the file loopia_update_ip-0.5.5.tar.gz.

File metadata

  • Download URL: loopia_update_ip-0.5.5.tar.gz
  • Upload date:
  • Size: 23.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.10

File hashes

Hashes for loopia_update_ip-0.5.5.tar.gz
Algorithm Hash digest
SHA256 51b426c705d15e830f1db1608c99ab2ab0d25c9749177541bcffd858f27e1db6
MD5 14b2d35107675a1edde6f080ef149012
BLAKE2b-256 577bd491acfa93beb5574f050fc60563d032f2ae9e0bfaaa7fd1842b3115ffcb

See more details on using hashes here.

File details

Details for the file loopia_update_ip-0.5.5-py3-none-any.whl.

File metadata

File hashes

Hashes for loopia_update_ip-0.5.5-py3-none-any.whl
Algorithm Hash digest
SHA256 561e2af6786097347187ea1dcc0f326dd2d80d740fb5efd67d6d77fe3111ee8f
MD5 bfb4a0cf4f49b519fe98713013b2d93b
BLAKE2b-256 4e51cd450e5e563df0f75c464733ad5bb06d7e6166c6792833966f91f5981726

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page