-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
165 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
PUTIO_TOKEN=personal_oauth_token |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
|
||
application.db | ||
application.log | ||
config.py | ||
supervisor.log | ||
supervisor.log.* | ||
tmp/ | ||
/config.py | ||
/.env | ||
/tmp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
FROM debian:jessie-slim | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends build-essential python2.7 python2.7-dev python-pip supervisor \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN mkdir -p \ | ||
/app/logs /app/run \ | ||
/files/incomplete /files/downloads /files/torrents \ | ||
&& touch /app/run/app.db \ | ||
&& chown -R www-data /app/run /files | ||
|
||
COPY app.py manage.py README.md requirements.txt /app/src/ | ||
|
||
RUN cd /app/src \ | ||
&& pip install -U pip \ | ||
&& pip install -r requirements.txt | ||
|
||
COPY etc/supervisor /etc/supervisor/ | ||
COPY etc/config.py /app/src/ | ||
|
||
VOLUME ["/files/incomplete", "/files/downloads", "/files/torrents"] | ||
|
||
EXPOSE 9001 | ||
|
||
CMD [ "supervisord", "-n", "-c", "/etc/supervisor/supervisord.conf", "--logfile", "/dev/stdout", "--logfile_maxbytes", "0" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,32 @@ | ||
TAG = datashaman/putio-automator | ||
|
||
HOST_DOWNLOADS = `pwd`/tmp/downloads | ||
HOST_INCOMPLETE = `pwd`/tmp/incomplete | ||
HOST_TORRENTS = `pwd`/tmp/torrents | ||
|
||
clean: | ||
find . -name '*.pyc' -delete | ||
|
||
restart-watcher: | ||
sudo supervisorctl restart watcher | ||
sudo supervisorctl restart watcher | ||
|
||
docker-build: | ||
docker build -t $(TAG) . | ||
|
||
docker-run: | ||
docker run --rm -it \ | ||
-e PUTIO_TOKEN=$(PUTIO_TOKEN) \ | ||
-p 9001:9001 \ | ||
-v $(HOST_INCOMPLETE):/files/incomplete \ | ||
-v $(HOST_DOWNLOADS):/files/downloads \ | ||
-v $(HOST_TORRENTS):/files/torrents \ | ||
$(TAG) | ||
|
||
docker-bash: | ||
docker run --rm -it \ | ||
-e PUTIO_TOKEN=$(PUTIO_TOKEN) \ | ||
-p 9001:9001 \ | ||
-v $(HOST_INCOMPLETE):/files/incomplete \ | ||
-v $(HOST_DOWNLOADS):/files/downloads \ | ||
-v $(HOST_TORRENTS):/files/torrents \ | ||
$(TAG) /bin/bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,21 @@ | ||
import logging | ||
import os | ||
|
||
from dotenv import load_dotenv | ||
|
||
BASE_DIR = os.path.abspath(os.path.dirname(__file__)) | ||
|
||
dotenv_path = os.path.join(BASE_DIR, '.env') | ||
if os.path.isfile(dotenv_path): | ||
load_dotenv(dotenv_path) | ||
|
||
DATABASE = 'application.db' | ||
LOG_FILENAME = None | ||
LOG_LEVEL = logging.WARNING | ||
PUTIO_TOKEN = 'TOKEN' | ||
INCOMPLETE = '/somefolder/Incomplete' | ||
TORRENTS = '/somefolder/Torrents' | ||
DOWNLOADS = '/somefolder/Downloads' | ||
LOG_LEVEL = os.getenv('LOG_LEVEL', 'WARNING') | ||
PUTIO_TOKEN = os.getenv('PUTIO_TOKEN') | ||
|
||
DOWNLOADS = '/data/downloads' | ||
INCOMPLETE = '/data/incomplete' | ||
TORRENTS = '/data/torrents' | ||
|
||
UPNP_PORT = 42000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import logging | ||
import os | ||
|
||
DATABASE = '/app/run/app.db' | ||
LOG_FILENAME = None | ||
LOG_LEVEL = os.getenv('LOG_LEVEL') | ||
|
||
PUTIO_TOKEN = os.getenv('PUTIO_TOKEN') | ||
|
||
DOWNLOADS = '/files/downloads' | ||
INCOMPLETE = '/files/incomplete' | ||
TORRENTS = '/files/torrents' | ||
|
||
UPNP_PORT = 42000 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[program:watcher] | ||
user=www-data | ||
directory=/app/src | ||
command=python manage.py torrents_watch | ||
environment=PUTIO_TOKEN="%(ENV_PUTIO_TOKEN)s" | ||
autostart=true | ||
autorestart=false | ||
redirect_stderr=true | ||
stopasgroup=true | ||
stdout_logfile=/app/logs/app.log | ||
|
||
[program:downloader] | ||
user=www-data | ||
directory=/app/src | ||
command=python manage.py files_download | ||
environment=PUTIO_TOKEN="%(ENV_PUTIO_TOKEN)s" | ||
autostart=false | ||
autorestart=unexpected | ||
redirect_stderr=true | ||
stopasgroup=true | ||
stdout_logfile=/app/logs/app.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
[unix_http_server] | ||
file=/app/run/supervisord.sock ; (the path to the socket file) | ||
chmod=0700 ; sockef file mode (default 0700) | ||
|
||
[inet_http_server] | ||
port=9001 | ||
|
||
[supervisord] | ||
nodaemon=true | ||
loglevel=warn | ||
logfile=/dev/stdout | ||
logfile_maxbytes=0 | ||
pidfile=/app/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid) | ||
|
||
; the below section must remain in the config file for RPC | ||
; (supervisorctl/web interface) to work, additional interfaces may be | ||
; added by defining them in separate rpcinterface: sections | ||
[rpcinterface:supervisor] | ||
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface | ||
|
||
[supervisorctl] | ||
serverurl=unix:///app/run/supervisord.sock ; use a unix:// URL for a unix socket | ||
|
||
; The [include] section can just contain the "files" setting. This | ||
; setting can list multiple files (separated by whitespace or | ||
; newlines). It can also contain wildcards. The filenames are | ||
; interpreted as relative to this file. Included files *cannot* | ||
; include files themselves. | ||
|
||
[include] | ||
files = /etc/supervisor/conf.d/*.conf | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters