Alpine Linux Docker container - "GeoIP Unavailable" error

General support for problems installing or using Deluge
Post Reply
boredazfcuk
Member
Member
Posts: 22
Joined: Sun Jun 16, 2019 10:08 pm

Alpine Linux Docker container - "GeoIP Unavailable" error

Post by boredazfcuk »

Hi,

I'm trying to get Deluge working in an Alpine Linux Docker container. I've pretty much got it all working except for the GeoIP IP lookups. When my container launches, I just get 'GeoIP Unavailable'.

I found this commit: https://git.deluge-torrent.org/deluge/c ... 805afcfc33

which has the following code:

Code: Select all

+        deluge_geoip_db = deluge.common.resource_filename("deluge", os.path.join("data", "GeoIP.dat"))
+        for geoip_path in (geoip_db, deluge_geoip_db):
+            if os.path.exists(geoip_path):
+                try:
+                    self.core.geoip_instance = GeoIP.open(geoip_path, GeoIP.GEOIP_STANDARD)
+                except AttributeError:
+                    log.warning("GeoIP Unavailable")
+                break
         else:
So I guess I'm hitting the AttributeError for some reason. Could it be a dependency issue which isn't fulfilled? I've enabled debug level logging, but that didn't give me any clues either.

I've tried installing the following Alpine packages: geoip py-geoip, py2-geoip, py3-geoip but none of them make a difference. I've also tried installing pip and pip install python-geoip but that didn't work either.

This is the dockerfile I've created: https://pastebin.com/5AYj95F9

Can anyone give me any pointers as to what it may be? I'm truly stumped at this point.

Thanks,

bored.
Cas
Top Bloke
Top Bloke
Posts: 3679
Joined: Mon Dec 07, 2009 6:04 am
Location: Scotland

Re: Alpine Linux Docker container - "GeoIP Unavailable" error

Post by Cas »

It seems that Alpine package py3-geoip is not the maxmind python package but you can try:

Code: Select all

pip install GeoIP
Created a ticket for compatibility: https://dev.deluge-torrent.org/ticket/3271
boredazfcuk
Member
Member
Posts: 22
Joined: Sun Jun 16, 2019 10:08 pm

Re: Alpine Linux Docker container - "GeoIP Unavailable" error

Post by boredazfcuk »

Thanks for the help. Still no joy unfortunately though.

I tried 'pip install geoip' but it required python2-dev and geoip-dev installing to successfully compile. It still didn't work so presumably it's an interoperability issue.

I then tried patching preferencesmanager.py with the diff, but now the daemon crashes on launch:

Code: Select all

Traceback (most recent call last):
  File "/usr/bin/deluged", line 11, in <module>
    load_entry_point('deluge==2.0.3', 'console_scripts', 'deluged')()
  File "/usr/lib/python3.7/site-packages/deluge-2.0.3-py3.7.egg/deluge/core/daemon_entry.py", line 90, in start_daemon
    from deluge.core.daemon import is_daemon_running
  File "/usr/lib/python3.7/site-packages/deluge-2.0.3-py3.7.egg/deluge/core/daemon.py", line 22, in <module>
    from deluge.core.core import Core
  File "/usr/lib/python3.7/site-packages/deluge-2.0.3-py3.7.egg/deluge/core/core.py", line 41, in <module>
    from deluge.core.preferencesmanager import PreferencesManager
  File "/usr/lib/python3.7/site-packages/deluge-2.0.3-py3.7.egg/deluge/core/preferencesmanager.py", line 34
    ImportError:
               ^
SyntaxError: invalid syntax
Cas
Top Bloke
Top Bloke
Posts: 3679
Joined: Mon Dec 07, 2009 6:04 am
Location: Scotland

Re: Alpine Linux Docker container - "GeoIP Unavailable" error

Post by Cas »

Ok two mistakes by myself, I have fixed the ticket diff and it should be pip3 install GeoIP or python3 -m pip install GeoIP
boredazfcuk
Member
Member
Posts: 22
Joined: Sun Jun 16, 2019 10:08 pm

Re: Alpine Linux Docker container - "GeoIP Unavailable" error

Post by boredazfcuk »

Fantastic! That's nailed it. Thank you.

Here's the dockerfile for anyone who wants it: https://pastebin.com/5v4JzuBV
boredazfcuk
Member
Member
Posts: 22
Joined: Sun Jun 16, 2019 10:08 pm

Re: Alpine Linux Docker container - "GeoIP Unavailable" error

Post by boredazfcuk »

Just to update, I've actually managed to get this working without applying the diff.

If I install both the Alpine:3.10 geoip package and the pip3 geoip package then it works as expected. Either one will not work on their own.

My docker file is a fair bit smaller now: https://pastebin.com/TQ3g3n5j
Post Reply