mirror of
https://github.com/wahyd4/aria2-ariang-docker.git
synced 2026-08-09 13:26:07 +10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
197b0a433f | ||
|
|
437436e9c0 | ||
|
|
ec008b29bd | ||
|
|
014bb638f3 | ||
|
|
fab62224f7 | ||
|
|
3cf974c98c | ||
|
|
0610f47717 | ||
|
|
5d4656db63 | ||
|
|
311696caa1 | ||
|
|
e3cfdf6f68 | ||
|
|
58886cfc13 | ||
|
|
dc9238fc7d | ||
|
|
8488801ec6 | ||
|
|
ce31e13a61 | ||
|
|
fc572ada3e | ||
|
|
654f8f4b3d | ||
|
|
2196929d63 |
+1
-1
@@ -1 +1 @@
|
||||
4.15.0
|
||||
5.2.1
|
||||
|
||||
@@ -10,6 +10,7 @@ redir /ui/ / 301
|
||||
redir /rclone /rclone/ 301
|
||||
redir /files /files/ 301
|
||||
|
||||
reverse_proxy /rpc 127.0.0.1:6800
|
||||
reverse_proxy /jsonrpc 127.0.0.1:6800
|
||||
|
||||
route /rclone/* {
|
||||
|
||||
@@ -4,7 +4,7 @@ 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")
|
||||
|
||||
@@ -23,6 +23,9 @@ 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)
|
||||
- [Running it on Kubernetes (My favorite)](#running-it-on-kubernetes-my-favorite)
|
||||
@@ -131,11 +134,11 @@ Then simply run `docker-compose up -d`, that's it!
|
||||
| `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 `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`. |
|
||||
| `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`. |
|
||||
|
||||
|
||||
### Supported Volumes
|
||||
@@ -148,9 +151,11 @@ Then simply run `docker-compose up -d`, that's it!
|
||||
|`/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
|
||||
|
||||
Make sure you have added proper `A` record point to the host you running to your domain `DNS` record list, then just add `e` option to bind the `https` domain when you run the image
|
||||
@@ -158,6 +163,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
|
||||
|
||||
@@ -14,6 +14,7 @@ redir /ui/ / 301
|
||||
redir /rclone /rclone/ 301
|
||||
redir /files /files/ 301
|
||||
|
||||
reverse_proxy /rpc 127.0.0.1:6800
|
||||
reverse_proxy /jsonrpc 127.0.0.1:6800
|
||||
|
||||
route /rclone/* {
|
||||
|
||||
@@ -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 "[INFO] 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 "[INFO] 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
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
echo "[INFO] Run aria2c and ariaNG"
|
||||
|
||||
echo "[INFO] Generate basic auth password for caddy"
|
||||
ARIA2_PWD_ENCRYPT=$(caddy hash-password -plaintext ${ARIA2_PWD})
|
||||
ARIA2_PWD_ENCRYPT=$(caddy hash-password --plaintext ${ARIA2_PWD})
|
||||
|
||||
case $ENABLE_AUTH in
|
||||
true)
|
||||
@@ -28,4 +28,4 @@ heroku)
|
||||
;;
|
||||
esac
|
||||
|
||||
/usr/local/bin/caddy run -config ${CADDY_FILE} -adapter=caddyfile
|
||||
/usr/local/bin/caddy run --config ${CADDY_FILE} --adapter=caddyfile
|
||||
|
||||
+24
-31
@@ -1,42 +1,35 @@
|
||||
#!/bin/bash -eu
|
||||
RCLONE_AUTO_UPLOAD_PROVIDER=google-drive
|
||||
if [[ $RCLONE_AUTO_UPLOAD_PROVIDER == "" ]]; then
|
||||
|
||||
if [[ ${RCLONE_AUTO_UPLOAD_PROVIDER} == "" ]]; then
|
||||
echo "[INFO] $(date -u +'%Y-%m-%dT%H:%M:%SZ') Auto upload isn't enabled"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ $2 -eq 0 ]; then
|
||||
echo "[WARN] $(date -u +'%Y-%m-%dT%H:%M:%SZ') No files detected"
|
||||
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: [$2], Files Path: [$3]"
|
||||
echo "[INFO] $(date -u +'%Y-%m-%dT%H:%M:%SZ') Start to upload files with: Files Count: ${file_count}, Files Path: ${file_path}"
|
||||
|
||||
path=$3 # File full path
|
||||
downloadpath='/data' # Aria2 downloading folder
|
||||
provider_name=$RCLONE_AUTO_UPLOAD_PROVIDER # RClone remote provider
|
||||
folder=$RCLONE_AUTO_UPLOAD_REMOTE_PATH # Foler path in Rclone remote provider
|
||||
MinSize=$RCLONE_AUTO_UPLOAD_FILE_MIN_SIZE # Set mininum file size to be uploaded, files smaller than this will be deleted without uploading
|
||||
MaxSize=$RCLONE_AUTO_UPLOAD_FILE_MAX_SIZE # Set the Max file size to be uploaded
|
||||
folder=${file_path%/*}
|
||||
|
||||
while true; do #提取下载文件根路径,如把/data/a/b/c/d.jpg变成/data/a
|
||||
file_path=$path
|
||||
path=${path%/*}
|
||||
if [ "$path" == "" ]; then #不在下载文件夹
|
||||
exit 0
|
||||
elif [ "$path" == "$downloadpath" ] && [ $2 -eq 1 ]; then # To handle single file
|
||||
rclone move "$file_path" ${provider_name}:${folder}/
|
||||
echo "[INFO] $(date -u +'%Y-%m-%dT%H:%M:%SZ') Successfully uploaded file $file_path"
|
||||
exit 0
|
||||
elif [ "$path" == "$downloadpath" ]; then # To handle folder
|
||||
while [[ "$(ls -A "$file_path/")" != "" ]]; do
|
||||
rclone move "$file_path"/ ${provider_name}:${folder}/"${file_path##*/}"/ --delete-empty-src-dirs --min-size $MinSize --max-size $MaxSize
|
||||
|
||||
echo "[INFO] $(date -u +'%Y-%m-%dT%H:%M:%SZ') Successfully uploaded file $file_path"
|
||||
|
||||
rclone delete -v "$file_path" --max-size $MinSize # Delete files smaller than min file.
|
||||
done
|
||||
rm -rf "$file_path/"
|
||||
exit 0
|
||||
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
|
||||
done
|
||||
echo "[INFO] $(date -u +'%Y-%m-%dT%H:%M:%SZ') Successfully uploaded ${file_count} files ${file_path}"
|
||||
fi
|
||||
|
||||
+5
-5
@@ -2,10 +2,10 @@
|
||||
|
||||
echo "[INFO] Set variables for $(arch)"
|
||||
|
||||
caddy_version=2.4.6
|
||||
filebrowser_version=v2.21.1
|
||||
rclone_version=v1.58.0
|
||||
ariang_version=1.2.3
|
||||
caddy_version=2.6.4
|
||||
filebrowser_version=v2.23.0
|
||||
rclone_version=v1.62.2
|
||||
ariang_version=1.3.4
|
||||
|
||||
case "$(arch)" in
|
||||
|
||||
@@ -37,7 +37,7 @@ 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 fuse vim --no-cache \
|
||||
&& apk add runit shadow wget bash curl openrc gnupg aria2 tar mailcap fuse vim libcap --no-cache \
|
||||
&& wget -N https://github.com/caddyserver/caddy/releases/download/v${caddy_version}/${caddy_file} \
|
||||
&& tar -zxf ${caddy_file} \
|
||||
&& mv caddy /usr/local/bin/ \
|
||||
|
||||
Reference in New Issue
Block a user