Browse Source

dockerified

master
Robin Thoni 4 years ago
parent
commit
49f0d5ec68
Signed by: Robin THONI <robin@rthoni.com> GPG Key ID: 4E09DEF46B99E61E

+ 0
- 1
.gitignore View File

@@ -1,5 +1,4 @@
1 1
 # Byte-compiled / optimized / DLL files
2
-config.conf
3 2
 __pycache__/
4 3
 *.py[cod]
5 4
 *$py.class

+ 10
- 0
docker-compose.yml View File

@@ -0,0 +1,10 @@
1
+version: '2'
2
+
3
+services:
4
+    fake-tracker:
5
+        build: ./fake-tracker
6
+        container_name: fake-tracker-fake-tracker
7
+#        restart: unless-stopped
8
+        volumes:
9
+          - ./data/fake-tracker/torrents:/var/lib/fake-tracker/torrents
10
+

+ 16
- 0
fake-tracker/Dockerfile View File

@@ -0,0 +1,16 @@
1
+FROM python:2.7-stretch
2
+
3
+#RUN apt-get update &&\
4
+#    apt-get install -yq --no-install-recommends python2 python-pip &&\
5
+#    apt-get clean &&\
6
+#    rm -rf /var/lib/apt/lists/*
7
+
8
+#RUN pip2 install setuptools
9
+
10
+COPY ./src/ /usr/local/share/fake-tracker/
11
+
12
+RUN pip2 install -r /usr/local/share/fake-tracker/requirements.txt
13
+
14
+COPY ./config/config.conf /etc/fake-tracker.conf
15
+
16
+CMD ["python2", "-u", "/usr/local/share/fake-tracker/fake-tracker.py", "/etc/fake-tracker.conf"]

+ 4
- 0
fake-tracker/config/config.conf View File

@@ -0,0 +1,4 @@
1
+[General]
2
+maxRatio: 1
3
+maxRate: 512
4
+torrentsPath: /var/lib/fake-tracker/torrents/

change-tracker.py → fake-tracker/src/change-tracker.py View File


config.inc.conf → fake-tracker/src/config.inc.conf View File


config.py → fake-tracker/src/config.py View File


display-torrent.py → fake-tracker/src/display-torrent.py View File


fake-tracker.py → fake-tracker/src/fake-tracker.py View File

@@ -35,9 +35,9 @@ while run:
35 35
         torrent = torrentfile.TorrentFile()
36 36
         try:
37 37
             torrent.readFile(file)
38
-        except:
38
+        except Exception as e:
39 39
             os.remove(file)
40
-            warning("could not load", file)
40
+            warning("could not load", file, e)
41 41
 
42 42
         try:
43 43
             if not any(x.getName() == torrent.getName()
@@ -45,8 +45,8 @@ while run:
45 45
                 torrent.getTracker().start()
46 46
                 debug("started", torrent.getName())
47 47
                 manager.appendTorrent(torrent)
48
-        except:
49
-            warning("could not start", torrent.getName())
48
+        except Exception as e:
49
+            warning("could not start", torrent.getName(), e)
50 50
 
51 51
     count = len(manager.getTorrents())
52 52
 

requirements.txt → fake-tracker/src/requirements.txt View File


torrententry.py → fake-tracker/src/torrententry.py View File


torrentfile.py → fake-tracker/src/torrentfile.py View File


torrentmanager.py → fake-tracker/src/torrentmanager.py View File


torrenttracker.py → fake-tracker/src/torrenttracker.py View File


Loading…
Cancel
Save