This commit is contained in:
Simon Bruder 2020-06-03 21:17:17 +02:00
commit 31332d5561
No known key found for this signature in database
GPG key ID: 6F03E0000CC5B62F
9 changed files with 125 additions and 0 deletions

25
.drone.yml Normal file
View file

@ -0,0 +1,25 @@
kind: pipeline
name: default
steps:
- name: deluge
image: plugins/docker
settings:
registry: r.sbruder.de
username:
from_secret: docker_username
password:
from_secret: docker_password
repo: r.sbruder.de/deluge
- name: http-socket
image: plugins/docker
settings:
registry: r.sbruder.de
username:
from_secret: docker_username
password:
from_secret: docker_password
context: http-socket
dockerfile: http-socket/Dockerfile
repo: r.sbruder.de/http-socket

28
Dockerfile Normal file
View file

@ -0,0 +1,28 @@
FROM debian:testing-slim
RUN apt-get update \
&& apt-get -y install --no-install-recommends runit \
&& apt-get -y install \
deluge-console \
deluge-web \
deluged \
git \
gosu \
nginx-light \
python3-pip \
tini
RUN pip3 install --no-cache-dir \
deluge-client \
prometheus_client
RUN git clone --depth=1 https://github.com/sbruder/deluge_exporter /opt/deluge_exporter
COPY services /etc/service
COPY nginx.conf /etc/nginx/
COPY entrypoint.sh /usr/local/bin/
ENV PER_TORRENT_METRICS 1
ENV PUID 1000
ENTRYPOINT ["entrypoint.sh"]

5
entrypoint.sh Executable file
View file

@ -0,0 +1,5 @@
#!/bin/sh
set -u
adduser -q --gecos '' --disabled-password --uid $PUID deluge
chown deluge:deluge /download/ /config/
exec tini -- runsvdir /etc/service/

9
http-socket/Dockerfile Normal file
View file

@ -0,0 +1,9 @@
FROM alpine
RUN apk add --no-cache \
socat \
tini
EXPOSE 80
ENTRYPOINT ["tini", "--", "socat", "TCP-LISTEN:80,reuseaddr,fork,su=nobody", "UNIX-CLIENT:/var/run/nginx.sock"]

50
nginx.conf Normal file
View file

@ -0,0 +1,50 @@
# vim: set et sts=4 sw=4 ts=4:
user www-data;
worker_processes auto;
pid /run/nginx.pid;
error_log /dev/stderr warn;
events {
worker_connections 768;
}
http {
sendfile on;
tcp_nopush on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_tokens off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
server {
listen unix:/var/run/nginx.sock;
server_name localhost;
location / {
proxy_pass http://127.0.0.1:8112/;
add_header X-Frame-Options SAMEORIGIN;
# this is NOT authentication (it is in a public git repository
# after all), it is only meant to avoid automatic scans
if ($cookie_preauth != "correct horse battery staple") {
return 404;
}
}
location /download/ {
alias /download/;
autoindex on;
auth_basic "go away";
auth_basic_user_file /config/htpasswd;
}
location /metrics {
proxy_pass http://localhost:9354/metrics;
auth_basic "go away";
auth_basic_user_file /config/htpasswd;
}
}
}

2
services/deluge-web/run Executable file
View file

@ -0,0 +1,2 @@
#!/bin/sh
gosu deluge deluge-web -d -c /config

2
services/deluge_exporter/run Executable file
View file

@ -0,0 +1,2 @@
#!/bin/sh
DELUGE_CONFIG_DIR=/config/ gosu deluge /opt/deluge_exporter/deluge_exporter.py

2
services/deluged/run Executable file
View file

@ -0,0 +1,2 @@
#!/bin/sh
gosu deluge deluged -d -c /config

2
services/nginx/run Executable file
View file

@ -0,0 +1,2 @@
#!/bin/sh
nginx -g 'daemon off;'