Git Product home page Git Product logo

cloudflare-dns-auto-updater's Introduction

Hello there

๐Ÿ‘จโ€๐Ÿ’ป About me

I am a tech-enthusiast, code-writing, LEGO-assembler nerd

  • ๐ŸŒž Currently working as a Junior Dev at UMH Systems GmbH ๐Ÿญ
  • ๐Ÿ‘€ I'm looking for new and interesting opportunities
  • ๐Ÿฅ… 2022 Goals: improve my programming skills and DevOps knowledge
  • ๐Ÿ—ฟ Fun fact: I love aeronautics and astrophysics ๐Ÿš€




๐Ÿ“ก Connect with me:


LinkedIn Website


๐Ÿ›  Languages and Tools:

C#ย  CSSย  HTMLย  Javascriptย  NodeJSย  Bashย 

Dockerย  K3Sย  Kubernetesย 

Vimย  Visual Studioย  VSCodeย 

Gitย  GitHubย 

SQL Serverย  MySqlย  PostgreSQLย 

Linuxย  Windowsย 


Metrics


Jokes Card

cloudflare-dns-auto-updater's People

Contributors

daruzero avatar nullndr avatar pigeonburger avatar

cloudflare-dns-auto-updater's Issues

Use zone name instead of Id for better UX

It would be a much more nicer user experience to simply write in the environment variable the name of the zone instead of the ID.
CloudFlare's API offers an endpoint to get zone information, with which retrieve the zone ID

[Bug]: Handling of failure to establish a new connection

What happened?

The container begins to restart when it fails to connect to the public IP API.

What did you expect to happen?

Proper exception handling, for example retrying to establish connection after a timeout

How can we reproduce this issue?

  1. Start the container with the unless-stopped restart policy
  2. Disconnect internet
  3. Wait for the next function that needs to establish connection to internet

Logs

2023-01-24 01:04:57,336 INFO: Getting current IP...
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 175, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 72, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/usr/local/lib/python3.7/socket.py", line 752, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Try again

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 710, in urlopen
    chunked=chunked,
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 386, in _make_request
    self._validate_conn(conn)
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 1042, in _validate_conn
    conn.connect()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 358, in connect
    self.sock = conn = self._new_conn()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 187, in _new_conn
    self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f16d7fc8dd0>: Failed to establish a new connection: [Errno -3] Try again

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 499, in send
    timeout=timeout,
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 788, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.ipify.org', port=443): Max retries exceeded with url: /?format=json (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f16d7fc8dd0>: Failed to establish a new connection: [Errno -3] Try again'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 31, in <module>
    main()
  File "main.py", line 27, in main
    cf.current_ip = cf.get_public_ip()
  File "/app/cloudflare.py", line 37, in get_public_ip
    response = requests.get(PUBLIC_IP_API_URL)
  File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 565, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.ipify.org', port=443): Max retries exceeded with url: /?format=json (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f16d7fc8dd0>: Failed to establish a new connection: [Errno -3] Try again'))

Screenshots

No response

App Version

1.5.2

Additional Context

Exception handling should be increased also in all the other functions, for example if the update of a domain fails

[Feature]: add testing

Describe your feature request

Add testing for everything

Is this a breaking change?

No

Describe possible alternatives

No response

Additional Context

No response

Refactor all code

All the codebase needs refactoring

  • Move env validation to python and remove entrypoint.sh
  • Create specific function to fetch env variables
  • Create modules for better maintainability and expansion

Update multiple domains

Add the possibility to update multiple domains giving a comma-separated list of zone names

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.