Skip to content

Commit

Permalink
Merge branch 'release/1.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
datashaman committed Mar 6, 2017
2 parents 911c170 + f9abf8f commit b9b330e
Show file tree
Hide file tree
Showing 40 changed files with 1,177 additions and 445 deletions.
2 changes: 2 additions & 0 deletions .env.dist
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
PUTIO_TOKEN=personal_oauth_token

workon putio-automator
10 changes: 6 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
*pyc

application.db
application.log
/application.db
/application.log
/AUTHORS
/build/
/ChangeLog
/config.py
/dist/
/.eggs/
/.env
/putio_automator.egg-info/
/*.egg-info/
/README.rst
/tmp/
37 changes: 25 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,39 @@
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 \
&& apt-get install -y --no-install-recommends \
cron \
python-pip \
python-pkg-resources \
rsyslog \
sendmail \
smbclient \
&& rm -rf /var/lib/apt/lists/*

RUN mkdir -p \
/app/logs /app/run \
/etc/auto.master.d \
/files/incomplete /files/downloads /files/torrents \
&& touch /app/run/app.db \
&& chown -R www-data /app/run /files
/var/www \
/var/log/putio-automator \
/var/log/supervisor \
&& chown -R www-data /files /var/www \
&& usermod -u 1000 www-data

COPY app.py manage.py README.md requirements.txt /app/src/
COPY etc/config.py.dist /usr/local/share/putio-automator/config.py
COPY etc/cron /etc/cron.d/putio-automator
COPY etc/rsyslog.conf /etc/rsyslog.conf
COPY etc/supervisor.conf /etc/supervisor/conf.d/putio-automator.conf
COPY etc/supervisord.conf /etc/supervisor/supervisord.conf

RUN cd /app/src \
&& pip install -U pip \
&& pip install -r requirements.txt
RUN chmod go= /etc/cron.d/putio-automator

COPY etc/supervisor /etc/supervisor/
COPY etc/config.py /app/src/
RUN pip install putio-automator==0.4.2.dev79 \
&& rm -rf $HOME/.cache /tmp/pip_build_root

VOLUME ["/files/incomplete", "/files/downloads", "/files/torrents"]
ENV INITSYSTEM on

EXPOSE 9001

CMD [ "supervisord", "-n", "-c", "/etc/supervisor/supervisord.conf", "--logfile", "/dev/stdout", "--logfile_maxbytes", "0" ]
ENTRYPOINT [ "putio" ]

CMD [ "docker", "bootstrap" ]
47 changes: 47 additions & 0 deletions Dockerfile.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
FROM debian:jessie-slim

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
cron \
git-core \
kmod \
python-pip \
python-pkg-resources \
rsyslog \
sendmail \
smbclient \
udev \
&& rm -rf /var/lib/apt/lists/*

RUN mkdir -p \
/etc/auto.master.d \
/files/incomplete /files/downloads /files/torrents \
/var/www \
/var/log/putio-automator \
/var/log/supervisor \
&& chown -R www-data /files /var/www \
&& usermod -u 1000 www-data

WORKDIR /app

COPY . ./

COPY etc/config.py.dist /usr/local/share/putio-automator/config.py
COPY etc/cron /etc/cron.d/putio-automator
COPY etc/rsyslog.conf /etc/rsyslog.conf
COPY etc/supervisor.conf /etc/supervisor/conf.d/putio-automator.conf
COPY etc/supervisord.conf /etc/supervisor/supervisord.conf

RUN chmod go= /etc/cron.d/putio-automator

RUN pip install -U pip setuptools \
&& pip install . \
&& rm -rf $HOME/.cache /tmp/pip_build_root

ENV INITSYSTEM on

EXPOSE 9001

ENTRYPOINT [ "putio" ]

CMD [ "docker", "bootstrap" ]
40 changes: 40 additions & 0 deletions Dockerfile.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
FROM resin/%%RESIN_MACHINE_NAME%%-python:slim

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
cifs-utils \
cron \
python-pip \
python-setuptools \
rsyslog \
sendmail \
smbclient \
&& rm -rf /var/lib/apt/lists/*

RUN mkdir -p \
/etc/auto.master.d \
/files/incomplete /files/downloads /files/torrents \
/var/www \
/var/log/putio-automator \
/var/log/supervisor \
&& chown -R www-data /files /var/www \
&& usermod -u 1000 www-data

COPY etc/rsyslog.conf /etc/rsyslog.conf
COPY etc/supervisor.conf-rpi /etc/supervisor/conf.d/putio-automator.conf
COPY etc/supervisord.conf /etc/supervisor/supervisord.conf
COPY etc/config.py.dist-rpi /usr/local/share/putio-automator/config.py
COPY etc/cron /etc/cron.d/putio-automator
COPY etc/fstab /etc/fstab

RUN chmod go= /etc/cron.d/putio-automator

RUN pip install -U pip setuptools \
&& pip install putio-automator==0.4.2.dev79 \
&& rm -rf $HOME/.cache /tmp/pip_build_root

ENV INITSYSTEM on

ENTRYPOINT [ "putio" ]

CMD [ "docker", "bootstrap" ]
43 changes: 37 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,59 @@ HOST_INCOMPLETE = `pwd`/tmp/incomplete
HOST_TORRENTS = `pwd`/tmp/torrents

clean:
python setup.py clean
find . -name '*.pyc' -delete
rm -rf build dist .eggs putio_automator.egg-info sdist tmp/*/*

restart-watcher:
sudo supervisorctl restart watcher

docker-build:
docker build -t $(TAG) .

docker-run:
docker run --rm -it \
--privileged \
-e CHECK_DOWNLOADS_EVERY=2 \
-e LOG_LEVEL=DEBUG \
-e PUTIO_TOKEN=$(PUTIO_TOKEN) \
-p 9001:9001 \
-v $(HOST_INCOMPLETE):/files/incomplete \
-e DOWNLOADS=/files/downloads \
-e INCOMPLETE=/files/incomplete \
-e TORRENTS=/files/torrents \
-p 9001:80 \
-v $(HOST_DOWNLOADS):/files/downloads \
-v $(HOST_INCOMPLETE):/files/incomplete \
-v $(HOST_TORRENTS):/files/torrents \
$(TAG)

docker-bash:
docker run --rm -it \
-e PUTIO_TOKEN=$(PUTIO_TOKEN) \
-p 9001:9001 \
-p 9001:80 \
-v $(HOST_INCOMPLETE):/files/incomplete \
-v $(HOST_DOWNLOADS):/files/downloads \
-v $(HOST_TORRENTS):/files/torrents \
$(TAG) /bin/bash

docker-push:
docker push $(TAG)

docker-prune-stopped:
docker ps -a -q | xargs -r docker rm

docker-prune-untagged:
docker images | grep '^<none>' | awk '{print $$3}' | xargs -r docker rmi

docker-prune: docker-prune-stopped docker-prune-untagged

# npm i -g marked-toc --save
# apt install pandoc
readme-generate:
toc
cat -s README.md > /tmp/readme && mv /tmp/readme README.md
pandoc -f markdown -t rst README.md > README.rst
sed -i '/.. raw:: html/,+3d' README.rst

prepare-upload: clean
python setup.py sdist
python setup.py bdist_wheel

upload: prepare-upload
twine upload dist/*
Loading

0 comments on commit b9b330e

Please sign in to comment.