mietzen / porkbun-ddns

porkbun-ddns is an unoffical DDNS-Client for Porkbun Domains.
MIT License
118 stars 7 forks source link

[Errno 99] Cannot assign requested address #30

Closed Sparkrdom closed 9 months ago

Sparkrdom commented 9 months ago

Trying to migrate from a working setup of https://github.com/porkbundomains/porkbun-dynamic-dns-python and am seeing the container stuck in a constant restarting loop.

Current docker compose is

services:
  porkbun-ddns:
    image: "mietzen/porkbun-ddns:latest"
    container_name: porkbun-ddns
    environment:
      DOMAIN: "<redacted>.com" # Your Porkbun domain
      SUBDOMAINS: "adguard,jellyfin,deemix" # Subdomains comma spreaded
      SECRETAPIKEY: "<redacted>" # Your Porkbun Secret-API-Key
      APIKEY: "<redacted>" # Your Porkbun API-Key
    restart: unless-stopped

Which results in the following looping restart error:

2023-11-29 21:46:12 Traceback (most recent call last):
2023-11-29 21:46:12   File "/entrypoint.py", line 51, in <module>
2023-11-29 21:46:12     porkbun_ddns.update_records()
2023-11-29 21:46:12   File "/usr/local/lib/python3.12/site-packages/porkbun_ddns-0.4.1-py3.12.egg/porkbun_ddns/porkbun_ddns.py", line 135, in update_records
2023-11-29 21:46:12   File "/usr/local/lib/python3.12/site-packages/porkbun_ddns-0.4.1-py3.12.egg/porkbun_ddns/porkbun_ddns.py", line 90, in get_public_ips
2023-11-29 21:46:12   File "/usr/local/lib/python3.12/urllib/request.py", line 215, in urlopen
2023-11-29 21:46:12     return opener.open(url, data, timeout)
2023-11-29 21:46:12            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-11-29 21:46:12   File "/usr/local/lib/python3.12/urllib/request.py", line 515, in open
2023-11-29 21:46:12     response = self._open(req, data)
2023-11-29 21:46:12                ^^^^^^^^^^^^^^^^^^^^^
2023-11-29 21:46:12   File "/usr/local/lib/python3.12/urllib/request.py", line 532, in _open
2023-11-29 21:46:12     result = self._call_chain(self.handle_open, protocol, protocol +
2023-11-29 21:46:12              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-11-29 21:46:12   File "/usr/local/lib/python3.12/urllib/request.py", line 492, in _call_chain
2023-11-29 21:46:12     result = func(*args)
2023-11-29 21:46:12              ^^^^^^^^^^^
2023-11-29 21:46:12   File "/usr/local/lib/python3.12/urllib/request.py", line 1392, in https_open
2023-11-29 21:46:12     return self.do_open(http.client.HTTPSConnection, req,
2023-11-29 21:46:12            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-11-29 21:46:12   File "/usr/local/lib/python3.12/urllib/request.py", line 1347, in do_open
2023-11-29 21:46:12     raise URLError(err)
2023-11-29 21:46:12 urllib.error.URLError: <urlopen error [Errno 99] Cannot assign requested address>
2023-11-29 21:47:13 Traceback (most recent call last):
2023-11-29 21:47:13   File "/usr/local/lib/python3.12/urllib/request.py", line 1344, in do_open
2023-11-29 21:47:13     h.request(req.get_method(), req.selector, req.data, headers,
2023-11-29 21:47:13   File "/usr/local/lib/python3.12/http/client.py", line 1319, in request
2023-11-29 21:47:13     self._send_request(method, url, body, headers, encode_chunked)
2023-11-29 21:47:13   File "/usr/local/lib/python3.12/http/client.py", line 1365, in _send_request
2023-11-29 21:47:13     self.endheaders(body, encode_chunked=encode_chunked)
2023-11-29 21:47:13   File "/usr/local/lib/python3.12/http/client.py", line 1314, in endheaders
2023-11-29 21:47:13     self._send_output(message_body, encode_chunked=encode_chunked)
2023-11-29 21:47:13   File "/usr/local/lib/python3.12/http/client.py", line 1074, in _send_output
2023-11-29 21:47:13     self.send(msg)
2023-11-29 21:47:13   File "/usr/local/lib/python3.12/http/client.py", line 1018, in send
2023-11-29 21:47:13     self.connect()
2023-11-29 21:47:13   File "/usr/local/lib/python3.12/http/client.py", line 1453, in connect
2023-11-29 21:47:13     super().connect()
2023-11-29 21:47:13   File "/usr/local/lib/python3.12/http/client.py", line 984, in connect
2023-11-29 21:47:13     self.sock = self._create_connection(
2023-11-29 21:47:13                 ^^^^^^^^^^^^^^^^^^^^^^^^
2023-11-29 21:47:13   File "/usr/local/lib/python3.12/socket.py", line 852, in create_connection
2023-11-29 21:47:13     raise exceptions[0]
2023-11-29 21:47:13   File "/usr/local/lib/python3.12/socket.py", line 837, in create_connection
2023-11-29 21:47:13     sock.connect(sa)
2023-11-29 21:47:13 OSError: [Errno 99] Cannot assign requested address
2023-11-29 21:47:13 
2023-11-29 21:47:13 During handling of the above exception, another exception occurred:
mietzen commented 9 months ago

You are trying to resolve a IPv6 address from a Docker container which probably only has ipv4. You can set IPV4_ONLY: "True" to resolve this, but I'll also try to release a new version that catches this error.

Sparkrdom commented 9 months ago

Ahh, interesting. I assumed since those were commented out that they were optional.

mietzen commented 9 months ago

I'll fix that in the readme 👍 , since most folks don't have ipv6 configured in docker

mietzen commented 9 months ago

It was a dump interface, it is now deprecated.

In newer versions it will be IPv4 true by default:

      # IPV4: "TRUE" # Set IPv4 address
      # IPV6: "FALSE" # Set IPv6 address

The old interface will be dropped at some point.

mietzen commented 9 months ago

I just merged and released the changes: https://github.com/mietzen/porkbun-ddns/releases/tag/v0.5.0, it's currently building the images.