GithubHelp home page GithubHelp logo

marcportabellaclotet-mt / gcp-dynamic-dns Goto Github PK

View Code? Open in Web Editor NEW

This project forked from luontola/gcp-dynamic-dns

0.0 0.0 0.0 93 KB

Syncs the current IP address to Google Cloud DNS records

Home Page: https://hub.docker.com/r/luontola/gcp-dynamic-dns

License: Apache License 2.0

Shell 3.09% Go 94.90% Dockerfile 2.00%

gcp-dynamic-dns's Introduction

Google Cloud Dynamic DNS Client

Syncs the current IP address to Google Cloud DNS records. Can discover your public IP based on (1) a 3rd party web service, (2) directly from the local network interface, or (3) the network router using UPnP.

Works only for IPv4 addresses.

This project is distributed as a Docker image. (Or if you're familiar with Golang, you may build it from source yourself.)

Using

Run this application's container using the command sync and restart policy always. That will sync the IP address automatically whenever it changes.

At minimum, configure the environment variables DNS_NAMES, GOOGLE_PROJECT and GOOGLE_APPLICATION_CREDENTIALS. If you change the MODE from its default, you'll also need to set the container's network mode to host.

For a list of other commands, run the help command.

Example Docker Compose configuration

version: '2.4'
services:
  dyndns:
    image: luontola/gcp-dynamic-dns:1.5
    command: sync
    network_mode: host
    environment:
      DNS_NAMES: example.com. www.example.com.
      GOOGLE_PROJECT: example-123456
      GOOGLE_APPLICATION_CREDENTIALS: /gcp-keys.json
    volumes:
      - /path/to/gcp-dns-admin-keys.json:/gcp-keys.json:ro
    restart: always

Environment variables

MODE (optional)

The method for determining your public IP address. Possible values:

  • service (default) - Asks a 3rd party web service for your external IP address.
  • interface - Asks your operating system for the IP address assigned to a network interface.
  • upnp - Asks your network router for its external IP address using Universal Plug and Play.
    • Not every router has UPnP enabled and a firewall may block it as well, so to debug issues, first check if upnpc -s reports the ExternalIPAddress.

Default: service

SERVICE_URLS (optional, MODE=service)

Web addresses of services which report your public IP address. Multiple services may be separated by space, in which case they will be used in a round-robin fashion. The continuous check interval is 5 minutes, so use more than once service to call each individual service less often.

Default: https://ipv4.icanhazip.com/ https://checkip.amazonaws.com/ https://ifconfig.me/ip https://ipinfo.io/ip

INTERFACE_NAME (optional, MODE=interface)

Name of the network interface whose IP to use. If not defined, the program will detect the primary network interface automatically.

Example: eth0

DNS_NAMES

List of domain names to update. Separate the domain names with one space. Each name must end with a period. The DNS records must already exist on Cloud DNS and they must be type A records.

Example: example.com. subdomain.example.com. example.org.

GOOGLE_PROJECT

The name of your Google Cloud project. The above mentioned DNS names must be hosted under this project's Cloud DNS.

Example: your-project-123456

GOOGLE_APPLICATION_CREDENTIALS

Path to service account credentials with permissions to update your Cloud DNS records.

Example: /path/to/dns-updater-gcp-keys.json

In the GCP console, under IAM & admin > Service accounts, create a service account for the application. Name it dns-updater, grant it the DNS > DNS Administrator role, create a key for it in JSON format and save it as dns-updater-gcp-keys.json.

Developing

Run tests and build the project

docker-compose build --force-rm

Run the application

docker-compose run --rm app help

The application container doesn't have sh or other fancy stuff, so to inspect its contents use the docker export command:

docker export <container> | tar tv

gcp-dynamic-dns's People

Contributors

luontola avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.