mirror of
https://github.com/wahyd4/aria2-ariang-docker.git
synced 2026-08-09 05:15:55 +10:00
Compare commits
98
Commits
heroku
...
docker-revise
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f7912556ad | ||
|
|
b22a36cb0d | ||
|
|
d19aee4d38 | ||
|
|
4a0bb9446f | ||
|
|
85e11866c1 | ||
|
|
9a74f672b0 | ||
|
|
e308b67902 | ||
|
|
9ac63aef85 | ||
|
|
4c2cb0ddaf | ||
|
|
e3beaca19e | ||
|
|
9fb6123520 | ||
|
|
4394fde881 | ||
|
|
21fbcad568 | ||
|
|
60a5a77193 | ||
|
|
99c036f46c | ||
|
|
ea0dbb9e14 | ||
|
|
3b41b6d1e2 | ||
|
|
1a16f7195d | ||
|
|
3e39cacc35 | ||
|
|
6c3caac687 | ||
|
|
f400b16be3 | ||
|
|
8fbc2bb854 | ||
|
|
e1c398c9d3 | ||
|
|
c3a5fda0a7 | ||
|
|
a6c4ab584d | ||
|
|
c81da61cec | ||
|
|
1e6c8855da | ||
|
|
7597acf095 | ||
|
|
2f63249629 | ||
|
|
b07e1388a4 | ||
|
|
197b0a433f | ||
|
|
437436e9c0 | ||
|
|
ec008b29bd | ||
|
|
014bb638f3 | ||
|
|
fab62224f7 | ||
|
|
3cf974c98c | ||
|
|
0610f47717 | ||
|
|
5d4656db63 | ||
|
|
311696caa1 | ||
|
|
e3cfdf6f68 | ||
|
|
58886cfc13 | ||
|
|
dc9238fc7d | ||
|
|
8488801ec6 | ||
|
|
ce31e13a61 | ||
|
|
fc572ada3e | ||
|
|
654f8f4b3d | ||
|
|
2196929d63 | ||
|
|
e703dd4338 | ||
|
|
ece987ec60 | ||
|
|
ff8a474b6d | ||
|
|
b6c155207d | ||
|
|
46fd0a842f | ||
|
|
a20300c9ea | ||
|
|
86252c1961 | ||
|
|
6493c7cc19 | ||
|
|
1bd477d89e | ||
|
|
337511813d | ||
|
|
c4a5f82641 | ||
|
|
c2adb8c41e | ||
|
|
ff54b5b92c | ||
|
|
c47b5d19e6 | ||
|
|
5108254f44 | ||
|
|
d12c6f7ea2 | ||
|
|
aa1db00ca1 | ||
|
|
4485fd0437 | ||
|
|
a8db9193f8 | ||
|
|
bc90a2992c | ||
|
|
50512b4183 | ||
|
|
8d1a326a23 | ||
|
|
534b94a31f | ||
|
|
cc16fa5b0b | ||
|
|
76789658e5 | ||
|
|
59c67bad8c | ||
|
|
c2881479a9 | ||
|
|
1f4a331147 | ||
|
|
461f0e9451 | ||
|
|
381e7a760c | ||
|
|
56190aea72 | ||
|
|
42f1317afe | ||
|
|
a6c21b228e | ||
|
|
feb2d5781b | ||
|
|
53985992c6 | ||
|
|
963b4ae8d2 | ||
|
|
9a58c2a12e | ||
|
|
9e3f772174 | ||
|
|
4107956832 | ||
|
|
b29ffe875e | ||
|
|
291c5cb1a5 | ||
|
|
1a424659d0 | ||
|
|
91bb9636ff | ||
|
|
86b5f454cd | ||
|
|
9f469271d8 | ||
|
|
cc4d1466d8 | ||
|
|
8e4de29da2 | ||
|
|
f14a3806cc | ||
|
|
ad97d953fd | ||
|
|
f31b034b18 | ||
|
|
20bf7b07da |
@@ -0,0 +1,11 @@
|
||||
# Reduce build context size
|
||||
.git
|
||||
.gitignore
|
||||
*.md
|
||||
LICENSE
|
||||
*.png
|
||||
*.json
|
||||
heroku.yml
|
||||
k8s-manifest.yaml
|
||||
Dockerfile.optimized
|
||||
.dockerignore
|
||||
@@ -13,6 +13,12 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
-
|
||||
name: Update APP VERSION
|
||||
if: contains(github.ref, '/tags/v')
|
||||
run: |
|
||||
VERSION=${GITHUB_REF#refs/tags/v}
|
||||
echo $VERSION > APP_VERSION
|
||||
-
|
||||
name: Prepare
|
||||
id: prepare
|
||||
@@ -44,7 +50,7 @@ jobs:
|
||||
uses: docker/setup-buildx-action@v1
|
||||
-
|
||||
name: Cache Docker layers
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
id: cache
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
@@ -72,3 +78,25 @@ jobs:
|
||||
if: contains(github.ref, '/heads/master') || contains(github.ref, '/tags/v')
|
||||
run: |
|
||||
docker buildx imagetools inspect ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}
|
||||
-
|
||||
name: Commit changes
|
||||
if: contains(github.ref, '/tags/v')
|
||||
uses: EndBug/add-and-commit@v7
|
||||
with:
|
||||
author_name: junv-repo-bot
|
||||
author_email: me@toozhao.com
|
||||
message: 'Update version'
|
||||
add: 'APP_VERSION'
|
||||
push: true
|
||||
branch: master
|
||||
-
|
||||
name: Update tag
|
||||
if: contains(github.ref, '/tags/v')
|
||||
env:
|
||||
API_KEY: ${{ secrets.BadgeAPIKey }}
|
||||
run: |
|
||||
VERSION=${GITHUB_REF#refs/tags/v}
|
||||
curl --max-time 6 -XPUT -D- 'https://badges.toozhao.com/val/aria2-ui-docker' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H 'API_KEY': ${API_KEY} \
|
||||
-d '{"value": "'${VERSION}'"}' || true
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
6.2.2
|
||||
@@ -1,30 +1,42 @@
|
||||
#{
|
||||
# auto_https off
|
||||
#}
|
||||
|
||||
{$DOMAIN}
|
||||
|
||||
log {
|
||||
level {env.CADDY_LOG_LEVEL}
|
||||
output stderr
|
||||
}
|
||||
|
||||
redir /ui / 301
|
||||
redir /ui/ / 301
|
||||
redir /rclone /rclone/ 301
|
||||
redir /files /files/ 301
|
||||
redir /ro /ro/ 301
|
||||
|
||||
reverse_proxy /rpc 127.0.0.1:6800
|
||||
reverse_proxy /jsonrpc 127.0.0.1:6800
|
||||
|
||||
route /rclone/* {
|
||||
uri strip_prefix /rclone
|
||||
reverse_proxy 127.0.0.1:5572
|
||||
uri strip_prefix /rclone
|
||||
reverse_proxy 127.0.0.1:5572
|
||||
}
|
||||
|
||||
route /files/* {
|
||||
uri strip_prefix /files
|
||||
reverse_proxy 127.0.0.1:8080
|
||||
uri strip_prefix /files
|
||||
reverse_proxy 127.0.0.1:8080
|
||||
}
|
||||
|
||||
route /ro/* {
|
||||
uri strip_prefix /ro
|
||||
root * /data
|
||||
file_server {
|
||||
browse "{$CADDY_FILE_SERVER_BROWSE_HTML}"
|
||||
}
|
||||
}
|
||||
|
||||
route /ping {
|
||||
respond "app version: {env.APP_VERSION}"
|
||||
}
|
||||
|
||||
root * /usr/local/www/aria2
|
||||
file_server
|
||||
|
||||
encode gzip
|
||||
log {
|
||||
output stderr
|
||||
}
|
||||
|
||||
+38
-9
@@ -1,4 +1,17 @@
|
||||
FROM alpine:edge
|
||||
FROM golang AS build-forego
|
||||
|
||||
RUN apt update && apt install -y git
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN git clone https://github.com/wahyd4/forego.git \
|
||||
&& cd forego \
|
||||
&& git checkout fix-go-mod \
|
||||
&& go mod download \
|
||||
&& go build -o forego \
|
||||
&& chmod +x forego
|
||||
|
||||
FROM debian:stable-slim
|
||||
|
||||
LABEL AUTHOR=Junv<wahyd4@gmail.com>
|
||||
|
||||
@@ -18,24 +31,40 @@ ENV CADDYPATH=/app
|
||||
ENV RCLONE_CONFIG=/app/conf/rclone.conf
|
||||
ENV XDG_DATA_HOME=/app/.caddy/data
|
||||
ENV XDG_CONFIG_HOME=/app/.caddy/config
|
||||
ENV XDG_CACHE_HOME=/app/.cache
|
||||
ENV RCLONE_CONFIG_BASE64=""
|
||||
ENV ENABLE_APP_CHECKER=true
|
||||
ENV ENABLE_FILEBROWSER=true
|
||||
ENV CADDY_LOG_LEVEL=INFO
|
||||
ENV RCLONE_AUTO_UPLOAD_PROVIDER=
|
||||
ENV RCLONE_AUTO_UPLOAD_REMOTE_PATH=/downloads
|
||||
ENV RCLONE_AUTO_UPLOAD_FILE_MIN_SIZE=1K
|
||||
ENV RCLONE_AUTO_UPLOAD_FILE_MAX_SIZE=100G
|
||||
ENV FIX_DATA_VOLUME_PERMISSIONS=false
|
||||
ENV CADDY_FILE_SERVER_BROWSE_HTML=/app/browse.html
|
||||
|
||||
ADD install.sh aria2c.sh caddy.sh Procfile init.sh start.sh rclone.sh /app/
|
||||
ADD install.sh aria2c.sh caddy.sh filebrowser.sh Procfile init.sh start.sh rclone.sh new-version-checker.sh APP_VERSION /app/
|
||||
ADD conf /app/conf
|
||||
ADD Caddyfile SecureCaddyfile /usr/local/caddy/
|
||||
ADD Caddyfile SecureCaddyfile HerokuCaddyfile /usr/local/caddy/
|
||||
|
||||
COPY --from=build-forego /app/forego/forego /app
|
||||
|
||||
RUN ./install.sh
|
||||
|
||||
RUN rm ./install.sh
|
||||
|
||||
# folder for storing ssl keys
|
||||
VOLUME /app/conf/key
|
||||
# For config files
|
||||
VOLUME /app/conf/
|
||||
|
||||
# file downloading folder
|
||||
# For file downloading
|
||||
VOLUME /data
|
||||
|
||||
EXPOSE 80 443
|
||||
# For rclone cache and aria2 DHT files
|
||||
VOLUME /app/.cache
|
||||
|
||||
HEALTHCHECK --interval=1m --timeout=3s \
|
||||
CMD curl -f http://localhost || exit 1
|
||||
EXPOSE 80 443 6881
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=3s \
|
||||
CMD curl -f http://localhost/ping || exit 1
|
||||
|
||||
CMD ["./start.sh"]
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
# Multi-stage build - Build forego with golang
|
||||
FROM golang:1.21-bullseye AS build-forego
|
||||
|
||||
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN git clone https://github.com/wahyd4/forego.git \
|
||||
&& cd forego \
|
||||
&& git checkout fix-go-mod \
|
||||
&& go mod download \
|
||||
&& CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o forego \
|
||||
&& chmod +x forego
|
||||
|
||||
# Build stage for downloading and preparing binaries
|
||||
FROM debian:stable-slim AS build-deps
|
||||
|
||||
# Set versions - centralized for easy updates
|
||||
ARG CADDY_VERSION=2.9.1
|
||||
ARG FILEBROWSER_VERSION=v2.32.0
|
||||
ARG RCLONE_VERSION=v1.69.1
|
||||
ARG ARIANG_VERSION=1.3.10
|
||||
|
||||
# Install build dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
wget \
|
||||
curl \
|
||||
unzip \
|
||||
tar \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /tmp
|
||||
|
||||
# Detect architecture and download binaries
|
||||
RUN case "$(dpkg --print-architecture)" in \
|
||||
amd64) \
|
||||
PLATFORM=linux-amd64; \
|
||||
CADDY_FILE=caddy_${CADDY_VERSION}_linux_amd64.tar.gz; \
|
||||
RCLONE_FILE=rclone-${RCLONE_VERSION}-linux-amd64.zip; \
|
||||
;; \
|
||||
armhf) \
|
||||
PLATFORM=linux-armv7; \
|
||||
CADDY_FILE=caddy_${CADDY_VERSION}_linux_armv7.tar.gz; \
|
||||
RCLONE_FILE=rclone-${RCLONE_VERSION}-linux-arm-v7.zip; \
|
||||
;; \
|
||||
arm64) \
|
||||
PLATFORM=linux-arm64; \
|
||||
CADDY_FILE=caddy_${CADDY_VERSION}_linux_arm64.tar.gz; \
|
||||
RCLONE_FILE=rclone-${RCLONE_VERSION}-linux-arm64.zip; \
|
||||
;; \
|
||||
*) \
|
||||
echo "[ERROR] unsupported arch $(dpkg --print-architecture), exit now"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac \
|
||||
&& mkdir -p /app/bin /app/www \
|
||||
# Download Caddy
|
||||
&& wget -O caddy.tar.gz "https://github.com/caddyserver/caddy/releases/download/v${CADDY_VERSION}/${CADDY_FILE}" \
|
||||
&& tar -xzf caddy.tar.gz -C /app/bin \
|
||||
# Download Filebrowser
|
||||
&& wget -O filebrowser.tar.gz "https://github.com/filebrowser/filebrowser/releases/download/${FILEBROWSER_VERSION}/${PLATFORM}-filebrowser.tar.gz" \
|
||||
&& tar -xzf filebrowser.tar.gz -C /app/bin \
|
||||
# Download Rclone
|
||||
&& wget -O rclone.zip "https://downloads.rclone.org/${RCLONE_VERSION}/${RCLONE_FILE}" \
|
||||
&& unzip rclone.zip \
|
||||
&& cp rclone-*/rclone /app/bin/ \
|
||||
# Download AriaNg
|
||||
&& wget -O ariang.zip "https://github.com/mayswind/AriaNg/releases/download/${ARIANG_VERSION}/AriaNg-${ARIANG_VERSION}.zip" \
|
||||
&& unzip ariang.zip -d /app/www/aria2 \
|
||||
# Download custom browse.html
|
||||
&& wget -O /app/browse.html "https://raw.githubusercontent.com/glowinthedark/caddy-file-server-browse-extension/39e997c91539d0f04fcce53a3cb6605b2ae9e50c/browse.html" \
|
||||
# Clean up downloads
|
||||
&& rm -rf *.tar.gz *.zip rclone-*
|
||||
|
||||
# Final runtime stage - debian:stable-slim as requested
|
||||
FROM debian:stable-slim
|
||||
|
||||
LABEL AUTHOR=Junv<wahyd4@gmail.com>
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Runtime environment variables
|
||||
ENV RPC_SECRET="" \
|
||||
ENABLE_AUTH=false \
|
||||
ENABLE_RCLONE=true \
|
||||
DOMAIN=:80 \
|
||||
ARIA2_USER=user \
|
||||
ARIA2_PWD=password \
|
||||
ARIA2_SSL=false \
|
||||
ARIA2_EXTERNAL_PORT=80 \
|
||||
PUID=1000 \
|
||||
PGID=1000 \
|
||||
CADDYPATH=/app \
|
||||
RCLONE_CONFIG=/app/conf/rclone.conf \
|
||||
XDG_DATA_HOME=/app/.caddy/data \
|
||||
XDG_CONFIG_HOME=/app/.caddy/config \
|
||||
XDG_CACHE_HOME=/app/.cache \
|
||||
RCLONE_CONFIG_BASE64="" \
|
||||
ENABLE_APP_CHECKER=true \
|
||||
ENABLE_FILEBROWSER=true \
|
||||
CADDY_LOG_LEVEL=INFO \
|
||||
RCLONE_AUTO_UPLOAD_PROVIDER= \
|
||||
RCLONE_AUTO_UPLOAD_REMOTE_PATH=/downloads \
|
||||
RCLONE_AUTO_UPLOAD_FILE_MIN_SIZE=1K \
|
||||
RCLONE_AUTO_UPLOAD_FILE_MAX_SIZE=100G \
|
||||
FIX_DATA_VOLUME_PERMISSIONS=false \
|
||||
CADDY_FILE_SERVER_BROWSE_HTML=/app/browse.html
|
||||
|
||||
# Install only essential runtime dependencies in a single layer
|
||||
RUN apt-get update && apt-get install -y \
|
||||
aria2 \
|
||||
curl \
|
||||
libcap2-bin \
|
||||
runit \
|
||||
&& groupadd -g 1000 junv \
|
||||
&& useradd -u 1000 -g junv -m -s /bin/bash junv \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
# Copy pre-built binaries from build stages
|
||||
COPY --from=build-deps /app/bin/* /usr/local/bin/
|
||||
COPY --from=build-deps /app/www /usr/local/www/
|
||||
COPY --from=build-deps /app/browse.html /app/
|
||||
COPY --from=build-forego /app/forego/forego /app/
|
||||
|
||||
# Copy application files in minimal layers
|
||||
COPY --chmod=755 aria2c.sh caddy.sh filebrowser.sh init.sh start.sh rclone.sh new-version-checker.sh /app/
|
||||
COPY Procfile APP_VERSION /app/
|
||||
COPY conf /app/conf/
|
||||
COPY Caddyfile SecureCaddyfile HerokuCaddyfile /usr/local/caddy/
|
||||
|
||||
# Set up permissions and directories in single layer
|
||||
RUN chmod +x /usr/local/bin/* \
|
||||
&& mkdir -p /usr/local/www/aria2/Download \
|
||||
&& chmod +rw /app/conf/aria2.session \
|
||||
&& chmod -R 755 /usr/local/www/aria2 \
|
||||
&& mkdir -p /data /data/cloud /app/.caddy /app/.cache/aria2 \
|
||||
&& chown -R junv:junv /data /app/.caddy /app/.cache \
|
||||
&& ln -s /data/cloud /app/cloud \
|
||||
&& setcap cap_net_bind_service=+ep /usr/local/bin/caddy
|
||||
|
||||
# Volumes
|
||||
VOLUME ["/app/conf", "/data", "/app/.cache"]
|
||||
|
||||
# Expose ports
|
||||
EXPOSE 80 443 6881
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=3s \
|
||||
CMD curl -f http://localhost/ping || exit 1
|
||||
|
||||
CMD ["./start.sh"]
|
||||
@@ -0,0 +1,158 @@
|
||||
# Multi-stage build - Build forego with golang
|
||||
FROM golang:1.21-alpine AS build-forego
|
||||
|
||||
RUN apk add --no-cache git
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN git clone https://github.com/wahyd4/forego.git \
|
||||
&& cd forego \
|
||||
&& git checkout fix-go-mod \
|
||||
&& go mod download \
|
||||
&& CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o forego \
|
||||
&& chmod +x forego
|
||||
|
||||
# Build stage for downloading and preparing binaries
|
||||
FROM alpine:3.19 AS build-deps
|
||||
|
||||
# Set versions - centralized for easy updates
|
||||
ARG CADDY_VERSION=2.9.1
|
||||
ARG FILEBROWSER_VERSION=v2.32.0
|
||||
ARG RCLONE_VERSION=v1.69.1
|
||||
ARG ARIANG_VERSION=1.3.10
|
||||
|
||||
# Install build dependencies
|
||||
RUN apk add --no-cache \
|
||||
wget \
|
||||
unzip \
|
||||
tar \
|
||||
curl
|
||||
|
||||
WORKDIR /tmp
|
||||
|
||||
# Detect architecture and set platform variables
|
||||
RUN case "$(arch)" in \
|
||||
x86_64) \
|
||||
PLATFORM=linux-amd64; \
|
||||
CADDY_FILE=caddy_${CADDY_VERSION}_linux_amd64.tar.gz; \
|
||||
RCLONE_FILE=rclone-${RCLONE_VERSION}-linux-amd64.zip; \
|
||||
;; \
|
||||
armv7l) \
|
||||
PLATFORM=linux-armv7; \
|
||||
CADDY_FILE=caddy_${CADDY_VERSION}_linux_armv7.tar.gz; \
|
||||
RCLONE_FILE=rclone-${RCLONE_VERSION}-linux-arm-v7.zip; \
|
||||
;; \
|
||||
aarch64) \
|
||||
PLATFORM=linux-arm64; \
|
||||
CADDY_FILE=caddy_${CADDY_VERSION}_linux_arm64.tar.gz; \
|
||||
RCLONE_FILE=rclone-${RCLONE_VERSION}-linux-arm64.zip; \
|
||||
;; \
|
||||
*) \
|
||||
echo "[ERROR] unsupported arch $(arch), exit now"; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac \
|
||||
&& echo "PLATFORM=${PLATFORM}" > /tmp/platform.env \
|
||||
&& echo "CADDY_FILE=${CADDY_FILE}" >> /tmp/platform.env \
|
||||
&& echo "RCLONE_FILE=${RCLONE_FILE}" >> /tmp/platform.env
|
||||
|
||||
# Download and extract binaries
|
||||
RUN . /tmp/platform.env \
|
||||
&& mkdir -p /app/bin /app/www \
|
||||
# Download Caddy
|
||||
&& wget -O caddy.tar.gz "https://github.com/caddyserver/caddy/releases/download/v${CADDY_VERSION}/${CADDY_FILE}" \
|
||||
&& tar -xzf caddy.tar.gz -C /app/bin \
|
||||
# Download Filebrowser
|
||||
&& wget -O filebrowser.tar.gz "https://github.com/filebrowser/filebrowser/releases/download/${FILEBROWSER_VERSION}/${PLATFORM}-filebrowser.tar.gz" \
|
||||
&& tar -xzf filebrowser.tar.gz -C /app/bin \
|
||||
# Download Rclone
|
||||
&& wget -O rclone.zip "https://downloads.rclone.org/${RCLONE_VERSION}/${RCLONE_FILE}" \
|
||||
&& unzip rclone.zip \
|
||||
&& cp rclone-*/rclone /app/bin/ \
|
||||
# Download AriaNg
|
||||
&& wget -O ariang.zip "https://github.com/mayswind/AriaNg/releases/download/${ARIANG_VERSION}/AriaNg-${ARIANG_VERSION}.zip" \
|
||||
&& unzip ariang.zip -d /app/www/aria2 \
|
||||
# Download custom browse.html
|
||||
&& wget -O /app/browse.html "https://raw.githubusercontent.com/glowinthedark/caddy-file-server-browse-extension/39e997c91539d0f04fcce53a3cb6605b2ae9e50c/browse.html" \
|
||||
# Clean up
|
||||
&& rm -rf *.tar.gz *.zip rclone-*
|
||||
|
||||
# Final runtime stage - use Alpine for minimal size
|
||||
FROM alpine:3.19
|
||||
|
||||
LABEL AUTHOR=Junv<wahyd4@gmail.com>
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Runtime environment variables
|
||||
ENV RPC_SECRET="" \
|
||||
ENABLE_AUTH=false \
|
||||
ENABLE_RCLONE=true \
|
||||
DOMAIN=:80 \
|
||||
ARIA2_USER=user \
|
||||
ARIA2_PWD=password \
|
||||
ARIA2_SSL=false \
|
||||
ARIA2_EXTERNAL_PORT=80 \
|
||||
PUID=1000 \
|
||||
PGID=1000 \
|
||||
CADDYPATH=/app \
|
||||
RCLONE_CONFIG=/app/conf/rclone.conf \
|
||||
XDG_DATA_HOME=/app/.caddy/data \
|
||||
XDG_CONFIG_HOME=/app/.caddy/config \
|
||||
XDG_CACHE_HOME=/app/.cache \
|
||||
RCLONE_CONFIG_BASE64="" \
|
||||
ENABLE_APP_CHECKER=true \
|
||||
ENABLE_FILEBROWSER=true \
|
||||
CADDY_LOG_LEVEL=INFO \
|
||||
RCLONE_AUTO_UPLOAD_PROVIDER= \
|
||||
RCLONE_AUTO_UPLOAD_REMOTE_PATH=/downloads \
|
||||
RCLONE_AUTO_UPLOAD_FILE_MIN_SIZE=1K \
|
||||
RCLONE_AUTO_UPLOAD_FILE_MAX_SIZE=100G \
|
||||
FIX_DATA_VOLUME_PERMISSIONS=false \
|
||||
CADDY_FILE_SERVER_BROWSE_HTML=/app/browse.html
|
||||
|
||||
# Install runtime dependencies
|
||||
RUN apk add --no-cache \
|
||||
aria2 \
|
||||
curl \
|
||||
bash \
|
||||
libcap \
|
||||
runit \
|
||||
shadow \
|
||||
&& addgroup -g 1000 junv \
|
||||
&& adduser -D -u 1000 -G junv -s /bin/bash junv \
|
||||
&& rm -rf /var/cache/apk/*
|
||||
|
||||
# Copy pre-built binaries from build stage
|
||||
COPY --from=build-deps /app/bin/* /usr/local/bin/
|
||||
COPY --from=build-deps /app/www /usr/local/www/
|
||||
COPY --from=build-deps /app/browse.html /app/
|
||||
COPY --from=build-forego /app/forego/forego /app/
|
||||
|
||||
# Copy application files
|
||||
COPY --chmod=755 aria2c.sh caddy.sh filebrowser.sh init.sh start.sh rclone.sh new-version-checker.sh /app/
|
||||
COPY Procfile APP_VERSION /app/
|
||||
COPY conf /app/conf/
|
||||
COPY Caddyfile SecureCaddyfile HerokuCaddyfile /usr/local/caddy/
|
||||
|
||||
# Set up permissions and directories
|
||||
RUN chmod +x /usr/local/bin/* \
|
||||
&& mkdir -p /usr/local/www/aria2/Download \
|
||||
&& chmod +rw /app/conf/aria2.session \
|
||||
&& chmod -R 755 /usr/local/www/aria2 \
|
||||
&& mkdir -p /data /data/cloud /app/.caddy /app/.cache/aria2 \
|
||||
&& chown -R junv:junv /data /app/.caddy /app/.cache \
|
||||
&& ln -s /data/cloud /app/cloud \
|
||||
&& setcap cap_net_bind_service=+ep /usr/local/bin/caddy
|
||||
|
||||
# Volumes
|
||||
VOLUME ["/app/conf", "/data", "/app/.cache"]
|
||||
|
||||
# Expose ports
|
||||
EXPOSE 80 443 6881
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=3s \
|
||||
CMD curl -f http://localhost/ping || exit 1
|
||||
|
||||
CMD ["./start.sh"]
|
||||
@@ -0,0 +1,50 @@
|
||||
{
|
||||
admin off
|
||||
auto_https off
|
||||
}
|
||||
|
||||
:PORT
|
||||
|
||||
@protected path / /index.html /css/* /js/* /ro /ro/* /jsonrpc
|
||||
|
||||
basicauth @protected {
|
||||
ARIA2_USER ARIA2_PWD_ENCRYPT
|
||||
}
|
||||
|
||||
redir /ui / 301
|
||||
redir /ui/ / 301
|
||||
redir /rclone /rclone/ 301
|
||||
redir /files /files/ 301
|
||||
redir /ro /ro/ 301
|
||||
|
||||
reverse_proxy /jsonrpc 127.0.0.1:6800
|
||||
|
||||
route /rclone/* {
|
||||
uri strip_prefix /rclone
|
||||
reverse_proxy 127.0.0.1:5572
|
||||
}
|
||||
|
||||
route /files/* {
|
||||
uri strip_prefix /files
|
||||
reverse_proxy 127.0.0.1:8080
|
||||
}
|
||||
|
||||
route /ro/* {
|
||||
uri strip_prefix /ro
|
||||
root * /data
|
||||
file_server {
|
||||
browse "{$CADDY_FILE_SERVER_BROWSE_HTML}"
|
||||
}
|
||||
}
|
||||
|
||||
route /ping {
|
||||
respond "app version: {env.APP_VERSION}"
|
||||
}
|
||||
|
||||
root * /usr/local/www/aria2
|
||||
file_server
|
||||
|
||||
encode gzip
|
||||
log {
|
||||
output stderr
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
# Docker Image Size Optimization - Debian Base
|
||||
|
||||
## Current vs Optimized Comparison
|
||||
|
||||
### Original Dockerfile Issues:
|
||||
1. **Download during runtime**: Large binaries downloaded during build
|
||||
2. **Package manager waste**: No cleanup of apt caches
|
||||
3. **Multiple layers**: Inefficient RUN command structure
|
||||
4. **Unused build tools**: wget, unzip, tar remain in final image
|
||||
5. **Redundant user setup**: User creation mixed with package installation
|
||||
|
||||
### Debian-Optimized Improvements:
|
||||
|
||||
#### 1. **Multi-Stage Build Enhancement**
|
||||
- **Build stage**: Downloads all binaries (Caddy, Filebrowser, Rclone, AriaNg)
|
||||
- **Runtime stage**: Only copies needed binaries
|
||||
- **Result**: Removes ~50MB of download tools and temporary files
|
||||
|
||||
#### 2. **Layer Optimization**
|
||||
```dockerfile
|
||||
# BEFORE: Multiple RUN commands
|
||||
RUN apt update
|
||||
RUN apt install -y ...
|
||||
RUN wget ...
|
||||
RUN tar -zxf ...
|
||||
RUN rm ...
|
||||
|
||||
# AFTER: Single optimized RUN command
|
||||
RUN apt-get update && apt-get install -y ... \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
```
|
||||
|
||||
#### 3. **Package Management**
|
||||
- Removed unnecessary packages (git, tar, unzip, wget from runtime)
|
||||
- Proper cleanup: `apt-get clean + rm -rf /var/lib/apt/lists/*`
|
||||
- **Size reduction**: ~30-40MB from package manager cleanup
|
||||
|
||||
#### 4. **Architecture Detection Improvement**
|
||||
- Uses `dpkg --print-architecture` (Debian-native)
|
||||
- More reliable than `arch` command
|
||||
- Consistent with Debian ecosystem
|
||||
|
||||
#### 5. **File Organization**
|
||||
- Pre-download all binaries in build stage
|
||||
- Use `COPY --chmod=755` to reduce layers
|
||||
- Single permissions setup RUN command
|
||||
|
||||
### Expected Size Reduction:
|
||||
- **Conservative estimate**: 20-30% smaller (e.g., 400MB → 280-320MB)
|
||||
- **Main savings**:
|
||||
- Build tools removal: ~50MB
|
||||
- Package cache cleanup: ~30-40MB
|
||||
- Layer optimization: ~10-20MB
|
||||
- Download deduplication: ~20MB
|
||||
|
||||
### Preserved Features:
|
||||
✅ Same debian:stable-slim base image
|
||||
✅ Multi-architecture support (amd64, armhf, arm64)
|
||||
✅ All runtime functionality
|
||||
✅ User permission handling
|
||||
✅ Environment variables
|
||||
✅ Health checks and volumes
|
||||
|
||||
### Risk Assessment:
|
||||
- **Low risk**: No base image change
|
||||
- **Low risk**: Same runtime dependencies
|
||||
- **Low risk**: Improved build process only
|
||||
- **Medium benefit**: Significant size reduction without compatibility issues
|
||||
|
||||
## Testing Commands:
|
||||
|
||||
```bash
|
||||
# Build and compare
|
||||
./compare-builds.sh
|
||||
|
||||
# Test functionality
|
||||
docker run -d -p 6800:80 aria2-debian-optimized:latest
|
||||
curl http://localhost:6800/ping
|
||||
|
||||
# Check final image size
|
||||
docker images | grep aria2
|
||||
```
|
||||
@@ -1,4 +1,5 @@
|
||||
filebrowser: /app/filebrowser -p 8080 -d /app/filebrowser.db -r /data -b /files
|
||||
caddy: /app/caddy.sh
|
||||
filebrowser: /app/filebrowser.sh
|
||||
aria2c: /app/aria2c.sh
|
||||
rclone: /app/rclone.sh
|
||||
newer_version_checker: /app/new-version-checker.sh
|
||||
|
||||
+29
-10
@@ -2,11 +2,17 @@ Aria2 + AriaNg
|
||||
|
||||
[English](https://github.com/wahyd4/aria2-ariang-docker/blob/master/README.md) | 简体中文
|
||||
|
||||
> 🚨 注意:由于本人精力有限,现决定将主要精力放在更新功能,和英文版本文档。中文版本文档即日起暂停更新,欢迎志愿者对英文说明进行翻译或者赞助本项目,助力我投入更多时间。谢谢。(2022年4月19日)
|
||||
|
||||
[](https://microbadger.com/images/wahyd4/aria2-ui "Get your own image badge on microbadger.com")
|
||||
[](https://hub.docker.com/r/wahyd4/aria2-ui/)
|
||||
[](https://github.com/wahyd4/aria2-ariang-docker/actions)
|
||||
|
||||
|
||||
[](https://badges.toozhao.com/stats/01EJ791D8BB43PDS8D7PP7H0YE "Get your own page views count badge on badges.toozhao.com")
|
||||
|
||||
**如果你喜欢这个项目,请考虑微信打赏,让我更有动力来不断更新,谢谢!**
|
||||
|
||||
<img src="https://raw.githubusercontent.com/wahyd4/work-in-australia/766592ac6318027d7b3c334d8c50ca80818eeff8/wepay.jpg" alt="buy me a drink" width="120"/>
|
||||
|
||||
|
||||
@@ -23,6 +29,7 @@ Aria2 + AriaNg
|
||||
- [自动 SSL](#自动-ssl)
|
||||
- [自行构建镜像](#自行构建镜像)
|
||||
- [Docker Hub](#docker-hub)
|
||||
- [在 Kubernetes 里面运行 (我的最爱)](#在-kubernetes-里面运行-我的最爱)
|
||||
- [使用 Docker compose 来运行](#使用-docker-compose-来运行)
|
||||
- [常见问题](#常见问题)
|
||||
|
||||
@@ -40,7 +47,7 @@ File Browser
|
||||
* 自动 HTTPS (Let's Encrypt)
|
||||
* 支持绑定自定义用户ID,可以主机上的非`root`用户,也可以管理下载的文件
|
||||
* Basic Auth 用户认证
|
||||
* 文件管理和视频播放 ([FileBrowser](https://filebrowser.xyz/),注意默认情况下,只能访问和管理 `/data` 目录下的文件)
|
||||
* 文件管理和视频播放 ([FileBrowser](https://filebrowser.org/),注意默认情况下,只能访问和管理 `/data` 目录下的文件)
|
||||
* 支持ARM CPU 架构,因此可以在树莓派等设备上运行,
|
||||
|
||||
## 推荐使用的docker image tag
|
||||
@@ -102,15 +109,17 @@ services:
|
||||
|
||||
### 支持的 Docker 环境变量
|
||||
|
||||
* ENABLE_AUTH 启用 Basic auth(网页简单认证) 用户认证
|
||||
* ENABLE_RCLONE 是否启用 RCLONE,由于Rclone 的初次运行需要从Github 下载文件,由于你懂的原因,可能文件下载失败,进而导致整个程序崩溃,这时你需要设置为`false`
|
||||
* ARIA2_USER Basic Auth 用户认证用户名,Rclone也使用该参数
|
||||
* ARIA2_PWD Basic Auth 密码,Rclone也使用该参数
|
||||
* ARIA2_EXTERNAL_PORT 从外部可以访问到的 Aria2 端口,默认为 HTTP 的`80`
|
||||
* PUID 需要绑定主机的Linux用户ID,可以通过`cat /etc/passwd` 查看用户列表, 默认UID 是`1000`
|
||||
* PGID 需要绑定的主机的Linux 用户组ID,默认GID 是`1000`
|
||||
* RPC_SECRET Aria2 RPC 加密 token
|
||||
* DOMAIN 绑定的域名, 当绑定的域名为`HTTPS`时,即为启用`HTTPS`, 例: `DOMAIN=https://toozhao.com`
|
||||
* `ENABLE_AUTH` 启用 Basic auth(网页简单认证) 用户认证
|
||||
* `ENABLE_RCLONE` 是否启用 RCLONE,由于Rclone 的初次运行需要从Github 下载文件,由于你懂的原因,可能文件下载失败,进而导致整个程序崩溃,这时你需要设置为`false`
|
||||
* `ARIA2_USER` Basic Auth 用户认证用户名,Rclone也使用该参数
|
||||
* `ARIA2_PWD` Basic Auth 密码,Rclone也使用该参数
|
||||
* `ARIA2_EXTERNAL_PORT` 从外部可以访问到的 Aria2 端口,默认为 HTTP 的`80`
|
||||
* `PUID` 需要绑定主机的Linux用户ID,可以通过`cat /etc/passwd` 查看用户列表, 默认UID 是`1000`
|
||||
* `PGID` 需要绑定的主机的Linux 用户组ID,默认GID 是`1000`
|
||||
* `RPC_SECRET` Aria2 RPC 加密 token
|
||||
* `DOMAIN` 绑定的域名, 当绑定的域名为`HTTPS`时,即为启用`HTTPS`, 例: `DOMAIN=https://toozhao.com`
|
||||
* `RCLONE_CONFIG_BASE64` 通过`base64` 字符串的形式配置rclone.conf。主要给在Heroku平台上运行时使用,请使用命令行 `cat /app/conf/rclone.conf | base64` 或者其他任何在线base64在线工具 [比如这个](https://www.base64encode.org/)来把`rclone.conf`的内容生成`base64`字符串。在使用本环境变量的同时,请确保`ENABLE_RCLONE`设置为`true`。
|
||||
* `ENABLE_APP_CHECKER`,默认情况下本程序会每天向远程服务器发送一次GET请求,以检查是否有新版本的镜像。该功能可以让你及时获取新功能和相关安全隐患的修复的推送提醒。你也可以选择将该环境变量设置为`false`来禁用该功能。注意该功能启用下,依然需要手动更新镜像来完成升级。
|
||||
|
||||
|
||||
### 支持的 Docker volume 属性
|
||||
@@ -140,6 +149,16 @@ docker build -t aria2-ui .
|
||||
|
||||
<https://hub.docker.com/r/wahyd4/aria2-ui/>
|
||||
|
||||
## 在 Kubernetes 里面运行 (我的最爱)
|
||||
|
||||
首先,在Kubernetes 里面运行本Docker 镜像比在Docker 里面更加复杂,需要更多的相关知识,但是也更加有意思,给你带来更多的折腾之后的满足。
|
||||
你可以使用`minikube`,Docker 桌面应用自带Kubernetes 或者 使用`kubeadm`来安装Kubernetes,然后你需要根据自己的需要修改 [k8s-manifest.yaml](k8s-manifest.yaml) 来满足你的需要的需求。比如:
|
||||
|
||||
* NFS PV provider(使用NAS 作为容器存储)
|
||||
* Ingress 访问, Oauth 登录灯其他访问控制
|
||||
* VPN (让数据访问更加安全)
|
||||
* 其他的一些 Sidecars
|
||||
|
||||
## 使用 Docker compose 来运行
|
||||
|
||||
请参考 <https://github.com/wahyd4/aria2-ariang-x-docker-compose>
|
||||
|
||||
@@ -4,10 +4,13 @@ English | [简体中文](https://github.com/wahyd4/aria2-ariang-docker/blob/mast
|
||||
|
||||
[](https://microbadger.com/images/wahyd4/aria2-ui "Get your own image badge on microbadger.com")
|
||||
[](https://hub.docker.com/r/wahyd4/aria2-ui/)
|
||||
[](https://github.com/wahyd4/aria2-ariang-docker/actions)
|
||||
[](https://github.com/wahyd4/aria2-ariang-docker/actions)
|
||||
|
||||
[](https://badges.toozhao.com/stats/aria2-ariang-docker "Page Views Count")
|
||||
|
||||
**If you like this project, please consider support me / 如果喜欢本项目,请考虑打赏,谢谢!**
|
||||
|
||||
|
||||
**If you like this project, please consider [sponsoring me](https://github.com/sponsors/wahyd4) / 如果喜欢本项目,请考虑打赏,谢谢!**
|
||||
|
||||
<img src="https://raw.githubusercontent.com/wahyd4/work-in-australia/766592ac6318027d7b3c334d8c50ca80818eeff8/wepay.jpg" alt="buy me a drink" width="120"/>
|
||||
|
||||
@@ -20,9 +23,13 @@ English | [简体中文](https://github.com/wahyd4/aria2-ariang-docker/blob/mast
|
||||
- [Supported Environment Variables](#supported-environment-variables)
|
||||
- [Supported Volumes](#supported-volumes)
|
||||
- [Auto HTTPS enabling](#auto-https-enabling)
|
||||
- [Download Automation 🤖](#download-automation-)
|
||||
- [Download file through iPhone/Mac Shortcuts app.](#download-file-through-iphonemac-shortcuts-app)
|
||||
- [Download file through cURL](#download-file-through-curl)
|
||||
- [Build the image by yourself](#build-the-image-by-yourself)
|
||||
- [Docker Hub](#docker-hub)
|
||||
- [Usage it in Docker compose](#usage-it-in-docker-compose)
|
||||
- [Running it on Kubernetes (My favorite)](#running-it-on-kubernetes-my-favorite)
|
||||
- [Running it with Docker compose](#running-it-with-docker-compose)
|
||||
- [FAQ](#faq)
|
||||
|
||||
One Docker image for file downloading, managing, sharing, as well as video playing and evening cloud storage synchronization.
|
||||
@@ -42,30 +49,32 @@ File Browser
|
||||
* [Aria2 (SSL support)](https://aria2.github.io)
|
||||
* [AriaNg](https://github.com/mayswind/AriaNg)
|
||||
* [Rclone](https://rclone.org/)
|
||||
* [File Browser](https://filebrowser.xyz/): Files mangement and videos playing
|
||||
* [File Browser](https://filebrowser.org/): Files mangement and videos playing
|
||||
* Auto HTTPS (Let's Encrypt)
|
||||
* Bind non root user into container, so non root user can also manage downloaded files.
|
||||
* Basic Auth
|
||||
* Support ARM CPUs as well, all supported CPU platforms can be found [here](https://cloud.docker.com/repository/docker/wahyd4/aria2-ui/tags)
|
||||
* Cloud Storage platforms synchronization
|
||||
* Auto uploading files to 3rd party Cloud storage providers via Rclone after files been downloaded.
|
||||
|
||||
## Recommended versions
|
||||
|
||||
* wahyd4/aria2-ui:latest
|
||||
|
||||
> Docker will pick the the proper ARCH for you. e.g. arm64v8 or x86_64
|
||||
> Docker will pick proper CPU ARCH for you. e.g. arm64v8 or x86_64
|
||||
|
||||
## How to run
|
||||
|
||||
### Quick run
|
||||
|
||||
```shell
|
||||
docker run -d --name aria2-ui -p 80:80 wahyd4/aria2-ui
|
||||
docker run -d --name aria2-ui -p 8000:80 wahyd4/aria2-ui
|
||||
```
|
||||
|
||||
* Aria2: <http://yourip>
|
||||
* FileManger: <http://yourip/files>
|
||||
* Rclone: <http://yourip/rclone>
|
||||
* Aria2: <http://yourip:8000>
|
||||
* Caddy File Server(Read Only) <http://yourip:8000/ro>
|
||||
* FileManger: <http://yourip:8000/files>
|
||||
* Rclone: <http://yourip:8000/rclone>
|
||||
* Please use `admin`/`admin` as username and password to login `Filebrowser` for the first time. And use `user`/`password` to login `Rclone` if you don't update `ARIA2_USER` and `ARIA2_PWD`
|
||||
|
||||
### Full features run
|
||||
@@ -83,7 +92,9 @@ File Browser
|
||||
-e ARIA2_USER=user \
|
||||
-e ARIA2_PWD=password \
|
||||
-e ARIA2_EXTERNAL_PORT=443 \
|
||||
-e CADDY_LOG_LEVEL=ERROR \
|
||||
-v /yourdata:/data \
|
||||
-v /app/.cache:/app/.cache \
|
||||
-v /app/a.db:/app/filebrowser.db \
|
||||
-v /to_yoursslkeys/:/app/conf/key \
|
||||
-v <conf files folder>:/app/conf \
|
||||
@@ -111,28 +122,42 @@ services:
|
||||
Then simply run `docker-compose up -d`, that's it!
|
||||
|
||||
### Supported Environment Variables
|
||||
|
||||
* ENABLE_AUTH whether to enable Basic auth
|
||||
* ENABLE_RCLONE whether to disable Rclone, if you running this container offline or do not have stable connection to Github, please set to `false`
|
||||
* ARIA2_USER Basic Auth username, Rclone GUI uses it as well.
|
||||
* ARIA2_PWD Basic Auth password, Rclone GUI uses it as well.
|
||||
* ARIA2_EXTERNAL_PORT The Aria2 port which exposed to public to access to
|
||||
* PUID Bind Linux UID into container which means you can use non `root` user to manage downloaded files, default UID is `1000`
|
||||
* PGID Bind Linux GID into container, default GID is 1000
|
||||
* RPC_SECRET The Aria2 RPC secret token
|
||||
* DOMAIN The domain you'd like to bind, when domain is a `https://` thing, then auto SSL feature will be enabled
|
||||
| ENV | Description|
|
||||
|:---|:---|
|
||||
| `ENABLE_AUTH` | Whether to enable Basic auth |
|
||||
| `ENABLE_RCLONE` | Whether to disable Rclone, if you running this container offline or do not have stable connection to Github, please set to `false` |
|
||||
| `ENABLE_FILEBROWSER` | Whether to disable Filebrowser, set it to `false` to disable it, by default it's enabled |
|
||||
| `ARIA2_USER` | Basic Auth username, Rclone GUI uses it as well. |
|
||||
| `ARIA2_PWD` | Basic Auth password, Rclone GUI uses it as well. |
|
||||
| `ARIA2_EXTERNAL_PORT` | The Aria2 port which exposed to public to access to |
|
||||
| `PUID` | Bind Linux UID into container which means you can use non `root` user to manage downloaded files, default UID is `1000` |
|
||||
| `PGID` | Bind Linux GID into container, default GID is 1000 |
|
||||
| `RPC_SECRET` | The Aria2 RPC secret token |
|
||||
| `DOMAIN` | The domain you'd like to bind, when domain is a `https://` thing, then auto TLS feature will be enabled |
|
||||
| `RCLONE_CONFIG_BASE64` | Inject and config Rclone through `base64` string, which is the only way to use Rclone on Heroku. Please use `cat /app/conf/rclone.conf \| base64` or any base64 online tools such as [this](https://www.base64encode.org/) to encode your `rclone.conf` as bse64 string. Note, you need to set `ENABLE_RCLONE` to true as well. |
|
||||
| `ENABLE_APP_CHECKER` | By default it's set to `true` to check if any new docker image version release on daily basis, which can help you get notification when new features released as well as some security vulnerabilities get fixed. You can set it to `false` to disable this feature. Note: you still need to manually pull the new image version and re run the docker container to complete upgrading. |
|
||||
| `CADDY_LOG_LEVEL` | For specifying the log level of Caddy, set it to `WARN` or`ERROR` to reduce logs. Default: `INFO` |
|
||||
| `RCLONE_AUTO_UPLOAD_PROVIDER` | The Rclone remote storage provider name, which can be found under `Rclone -> Configs`, default `""`, which means auto upload is disabled. When the value is not empty, then the files will be attempted to be uploaded.|
|
||||
| `RCLONE_AUTO_UPLOAD_REMOTE_PATH` | The file folder in remote cloud storage provider, default `/downloads`|
|
||||
| `RCLONE_AUTO_UPLOAD_FILE_MIN_SIZE` | Set the minimum file size of auto uploader, files smaller than it won't be uploaded, default `1K` |
|
||||
| `RCLONE_AUTO_UPLOAD_FILE_MAX_SIZE` | Set the limit of the Max file can be uploaded to 3rd party storage provider, default `100G`. |
|
||||
| `FIX_DATA_VOLUME_PERMISSIONS` | Default value is `false`. When set to `true`, the container will run `chown -R` command against `/data` folder and `PUID` and `PGID` you set. Please set it to `true` when container complains you don't have enough permissions to manage the files and folders you mounted.|
|
||||
|
||||
|
||||
### Supported Volumes
|
||||
* `/data` The folder contains all the files you download.
|
||||
* `/app/conf/key` The folder which stores Aria2 SSL `certificate` and `key` file. `Notice`: The certificate file should be named `aria2.crt` and the key file should be named `aria2.key`
|
||||
* `/app/conf` The Aria2 configuration and file session folder. Make sure you have `aria2.conf` and `aria2.session` file. For the first time `aria2.session` just need to be a empty file can be appended. You can also user the templates for these two file in the `conf` folder of this project. Please put your `rclone.conf` in this folder as well if you'd mount it to Rclone. So all the config files supported in this folder are:
|
||||
* aria2.conf
|
||||
* aria2.session
|
||||
* rclone.conf
|
||||
|
||||
**Warning: if you don't mount `/app/conf`, whenever the container restarts, you'll lose your downloading progress.**
|
||||
* `/app/filebrowser.db` File Browser settings database, make sure you make a empty file first on your host.
|
||||
| Mountable folder | Description|
|
||||
|:---|:---|
|
||||
| `/data` | The folder contains all the files you download. |
|
||||
| `/app/conf/key` | The folder which stores Aria2 SSL `certificate` and `key` |file. `Notice`: The certificate file should be named `aria2.crt` and the key file should be named `aria2.key` |
|
||||
| `/app/conf` | The Aria2 configuration and file session folder. 🚨Please make sure you have `aria2.conf` and `aria2.session` file exist on your host, when yout mount /app/conf. For the first time `aria2.session` just need to be a empty file can be appended. You can also user the templates for these two file in the `conf` folder of this project. Please put your `rclone.conf` in this folder as well if you'd mount it to Rclone. So all the config files supported in this folder are: `aria2.conf`, `aria2.session`, `rclone.conf`. 🚨Warning🚨: if you don't mount `/app/conf`, whenever the container restarts, you'll lose your downloading progress. |
|
||||
|`/app/conf/aria2.conf` | See description above👆🏼 |
|
||||
|`/app/conf/aria2.session` | See description above👆🏼 |
|
||||
|`/app/conf/rclone.conf` | See description above👆🏼 |
|
||||
| `/app/conf/auto-upload.sh` | The bash script to be used for uploading downloaded files to remote storage provider via Rclone, mount your own script if you want to have custom logic. |
|
||||
| `/app/filebrowser.db` | File Browser settings database, make sure you make a empty file first on your host. |
|
||||
| `/app/.cache` | The folder for storing rclone caches and [aria2 DHT files](https://aria2.github.io/manual/en/html/aria2c.html#cmdoption-dht-file-path) |
|
||||
|
||||
|
||||
## Auto HTTPS enabling
|
||||
|
||||
@@ -141,6 +166,18 @@ Make sure you have added proper `A` record point to the host you running to your
|
||||
```bash
|
||||
docker run -d --name aria2-ui -p 80:80 -p 443:443 -e DOMAIN=https://toozhao.com wahyd4/aria2-ui
|
||||
```
|
||||
## Download Automation 🤖
|
||||
|
||||
### Download file through iPhone/Mac Shortcuts app.
|
||||
|
||||
First [Download Shortcut](https://www.icloud.com/shortcuts/7483b8cec7484c0f98b72882d0f1e3e2), then follow the promots to setup aria2-ui URL and RPC_SECRET. Then you are all ready to go, just to run the shortcut and provide the file URL which you want to download or the magnet/torrent file URL.
|
||||
|
||||
### Download file through cURL
|
||||
|
||||
```bash
|
||||
curl http://<ip>:<port>/jsonrpc -d "{\"jsonrcp\":\"2.0\",\"id\":\"someID\",\"method\":\"aria2.addUri\",\"params\":[\"token:someToken\",[\"http://some_file_url\"],{\"dir\":\"/data/downloads\"}]}"
|
||||
```
|
||||
|
||||
## Build the image by yourself
|
||||
|
||||
```bash
|
||||
@@ -151,12 +188,25 @@ docker run -d --name aria2-ui -p 80:80 -p 443:443 -e DOMAIN=https://toozhao.com
|
||||
|
||||
<https://hub.docker.com/r/wahyd4/aria2-ui/>
|
||||
|
||||
## Usage it in Docker compose
|
||||
## Running it on Kubernetes (My favorite)
|
||||
|
||||
First of all, I have to say running this docker image on Kubernetes is more challenging and requires more knowledges than running it in raw Docker, but which is more powerful.
|
||||
I couldn't tell you how to run it in Kubernetes step by step, but once you have a running Kubernetes cluster(You can install Kubernetes via `minikube`, `Docker desktop app`, `kubeadm` and many other tools.), then you can modify the [k8s-manifest.yaml](k8s-manifest.yaml) to satisfy all your requirements. Such as:
|
||||
|
||||
* NFS PV provider(Use your NAS as storage)
|
||||
* Ingress access, Oauth login, more access controls via Nginx etc.
|
||||
* VPN tunnel (Secure your traffic)
|
||||
* Sidecars and so on.
|
||||
|
||||
## Running it with Docker compose
|
||||
|
||||
Please refer <https://github.com/wahyd4/aria2-ariang-x-docker-compose>
|
||||
|
||||
|
||||
|
||||
## FAQ
|
||||
1. When you running the docker image with non `80` port or you have HTTPS enabled, you will meet the error says `Aria2 Status Disconnected`, then you will need to set `ARIA2_EXTERNAL_PORT` and recreate your container.
|
||||
2. If there is no speed at all when you downloading a BitTorrent file, please try to use a popular torrent file first to help the application to cache `DHT` file. Then the speed should get fast and fast, as well as downloading other links.
|
||||
3. If you see any errors related to `setcap` which probably means the Linux you are running doesn't support running this application with `non-root` user. So please specify the `PUID` and `PGID` to `0` explicitly to use `root` user to run it.
|
||||
4. How can I get `Rclone` authenticated? Due to Rclone is running in this docker image only as a component rather than an application, you can only interact with it via `/rclone` endpoint, and no other ports. So the web browser authentication mechanism doesn't work here. Please configure Rclone through command line within the container. You can follow the official doc [Configuring rclone on a remote / headless machine](https://rclone.org/remote_setup) or this [issue](https://github.com/wahyd4/aria2-ariang-docker/issues/118)
|
||||
5. Why the app stopped working when I have `- v /<some-folder>:/app/conf` mounted. It happens when you mount the entire `/app/conf` folder but you don't have any files under that folder on your host. To fix this issue, please simply copy all files under [`conf`](https://github.com/wahyd4/aria2-ariang-docker/tree/master/conf) folder to your local folder that you mount to `/app/conf` and then rerun the container.
|
||||
|
||||
+27
-13
@@ -1,34 +1,48 @@
|
||||
#{
|
||||
# auto_https off
|
||||
#}
|
||||
|
||||
{$DOMAIN}
|
||||
|
||||
basicauth / {
|
||||
ARIA2_USER ARIA2_PWD_ENCRYPT
|
||||
log {
|
||||
level {env.CADDY_LOG_LEVEL}
|
||||
output stderr
|
||||
}
|
||||
|
||||
@protected path / /index.html /css/* /js/* /ro /ro/* /jsonrpc
|
||||
|
||||
basicauth @protected {
|
||||
ARIA2_USER ARIA2_PWD_ENCRYPT
|
||||
}
|
||||
|
||||
redir /ui / 301
|
||||
redir /ui/ / 301
|
||||
redir /rclone /rclone/ 301
|
||||
redir /files /files/ 301
|
||||
redir /ro /ro/ 301
|
||||
|
||||
reverse_proxy /rpc 127.0.0.1:6800
|
||||
reverse_proxy /jsonrpc 127.0.0.1:6800
|
||||
|
||||
route /rclone/* {
|
||||
uri strip_prefix /rclone
|
||||
reverse_proxy 127.0.0.1:5572
|
||||
uri strip_prefix /rclone
|
||||
reverse_proxy 127.0.0.1:5572
|
||||
}
|
||||
|
||||
route /files/* {
|
||||
uri strip_prefix /files
|
||||
reverse_proxy 127.0.0.1:8080
|
||||
uri strip_prefix /files
|
||||
reverse_proxy 127.0.0.1:8080
|
||||
}
|
||||
|
||||
route /ro/* {
|
||||
uri strip_prefix /ro
|
||||
root * /data
|
||||
file_server {
|
||||
browse "{$CADDY_FILE_SERVER_BROWSE_HTML}"
|
||||
}
|
||||
}
|
||||
|
||||
route /ping {
|
||||
respond "app version: {env.APP_VERSION}"
|
||||
}
|
||||
|
||||
root * /usr/local/www/aria2
|
||||
file_server
|
||||
|
||||
encode gzip
|
||||
log {
|
||||
output stderr
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"name": "wahyd4/aria2-ariang-docker demo",
|
||||
"description": "A demo of Aria2 + AriaNg + Filebrowser + Rclone",
|
||||
"repository": "https://github.com/wahyd4/aria2-ariang-docker",
|
||||
"keywords": ["docker", "aria2", "rclone", "fllebrowser", "ariang"],
|
||||
"stack": "container",
|
||||
"success_url": "/",
|
||||
"env": {
|
||||
"ENABLE_AUTH": {
|
||||
"description": "This value must be heroku when running in Heroku",
|
||||
"value": "heroku",
|
||||
"required": false
|
||||
},
|
||||
"RCLONE_CONFIG_BASE64": {
|
||||
"description": "This value is the base64 string of your preconfigured /app/conf/rclone.conf content",
|
||||
"value": "",
|
||||
"required": false
|
||||
},
|
||||
"ARIA2_USER": {
|
||||
"description": "Username to login to AriaNg",
|
||||
"value": "user",
|
||||
"required": false
|
||||
},
|
||||
"ARIA2_PWD": {
|
||||
"description": "Password to login to AriaNg",
|
||||
"value": "password",
|
||||
"required": false
|
||||
},
|
||||
"ARIA2_EXTERNAL_PORT": {
|
||||
"description": "External port for apps, it should be 443 when running in Heroku",
|
||||
"value": "443",
|
||||
"required": false
|
||||
},
|
||||
"PUID": {
|
||||
"description": "The Linux user's ID that to run the app",
|
||||
"value": "0",
|
||||
"required": false
|
||||
},
|
||||
"PGID": {
|
||||
"description": "The Linux group's ID that to run the app",
|
||||
"value": "0",
|
||||
"required": false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +1,26 @@
|
||||
#! /bin/bash -eu
|
||||
|
||||
sed -i 's/6800/'"${ARIA2_EXTERNAL_PORT}"'/g' /usr/local/www/aria2/js/aria-ng*.js
|
||||
RPC_SECRET_BASE64=$(echo -n ${RPC_SECRET}|base64)
|
||||
RPC_SECRET_BASE64=$(echo -n ${RPC_SECRET} | base64)
|
||||
sed -i 's/secret:\"\"/secret:\"'"${RPC_SECRET_BASE64}"'\"/g' /usr/local/www/aria2/js/aria-ng*.js
|
||||
|
||||
if [ "$ARIA2_SSL" = "true" ]; then
|
||||
echo "Start aria2 with secure config"
|
||||
if [[ "${ARIA2_SSL}" = "true" ]]; then
|
||||
echo "[INFO] Start aria2 with secure config and rpc-secret"
|
||||
|
||||
/usr/bin/aria2c --conf-path="/app/conf/aria2.conf" \
|
||||
--enable-rpc --rpc-listen-all \
|
||||
--rpc-certificate=/app/conf/key/aria2.crt \
|
||||
--rpc-private-key=/app/conf/key/aria2.key \
|
||||
--rpc-secret="$RPC_SECRET" --rpc-secure \
|
||||
/usr/bin/aria2c --conf-path="/app/conf/aria2.conf" \
|
||||
--enable-rpc --rpc-listen-all \
|
||||
--rpc-certificate=/app/conf/key/aria2.crt \
|
||||
--rpc-private-key=/app/conf/key/aria2.key \
|
||||
--rpc-secret="${RPC_SECRET}" --rpc-secure
|
||||
|
||||
elif [[ "${ARIA2_SSL}" = "false" ]] && [[ "${RPC_SECRET}" != "" ]]; then
|
||||
echo "[INFO] Start aria2 with rpc-secret"
|
||||
/usr/bin/aria2c --conf-path="/app/conf/aria2.conf" \
|
||||
--enable-rpc \
|
||||
--rpc-listen-all \
|
||||
--rpc-secret="${RPC_SECRET}"
|
||||
else
|
||||
|
||||
echo "Start aria2 with standard mode"
|
||||
/usr/bin/aria2c --conf-path="/app/conf/aria2.conf" --enable-rpc --rpc-listen-all
|
||||
echo "[INFO] Start aria2 with standard mode"
|
||||
/usr/bin/aria2c --conf-path="/app/conf/aria2.conf" --enable-rpc --rpc-listen-all
|
||||
|
||||
fi
|
||||
|
||||
@@ -1,17 +1,31 @@
|
||||
#! /bin/bash -eu
|
||||
|
||||
echo "Run aria2c and ariaNG"
|
||||
if [ "$ENABLE_AUTH" = "true" ]; then
|
||||
echo "Using Basic Auth config file "
|
||||
echo "[INFO] Run aria2c and ariaNG"
|
||||
|
||||
echo "[INFO] Generate basic auth password for caddy"
|
||||
ARIA2_PWD_ENCRYPT=$(caddy hash-password --plaintext ${ARIA2_PWD})
|
||||
|
||||
case $ENABLE_AUTH in
|
||||
true)
|
||||
echo "[INFO] Use Basic Auth config file "
|
||||
export CADDY_FILE=/usr/local/caddy/SecureCaddyfile
|
||||
sed -i "s#ARIA2_USER#${ARIA2_USER}#g" ${CADDY_FILE}
|
||||
sed -i "s#ARIA2_PWD_ENCRYPT#${ARIA2_PWD_ENCRYPT}#g" ${CADDY_FILE}
|
||||
;;
|
||||
|
||||
echo "**** generate basic auth password for caddy ****"
|
||||
ARIA2_PWD_ENCRYPT=`caddy hash-password -plaintext ${ARIA2_PWD}`
|
||||
sed -i 's/ARIA2_USER/'"${ARIA2_USER}"'/g' /usr/local/caddy/SecureCaddyfile
|
||||
sed -i 's/ARIA2_PWD_ENCRYPT/'"${ARIA2_PWD_ENCRYPT}"'/g' /usr/local/caddy/SecureCaddyfile
|
||||
else
|
||||
echo "Using caddy without Basic Auth"
|
||||
heroku)
|
||||
echo "[INFO] Run Caddy with Heroku mode"
|
||||
export CADDY_FILE=/usr/local/caddy/HerokuCaddyfile
|
||||
sed -i "s#ARIA2_USER#${ARIA2_USER}#g" ${CADDY_FILE}
|
||||
sed -i "s#ARIA2_PWD_ENCRYPT#${ARIA2_PWD_ENCRYPT}#g" ${CADDY_FILE}
|
||||
|
||||
sed -i 's/PORT/'"${PORT}"'/g' ${CADDY_FILE}
|
||||
|
||||
;;
|
||||
*)
|
||||
echo "[INFO] Use caddy without Basic Auth"
|
||||
export CADDY_FILE=/usr/local/caddy/Caddyfile
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
/usr/local/bin/caddy run -config ${CADDY_FILE} -adapter=caddyfile
|
||||
/usr/local/bin/caddy run --config ${CADDY_FILE} --adapter=caddyfile
|
||||
|
||||
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Building and comparing Docker images..."
|
||||
|
||||
# Build original image
|
||||
echo "Building original image..."
|
||||
docker build -f Dockerfile -t aria2-original:latest .
|
||||
|
||||
# Build Debian-optimized image
|
||||
echo "Building Debian-optimized image..."
|
||||
docker build -f Dockerfile.debian-optimized -t aria2-debian-optimized:latest .
|
||||
|
||||
# Build Alpine-optimized image
|
||||
echo "Building Alpine-optimized image..."
|
||||
docker build -f Dockerfile.optimized -t aria2-alpine-optimized:latest .
|
||||
|
||||
# Compare sizes
|
||||
echo ""
|
||||
echo "=== IMAGE SIZE COMPARISON ==="
|
||||
echo "Original image:"
|
||||
docker images aria2-original:latest --format "table {{.Repository}}\t{{.Tag}}\t{{.Size}}"
|
||||
|
||||
echo ""
|
||||
echo "Debian-optimized image:"
|
||||
docker images aria2-debian-optimized:latest --format "table {{.Repository}}\t{{.Tag}}\t{{.Size}}"
|
||||
|
||||
echo ""
|
||||
echo "Alpine-optimized image:"
|
||||
docker images aria2-alpine-optimized:latest --format "table {{.Repository}}\t{{.Tag}}\t{{.Size}}"
|
||||
|
||||
echo ""
|
||||
echo "=== DETAILED LAYER ANALYSIS ==="
|
||||
echo "Original layers:"
|
||||
docker history aria2-original:latest --format "table {{.CreatedBy}}\t{{.Size}}"
|
||||
|
||||
echo ""
|
||||
echo "Debian-optimized layers:"
|
||||
docker history aria2-debian-optimized:latest --format "table {{.CreatedBy}}\t{{.Size}}"
|
||||
|
||||
echo ""
|
||||
echo "Alpine-optimized layers:"
|
||||
docker history aria2-alpine-optimized:latest --format "table {{.CreatedBy}}\t{{.Size}}"
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#! /bin/bash -eu
|
||||
|
||||
# For more details about how to use this feature, see: https://aria2.github.io/manual/en/html/aria2c.html#event-hook
|
||||
|
||||
echo "[INFO] $(date -u +'%Y-%m-%dT%H:%M:%SZ') Aria2 hook triggered with parameters: GID [$1], Files Count: [$2], Files Path: [$3]"
|
||||
+17
-4
@@ -54,10 +54,10 @@ disable-ipv6=true
|
||||
# General Options
|
||||
log=/var/log/aria2.log
|
||||
#You can set either debug, info, notice, warn or error.
|
||||
log-level=notice
|
||||
log-level=warn
|
||||
|
||||
|
||||
## 进度保存相关 ##
|
||||
## Related to save downloading progress ##
|
||||
# 从会话文件中读取下载任务
|
||||
input-file=/app/conf/aria2.session
|
||||
# 在Aria2退出时保存`错误/未完成`的下载任务到会话文件
|
||||
@@ -65,5 +65,18 @@ save-session=/app/conf/aria2.session
|
||||
# 定时保存会话, 0为退出时才保存, 需1.16.1以上版本, 默认:0
|
||||
save-session-interval=10
|
||||
|
||||
# BT trackers from https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_best_ip.txt
|
||||
bt-tracker=udp://62.138.0.158:6969/announce,udp://188.241.58.209:6969/announce,udp://93.158.213.92:1337/announce,udp://62.210.97.59:1337/announce,udp://151.80.120.113:2710/announce,udp://151.80.120.113:2710/announce,udp://165.231.0.116:80/announce,udp://208.83.20.20:6969/announce,udp://37.235.174.46:2710/announce,udp://185.181.60.67:80/announce,udp://54.37.235.149:6969/announce,udp://89.234.156.205:451/announce,udp://35.156.19.129:6969/announce,udp://159.100.245.181:6969/announce,udp://51.15.40.114:80/announce,udp://142.44.243.4:1337/announce,udp://176.113.71.19:6961/announce,udp://5.206.54.49:6969/announce,udp://184.105.151.164:6969/announce,udp://51.254.249.186:6969/announce
|
||||
# BT trackers from https://trackerslist.com/best.txt updated on 2021-06-06
|
||||
bt-tracker=http://1337.abcvg.info:80/announce,http://nyaa.tracker.wf:7777/announce,http://opentracker.xyz:80/announce,http://rt.tace.ru:80/announce,http://share.camoe.cn:8080/announce,http://t.nyaatracker.com:80/announce,http://torrentsmd.com:8080/announce,http://tr.cili001.com:8070/announce,http://tracker-cdn.moeking.me:2095/announce,http://tracker.anirena.com:80/announce,http://tracker.anirena.com:80/b16a15d9a238d1f59178d3614b857290/announce,http://tracker.anonwebz.xyz:8080/announce,http://tracker.bt4g.com:2095/announce,http://tracker.files.fm:6969/announce,http://tracker.gbitt.info:80/announce,http://tracker.ipv6tracker.ru:80/announce,http://tracker.noobsubs.net:80/announce,http://tracker.shittyurl.org:80/announce,http://tracker.tfile.co:80/announce,http://tracker.tfile.me:80/announce,http://tracker.trackerfix.com:80/announce,http://vps02.net.orel.ru:80/announce,https://1337.abcvg.info:443/announce,https://tr.torland.ga:443/announce,https://tracker.coalition.space:443/announce,https://tracker.gbitt.info:443/announce,https://tracker.lilithraws.cf:443/announce,https://tracker.nanoha.org:443/announce,https://tracker.nitrix.me:443/announce,https://tracker.parrotsec.org:443/announce,https://tracker.shittyurl.org:443/announce,https://tracker.tamersunion.org:443/announce,https://w.wwwww.wtf:443/announce,udp://6rt.tace.ru:80/announce,udp://9.rarbg.com:2830/announce,udp://9.rarbg.me:2710/announce,udp://9.rarbg.to:2710/announce,udp://app.icon256.com:8000/announce,udp://bubu.mapfactor.com:6969/announce,udp://discord.heihachi.pw:6969/announce,udp://exodus.desync.com:6969/announce,udp://explodie.org:6969/announce,udp://fe.dealclub.de:6969/announce,udp://inferno.demonoid.is:3391/announce,udp://ipv6.tracker.zerobytes.xyz:16661/announce,udp://mail.realliferpg.de:6969/announce,udp://movies.zsw.ca:6969/announce,udp://mts.tvbit.co:6969/announce,udp://open.demonii.com:1337/announce,udp://open.stealth.si:80/announce,udp://opentor.org:2710/announce,udp://opentracker.i2p.rocks:6969/announce,udp://p4p.arenabg.ch:1337/announce,udp://p4p.arenabg.com:1337/announce,udp://pow7.com:80/announce,udp://retracker.hotplug.ru:2710/announce,udp://retracker.lanta-net.ru:2710/announce,udp://retracker.netbynet.ru:2710/announce,udp://retracker01-msk-virt.corbina.net:80/announce,udp://t1.leech.ie:1337/announce,udp://t2.leech.ie:1337/announce,udp://thetracker.org:80/announce,udp://torrentclub.online:54123/announce,udp://tracker-de.ololosh.space:6969/announce,udp://tracker.0x.tf:6969/announce,udp://tracker.altrosky.nl:6969/announce,udp://tracker.army:6969/announce,udp://tracker.beeimg.com:6969/announce,udp://tracker.birkenwald.de:6969/announce,udp://tracker.blacksparrowmedia.net:6969/announce,udp://tracker.breizh.pm:6969/announce,udp://tracker.ccp.ovh:6969/announce,udp://tracker.cyberia.is:6969/announce,udp://tracker.dler.com:6969/announce,udp://tracker.internetwarriors.net:1337/announce,udp://tracker.moeking.me:6969/announce,udp://tracker.nrx.me:6969/announce,udp://tracker.ololosh.space:6969/announce,udp://tracker.openbittorrent.com:6969/announce,udp://tracker.opentrackr.org:1337/announce,udp://tracker.shkinev.me:6969/announce,udp://tracker.theoks.net:6969/announce,udp://tracker.tiny-vps.com:6969/announce,udp://tracker.torrent.eu.org:451/announce,udp://tracker.uw0.xyz:6969/announce,udp://tracker.zerobytes.xyz:1337/announce,udp://tracker0.ufibox.com:6969/announce,udp://tracker1.bt.moack.co.kr:80/announce,udp://tracker1.itzmx.com:8080/announce,udp://tracker2.dler.com:80/announce,udp://tracker2.dler.org:80/announce,udp://tracker2.itzmx.com:6961/announce,udp://tracker3.itzmx.com:6961/announce,udp://tracker4.itzmx.com:2710/announce,udp://u.wwwww.wtf:1/announce,udp://valakas.rollo.dnsabr.com:2710/announce,udp://vibe.community:6969/announce,udp://wassermann.online:6969/announce,udp://www.torrent.eu.org:451/announce
|
||||
|
||||
# The script to be run when download completes
|
||||
#on-download-complete=/app/conf/aria2-sample-hook.sh
|
||||
on-download-complete=/app/conf/auto-upload.sh
|
||||
|
||||
# The script to be run when download fails
|
||||
on-download-error=/app/conf/aria2-sample-hook.sh
|
||||
|
||||
## DHT
|
||||
dht-entry-point=dht.transmissionbt.com:6881
|
||||
dht-entry-point=dht.vuze.com:6881
|
||||
dht-entry-point=dht.libtorrent.org:25401
|
||||
dht-listen-port=6881
|
||||
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash -eu
|
||||
|
||||
if [[ ${RCLONE_AUTO_UPLOAD_PROVIDER} == "" ]]; then
|
||||
echo "[INFO] $(date -u +'%Y-%m-%dT%H:%M:%SZ') Auto upload isn't enabled"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
file_count=$2
|
||||
file_path=$3
|
||||
downloadsFolder='/data'
|
||||
|
||||
if [ ${file_count} -eq 0 ]; then
|
||||
echo "[WARN] $(date -u +'%Y-%m-%dT%H:%M:%SZ') No files detected. Original parameters: Files Count: ${file_count}, Files Path: ${file_path}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "[INFO] $(date -u +'%Y-%m-%dT%H:%M:%SZ') Start to upload files with: Files Count: ${file_count}, Files Path: ${file_path}"
|
||||
|
||||
folder=${file_path%/*}
|
||||
|
||||
if [ "${folder}" == "" ]; then # Not the actual file, or no files downloaded.
|
||||
echo "[WARN] $(date -u +'%Y-%m-%dT%H:%M:%SZ') Fail to find files ${file_path}"
|
||||
exit 0
|
||||
else
|
||||
if [[ "$(ls -A "$folder/")" != "" ]] && [[ ${folder} != ${downloadsFolder} ]] ; then
|
||||
# Copy files to remote
|
||||
echo "[INFO] $(date -u +'%Y-%m-%dT%H:%M:%SZ') Start uploading entire folder ${folder}"
|
||||
rclone copy "${folder}" ${RCLONE_AUTO_UPLOAD_PROVIDER}:${RCLONE_AUTO_UPLOAD_REMOTE_PATH}${folder}/ --min-size ${RCLONE_AUTO_UPLOAD_FILE_MIN_SIZE} --max-size ${RCLONE_AUTO_UPLOAD_FILE_MAX_SIZE} -P
|
||||
else
|
||||
#Handle single file
|
||||
echo "[INFO] $(date -u +'%Y-%m-%dT%H:%M:%SZ') Start uploading file file_path"
|
||||
rclone copy "${file_path}" ${RCLONE_AUTO_UPLOAD_PROVIDER}:${RCLONE_AUTO_UPLOAD_REMOTE_PATH}${folder}/ --min-size ${RCLONE_AUTO_UPLOAD_FILE_MIN_SIZE} --max-size ${RCLONE_AUTO_UPLOAD_FILE_MAX_SIZE} -P
|
||||
fi
|
||||
echo "[INFO] $(date -u +'%Y-%m-%dT%H:%M:%SZ') Successfully uploaded ${file_count} files ${file_path}"
|
||||
fi
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash -eu
|
||||
|
||||
echo "Checking if FileBrowser is enabled..."
|
||||
|
||||
if [ "$ENABLE_FILEBROWSER" = "true" ]; then
|
||||
echo "Starting FileBrowser..."
|
||||
/app/filebrowser -p 8080 -d /app/filebrowser.db -r /data -b /files
|
||||
else
|
||||
echo "FileBrowser is disabled. Set ENABLE_FILEBROWSER=true to enable it."
|
||||
sleep 3650d
|
||||
fi
|
||||
@@ -0,0 +1,3 @@
|
||||
build:
|
||||
docker:
|
||||
web: Dockerfile
|
||||
@@ -1,25 +1,33 @@
|
||||
#! /bin/bash -eu
|
||||
|
||||
echo "**** update uid and gid to ${PUID}:${PGID} ****"
|
||||
echo "[INFO] Update uid and gid to ${PUID}:${PGID}"
|
||||
groupmod -o -g "$PGID" junv
|
||||
usermod -o -u "$PUID" junv
|
||||
|
||||
mkdir -p /app/.caddy
|
||||
mkdir -p /app/.cache
|
||||
mkdir -p /app/.cache/aria2
|
||||
|
||||
echo "[INFO] Run chown against app related folders and user ${PUID}"
|
||||
|
||||
chown -R junv:junv \
|
||||
/app \
|
||||
/app/.caddy \
|
||||
/app/.cache \
|
||||
/usr/local \
|
||||
/var/log \
|
||||
/data
|
||||
/var/log
|
||||
|
||||
if [[ "${FIX_DATA_VOLUME_PERMISSIONS}" = "true" ]]; then
|
||||
echo "[INFO] Setup user ${PUID} proper permissions for /data"
|
||||
chown -R junv:junv /data
|
||||
fi
|
||||
|
||||
chmod +x /app/caddy.sh \
|
||||
/app/rclone.sh \
|
||||
/app/aria2c.sh
|
||||
/app/aria2c.sh \
|
||||
/app/filebrowser.sh
|
||||
|
||||
echo "**** give caddy permissions to use low ports ****"
|
||||
echo "[INFO] Give caddy permissions to use low ports"
|
||||
setcap cap_net_bind_service=+ep /usr/local/bin/caddy
|
||||
|
||||
"${@-sh}"
|
||||
|
||||
+17
-16
@@ -1,11 +1,11 @@
|
||||
#! /bin/sh -eux
|
||||
|
||||
echo "Set variables for $(arch)"
|
||||
echo "[INFO] Set variables for $(arch)"
|
||||
|
||||
caddy_version=2.3.0
|
||||
filebrowser_version=v2.15.0
|
||||
rclone_version=v1.55.0
|
||||
ariang_version=1.2.1
|
||||
caddy_version=2.9.1
|
||||
filebrowser_version=v2.32.0
|
||||
rclone_version=v1.69.1
|
||||
ariang_version=1.3.10
|
||||
|
||||
case "$(arch)" in
|
||||
|
||||
@@ -13,46 +13,41 @@ case "$(arch)" in
|
||||
platform=linux-amd64
|
||||
caddy_file=caddy_${caddy_version}_linux_amd64.tar.gz
|
||||
rclone_file=rclone-${rclone_version}-${platform}.zip
|
||||
forego_file=forego-stable-${platform}.tgz
|
||||
;;
|
||||
armv7l)
|
||||
platform=linux-armv7
|
||||
caddy_file=caddy_${caddy_version}_linux_armv7.tar.gz
|
||||
rclone_file=rclone-${rclone_version}-linux-arm-v7.zip
|
||||
forego_file=forego-stable-linux-arm.tgz
|
||||
;;
|
||||
|
||||
aarch64)
|
||||
platform=linux-arm64
|
||||
caddy_file=caddy_${caddy_version}_linux_arm64.tar.gz
|
||||
rclone_file=rclone-${rclone_version}-${platform}.zip
|
||||
forego_file=forego-stable-${platform}.tgz
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "unsupported arch $(arch), exit now"
|
||||
echo "[ERROR] unsupported arch $(arch), exit now"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
filebrowser_file=${platform}-filebrowser.tar.gz
|
||||
ariang_file=AriaNg-${ariang_version}.zip
|
||||
|
||||
adduser -D -u 1000 junv \
|
||||
&& apk update \
|
||||
&& apk add runit shadow wget bash curl openrc gnupg aria2 tar mailcap --no-cache \
|
||||
groupadd junv \
|
||||
&& useradd -g junv -m -s /bin/bash junv \
|
||||
&& apt update \
|
||||
&& apt install -y wget curl aria2 tar unzip libcap2-bin runit\
|
||||
&& wget -N https://github.com/caddyserver/caddy/releases/download/v${caddy_version}/${caddy_file} \
|
||||
&& tar -zxf ${caddy_file} \
|
||||
&& mv caddy /usr/local/bin/ \
|
||||
&& rm -rf ${caddy_file} \
|
||||
&& wget -P /app -N https://raw.githubusercontent.com/glowinthedark/caddy-file-server-browse-extension/39e997c91539d0f04fcce53a3cb6605b2ae9e50c/browse.html \
|
||||
&& platform=linux-amd64 \
|
||||
&& wget -N https://github.com/filebrowser/filebrowser/releases/download/${filebrowser_version}/${filebrowser_file} \
|
||||
&& tar -zxf ${filebrowser_file} \
|
||||
&& rm -rf ${filebrowser_file} \
|
||||
&& rm LICENSE README.md CHANGELOG.md \
|
||||
&& wget -N https://bin.equinox.io/c/ekMN3bCZFUn/${forego_file} \
|
||||
&& tar -zxf ${forego_file} \
|
||||
&& rm -rf ${forego_file} \
|
||||
&& mkdir -p /usr/local/www \
|
||||
&& mkdir -p /usr/local/www/aria2 \
|
||||
&& rm -rf init /app/*.txt \
|
||||
@@ -71,3 +66,9 @@ adduser -D -u 1000 junv \
|
||||
&& unzip ${ariang_file} \
|
||||
&& rm -rf ${ariang_file} \
|
||||
&& chmod -R 755 /usr/local/www/aria2 \
|
||||
&& mkdir -p /data && chown junv:junv /data \
|
||||
&& mkdir -p /data/cloud \
|
||||
&& chown junv:junv /data/cloud \
|
||||
&& ln -s /data/cloud /app \
|
||||
&& apt remove -y unzip\
|
||||
&& apt clean
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: files
|
||||
spec:
|
||||
revisionHistoryLimit: 2
|
||||
selector:
|
||||
matchLabels:
|
||||
app: files
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: files
|
||||
spec:
|
||||
volumes:
|
||||
# - name: config
|
||||
# persistentVolumeClaim:
|
||||
# claimName: configs-pv
|
||||
- name: downloads
|
||||
persistentVolumeClaim:
|
||||
claimName: downloads-pv
|
||||
containers:
|
||||
- name: files
|
||||
image: wahyd4/aria2-ui:latest
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 80
|
||||
name: files-port
|
||||
protocol: TCP
|
||||
env:
|
||||
## Update this to the final port you would use in the browser
|
||||
- name: ARIA2_EXTERNAL_PORT
|
||||
value: "443"
|
||||
- name: PUID
|
||||
value: "1000"
|
||||
- name: PGID
|
||||
value: "1000"
|
||||
volumeMounts:
|
||||
# - name: config
|
||||
# subPath: aria
|
||||
# mountPath: /app/conf
|
||||
# - name: config
|
||||
# subPath: files/filebrowser.db
|
||||
# mountPath: /app/filebrowser.db
|
||||
- name: downloads
|
||||
mountPath: /data
|
||||
resources:
|
||||
requests:
|
||||
cpu: 150m
|
||||
memory: 256Mi
|
||||
limits:
|
||||
cpu: 400m
|
||||
memory: 1024Mi
|
||||
# An example of encrypting the traffic with some vpn providerm, please update the configurations accordingly
|
||||
# - name: openvpn
|
||||
# image: qmcgaw/gluetun:latest
|
||||
# securityContext:
|
||||
# runAsUser: 0
|
||||
# privileged: true
|
||||
# capabilities:
|
||||
# add: ["NET_ADMIN"]
|
||||
# imagePullPolicy: Always
|
||||
# env:
|
||||
# - name: OPENVPN_USER
|
||||
# value: xxxx
|
||||
# - name: OPENVPN_PASSWORD
|
||||
# valueFrom:
|
||||
# secretKeyRef:
|
||||
# name: openvpn-password
|
||||
# key: password
|
||||
# - name: VPNSP
|
||||
# value: "private internet access"
|
||||
# - name: PIA_ENCRYPTION
|
||||
# value: normal
|
||||
# - name: REGION
|
||||
# value: "AU Sydney"
|
||||
# - name: TZ
|
||||
# value: Australia/Melbourne
|
||||
# resources:
|
||||
# requests:
|
||||
# cpu: 100m
|
||||
# memory: 126Mi
|
||||
# limits:
|
||||
# cpu: 100m
|
||||
# memory: 126Mi
|
||||
---
|
||||
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: files
|
||||
labels:
|
||||
app: files
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: files-port
|
||||
protocol: TCP
|
||||
name: web
|
||||
selector:
|
||||
app: files
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: downloads-pv
|
||||
labels:
|
||||
type: local
|
||||
spec:
|
||||
storageClassName: manual
|
||||
capacity:
|
||||
storage: 100Gi
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
hostPath:
|
||||
path: "/mnt/data"
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: "downloads-pv"
|
||||
spec:
|
||||
storageClassName: "manual"
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
resources:
|
||||
requests:
|
||||
storage: 100Gi
|
||||
|
||||
|
||||
# ---
|
||||
# ingress example
|
||||
# apiVersion: networking.k8s.io/v1
|
||||
# kind: Ingress
|
||||
# metadata:
|
||||
# name: files-ingress
|
||||
# annotations:
|
||||
# kubernetes.io/ingress.class: "nginx"
|
||||
# kubernetes.io/tls-acme: "true"
|
||||
# cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
||||
# nginx.ingress.kubernetes.io/proxy-body-size: 10240m
|
||||
# spec:
|
||||
# tls:
|
||||
# - hosts:
|
||||
# - xx.example.com
|
||||
# secretName: files-tls
|
||||
# rules:
|
||||
# - host: xx.example.com
|
||||
# http:
|
||||
# paths:
|
||||
# - path: /
|
||||
# pathType: Prefix
|
||||
# backend:
|
||||
# service:
|
||||
# name: files
|
||||
# port:
|
||||
# number: 80
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#! /bin/bash -u
|
||||
sleep 5
|
||||
|
||||
if [ "$ENABLE_APP_CHECKER" = "false" ]; then
|
||||
echo "[INFO] Skip checking new version"
|
||||
# Do nothing and just sleep 10 years
|
||||
sleep 315360000
|
||||
exit 0
|
||||
fi
|
||||
|
||||
set -e
|
||||
APP_VERSION=$(cat APP_VERSION)
|
||||
set +e
|
||||
while true; do
|
||||
echo "[INFO] $(date -u +'%Y-%m-%dT%H:%M:%SZ') Checking for new version against ${APP_VERSION} ..."
|
||||
newer_version=$(curl --max-time 6 -s "https://badges.toozhao.com/val/aria2-ui-docker?version=${APP_VERSION}&arch=$(arch)")
|
||||
if [[ -z ${newer_version} ]]; then
|
||||
echo "[WARN] $(date -u +'%Y-%m-%dT%H:%M:%SZ') Failed to check new version."
|
||||
sleep 86400
|
||||
continue
|
||||
fi
|
||||
|
||||
if [[ ${newer_version} > ${APP_VERSION} ]]; then
|
||||
echo "[INFO] $(date -u +'%Y-%m-%dT%H:%M:%SZ') Found newer Docker image version wahyd4/aria2-ui:${newer_version}, please consider to upgrade by using docker pull command to have better user experience."
|
||||
# check new version daily
|
||||
sleep 86400
|
||||
continue
|
||||
fi
|
||||
echo "[INFO] $(date -u +'%Y-%m-%dT%H:%M:%SZ') Congrats, you are using the latest version docker image"
|
||||
sleep 86400
|
||||
done
|
||||
@@ -1,7 +1,13 @@
|
||||
#! /bin/bash -eu
|
||||
|
||||
if [ "$RCLONE_CONFIG_BASE64" != "" ]; then
|
||||
echo "[INFO] Config Rclone from RCLONE_CONFIG_BASE64 env"
|
||||
echo $RCLONE_CONFIG_BASE64 | base64 -d > /app/conf/rclone.conf
|
||||
echo "[INFO] Config Rclone from RCLONE_CONFIG_BASE64 completed"
|
||||
fi
|
||||
|
||||
if [ "$ENABLE_RCLONE" = "true" ]; then
|
||||
echo "Start Rclone, please make sure you can connect to Github website. if not, please set docker env ENABLE_RCLONE=false"
|
||||
echo "[INFO] Start Rclone, please make sure you can connect to Github website. if not, please set docker env ENABLE_RCLONE=false"
|
||||
rclone rcd --rc-web-gui \
|
||||
--rc-web-gui-no-open-browser \
|
||||
--rc-addr :5572 \
|
||||
@@ -9,6 +15,6 @@ if [ "$ENABLE_RCLONE" = "true" ]; then
|
||||
--rc-pass $ARIA2_PWD \
|
||||
--cache-dir /app/.cache
|
||||
else
|
||||
echo "Skip starting Rclone as it's been disabled"
|
||||
echo "[INFO] Skip starting Rclone as it has been disabled"
|
||||
sleep 3650d
|
||||
fi
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
#!/bin/bash -eu
|
||||
|
||||
export APP_VERSION=$(cat /app/APP_VERSION)
|
||||
|
||||
if [ "$PGID" != "0" ]; then
|
||||
$(dirname $0)/init.sh chpst -u junv ./forego start
|
||||
else
|
||||
|
||||
Executable
+62
@@ -0,0 +1,62 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Testing Debian-optimized Docker image functionality..."
|
||||
|
||||
# Build the optimized image
|
||||
echo "Building debian-optimized image..."
|
||||
docker build -f Dockerfile.debian-optimized -t aria2-test:latest .
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "❌ Build failed!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✅ Build successful!"
|
||||
|
||||
# Start container in background
|
||||
echo "Starting container..."
|
||||
docker run -d --name aria2-test-container -p 6800:80 -p 6881:6881 aria2-test:latest
|
||||
|
||||
# Wait for startup
|
||||
echo "Waiting for services to start..."
|
||||
sleep 10
|
||||
|
||||
# Test health endpoint
|
||||
echo "Testing health endpoint..."
|
||||
if curl -f http://localhost:6800/ping >/dev/null 2>&1; then
|
||||
echo "✅ Health check passed!"
|
||||
else
|
||||
echo "❌ Health check failed!"
|
||||
echo "Container logs:"
|
||||
docker logs aria2-test-container
|
||||
docker rm -f aria2-test-container
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test AriaNg interface
|
||||
echo "Testing AriaNg interface..."
|
||||
if curl -f http://localhost:6800/ >/dev/null 2>&1; then
|
||||
echo "✅ AriaNg interface accessible!"
|
||||
else
|
||||
echo "❌ AriaNg interface not accessible!"
|
||||
fi
|
||||
|
||||
# Test aria2 RPC
|
||||
echo "Testing aria2 RPC..."
|
||||
if curl -f http://localhost:6800/jsonrpc >/dev/null 2>&1; then
|
||||
echo "✅ Aria2 RPC accessible!"
|
||||
else
|
||||
echo "❌ Aria2 RPC not accessible!"
|
||||
fi
|
||||
|
||||
# Show final image size
|
||||
echo ""
|
||||
echo "=== Final Image Size ==="
|
||||
docker images aria2-test:latest --format "table {{.Repository}}\t{{.Tag}}\t{{.Size}}"
|
||||
|
||||
# Cleanup
|
||||
echo ""
|
||||
echo "Cleaning up test container..."
|
||||
docker rm -f aria2-test-container
|
||||
|
||||
echo "✅ Functionality test completed!"
|
||||
Reference in New Issue
Block a user