From e842cbafe183da7b848235d5b29c249f14430649 Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Fri, 19 Apr 2019 17:17:09 +0000 Subject: [PATCH] init --- .drone.yml | 13 +++++++++++++ Dockerfile | 25 +++++++++++++++++++++++++ configuration.js | 37 +++++++++++++++++++++++++++++++++++++ entrypoint.sh | 16 ++++++++++++++++ nginx.conf | 22 ++++++++++++++++++++++ 5 files changed, 113 insertions(+) create mode 100644 .drone.yml create mode 100644 Dockerfile create mode 100644 configuration.js create mode 100755 entrypoint.sh create mode 100644 nginx.conf diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..6a330d5 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,13 @@ +kind: pipeline +name: default + +steps: + - name: docker + image: plugins/docker + settings: + registry: r.sbruder.de + username: + from_secret: docker_username + password: + from_secret: docker_password + repo: r.sbruder.de/aria2 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b7a7727 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +FROM node as webui + +RUN git clone --depth=1 https://github.com/ziahamza/webui-aria2 + +WORKDIR /webui-aria2 + +RUN npm install +COPY configuration.js /webui-aria2/src/js/services/configuration.js +RUN npm run-script build + +FROM alpine + +RUN apk add --no-cache \ + aria2 \ + nginx \ + su-exec + +COPY --from=webui /webui-aria2/docs /srv/www/webui + +COPY --from=nginx:alpine /etc/nginx/nginx.conf /etc/nginx/nginx.conf +COPY nginx.conf /etc/nginx/conf.d/default.conf + +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/configuration.js b/configuration.js new file mode 100644 index 0000000..48a415d --- /dev/null +++ b/configuration.js @@ -0,0 +1,37 @@ +import angular from "angular"; + +export default angular + .module("webui.services.configuration", []) + .constant("$name", "Aria2 WebUI") + .constant("$titlePattern", "active: {active} - waiting: {waiting} - stopped: {stopped} — {name}") + .constant("$pageSize", 11) + .constant("$authconf", { + host: location.hostname, + path: "/jsonrpc", + port: location.protocol === 'https:' ? 443 : 80, + encrypt: location.protocol === 'https:', + directURL: "/download/" + }) + .constant("$enable", { + torrent: true, + metalink: true, + sidebar: { + show: true, + stats: true, + filters: true, + starredProps: true + } + }) + .constant("$starredProps", [ + "max-overall-download-limit", + "max-overall-upload-limit" + ]) + .constant("$downloadProps", [ + "header", + "http-user", + "http-passwd", + "pause", + "dir", + "max-connection-per-server" + ]) + .constant("$globalTimeout", 1000).name; diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..b476f30 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,16 @@ +#!/bin/ash +nginx + +touch /data/torrents +chown $UID /data/torrents + +su-exec $UID aria2c \ + --enable-rpc \ + --bt-save-metadata \ + --bt-load-saved-metadata \ + --force-save \ + --summary-interval=0 \ + --seed-ratio=0 \ + --dir /data/ \ + --save-session /data/torrents \ + -i /data/torrents diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..d2e49a2 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,22 @@ +server { + listen 80; + server_name localhost; + + root /srv/www/webui/; + + location / { + index index.html; + } + + location /download/ { + alias /data/; + autoindex on; + } + + location /jsonrpc { + proxy_pass http://localhost:6800/jsonrpc; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + } +}