mirror of
https://github.com/vimagick/dockerfiles.git
synced 2024-12-21 01:27:01 +02:00
update aria2
This commit is contained in:
parent
4f461507ef
commit
49b8e42f53
@ -14,11 +14,11 @@ RUN set -xe \
|
||||
&& adduser -D aria2
|
||||
|
||||
COPY ./data/aria2.conf /etc/aria2/
|
||||
VOLUME /home/aria2 /etc/aria2
|
||||
WORKDIR /home/aria2
|
||||
VOLUME /data /etc/aria2
|
||||
WORKDIR /data
|
||||
|
||||
EXPOSE 6800
|
||||
CMD set -xe \
|
||||
&& chown -R aria2:aria2 /home/aria2 \
|
||||
&& chown -R aria2:aria2 /data \
|
||||
&& gosu aria2 aria2c --conf-path=/etc/aria2/aria2.conf \
|
||||
--rpc-secret=${TOKEN}
|
||||
|
@ -3,8 +3,9 @@ aria2
|
||||
|
||||
![](https://badge.imagelayers.io/vimagick/aria2:latest.svg)
|
||||
|
||||
- `aria2` is a utility for downloading files.
|
||||
- `yaaw` is yet another aria2 web frontend.
|
||||
- [aria2][1] is a utility for downloading files.
|
||||
- [yaaw][2] is yet another aria2 web frontend.
|
||||
- [AriaNg][3] is a modern web frontend making aria2 easier to use.
|
||||
|
||||
## directory tree
|
||||
|
||||
@ -13,20 +14,17 @@ aria2
|
||||
├── docker-compose.yml
|
||||
└── data/
|
||||
├── html/
|
||||
│ ├── css/...
|
||||
│ ├── img/...
|
||||
│ ├── index.html
|
||||
│ ├── js/...
|
||||
│ └── offline.appcache
|
||||
├── keys/
|
||||
│ ├── server.crt
|
||||
│ └── server.key
|
||||
│ ├── css/
|
||||
│ ├── img/
|
||||
│ ├── js/
|
||||
│ └── index.html
|
||||
├── disk/ -> /mnt/usb/
|
||||
├── default.conf
|
||||
└── aria2.conf
|
||||
```
|
||||
|
||||
> You may make `disk` a symbolic link to `/mnt/usb` or somewhere else.
|
||||
> To implement disk quota, you can even create a [virtual disk][1].
|
||||
> To implement disk quota, you can even create a [virtual disk][5].
|
||||
|
||||
## docker-compose.yml
|
||||
|
||||
@ -40,36 +38,35 @@ services:
|
||||
ports:
|
||||
- "6800:6800"
|
||||
volumes:
|
||||
- ./data/disk:/home/aria2
|
||||
- ./data/keys:/etc/aria2/keys
|
||||
- ./data/aria2.conf:/etc/aria2/aria2.conf
|
||||
- ./data/disk:/data
|
||||
environment:
|
||||
- TOKEN=e6c3778f-6361-4ed0-b126-f2cf8fca06db
|
||||
restart: unless-stopped
|
||||
|
||||
yaaw:
|
||||
webui:
|
||||
image: nginx:alpine
|
||||
ports:
|
||||
- "8080:80"
|
||||
volumes:
|
||||
- ./html:/usr/share/nginx/html
|
||||
- ./data/html:/usr/share/nginx/html
|
||||
- ./data/default.conf:/etc/nginx/conf.d/default.conf
|
||||
- ./data/disk:/data
|
||||
restart: unless-stopped
|
||||
```
|
||||
|
||||
## aria2.conf
|
||||
|
||||
```ini
|
||||
dir=/home/aria2
|
||||
dir=/data
|
||||
disable-ipv6=true
|
||||
enable-rpc=true
|
||||
max-download-limit=0
|
||||
max-upload-limit=0
|
||||
rpc-allow-origin-all=true
|
||||
rpc-certificate=/etc/aria2/keys/server.crt
|
||||
rpc-listen-all=true
|
||||
rpc-listen-port=6800
|
||||
rpc-private-key=/etc/aria2/keys/server.key
|
||||
rpc-secret=00000000-0000-0000-0000-000000000000
|
||||
rpc-secure=true
|
||||
seed-ratio=0
|
||||
seed-time=0
|
||||
```
|
||||
@ -77,30 +74,31 @@ seed-time=0
|
||||
## server
|
||||
|
||||
```bash
|
||||
$ mkdir -p ~/fig/aria2/data/{html,keys}/
|
||||
$ mkdir -p ~/fig/aria2/data/html
|
||||
$ cd ~/fig/aria2/data
|
||||
$ ln -s /mnt/usb disk
|
||||
$ curl -sSL https://github.com/binux/yaaw/archive/master.tar.gz | tar xz --strip 1 -C html
|
||||
$ openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout keys/server.key -out keys/server.crt
|
||||
$ cd html
|
||||
$ curl -sSL https://github.com/binux/yaaw/archive/master.tar.gz | tar xz --strip 1
|
||||
####################################################################################
|
||||
# wget https://github.com/mayswind/AriaNg/releases/download/1.2.2/AriaNg-1.2.2.zip #
|
||||
# unzip AriaNg-1.2.2.zip #
|
||||
####################################################################################
|
||||
$ vim docker-compose.yml
|
||||
$ fig up -d
|
||||
$ docker-compose up -d
|
||||
```
|
||||
|
||||
## client
|
||||
|
||||
```bash
|
||||
$ scp server:fig/aria2/keys/server.crt /usr/local/share/ca-certificates/
|
||||
$ update-ca-certificates --fresh
|
||||
|
||||
$ uuidgen
|
||||
3c5323b8-79f7-49d4-8303-fcfe51488db5
|
||||
|
||||
$ http --verify no https://server:6800/jsonrpc \
|
||||
$ http http://server:6800/jsonrpc \
|
||||
id=3c5323b8-79f7-49d4-8303-fcfe51488db5 \
|
||||
method=aria2.getGlobalStat \
|
||||
params:='["token:e6c3778f-6361-4ed0-b126-f2cf8fca06db"]'
|
||||
|
||||
$ curl https://server:6800/jsonrpc --data '
|
||||
$ curl http://server:6800/jsonrpc --data '
|
||||
{
|
||||
"id": "3c5323b8-79f7-49d4-8303-fcfe51488db5",
|
||||
"method": "aria2.getGlobalStat",
|
||||
@ -123,7 +121,7 @@ $ curl https://server:6800/jsonrpc --data '
|
||||
$ firefox http://server:8080/
|
||||
#
|
||||
# Settings » JSON-RPC Path:
|
||||
# wss://token:e6c3778f-6361-4ed0-b126-f2cf8fca06db@server:6800/jsonrpc
|
||||
# ws://token:e6c3778f-6361-4ed0-b126-f2cf8fca06db@server:6800/jsonrpc
|
||||
#
|
||||
# Firefox » Top-Right Corner:
|
||||
# Aria2 1.18.10
|
||||
@ -131,8 +129,7 @@ $ firefox http://server:8080/
|
||||
#
|
||||
```
|
||||
|
||||
> Please choose `CommonName` properly when generating keys.
|
||||
> `httpie` will throw error without `--verify no` option, I don't know why!
|
||||
> Open `https://server:6800` in your browser, and accept security certificate.
|
||||
|
||||
[1]: http://souptonuts.sourceforge.net/quota_tutorial.html
|
||||
[1]: https://github.com/aria2/aria2
|
||||
[2]: https://github.com/binux/yaaw
|
||||
[3]: https://github.com/mayswind/AriaNg
|
||||
[5]: http://souptonuts.sourceforge.net/quota_tutorial.html
|
||||
|
11
aria2/data/default.conf
Normal file
11
aria2/data/default.conf
Normal file
@ -0,0 +1,11 @@
|
||||
server {
|
||||
listen 80;
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
location /files {
|
||||
alias /data;
|
||||
autoindex on;
|
||||
index X6XewZMsmreGIxx1lCdp0Yo1X4qHTivW;
|
||||
}
|
||||
}
|
@ -7,16 +7,18 @@ services:
|
||||
ports:
|
||||
- "6800:6800"
|
||||
volumes:
|
||||
- ./data/var:/home/aria2
|
||||
- ./data/keys:/etc/aria2/keys
|
||||
- ./data/aria2.conf:/etc/aria2/aria2.conf
|
||||
- ./data/disk:/data
|
||||
environment:
|
||||
- TOKEN=e6c3778f-6361-4ed0-b126-f2cf8fca06db
|
||||
restart: unless-stopped
|
||||
|
||||
yaaw:
|
||||
webui:
|
||||
image: nginx:alpine
|
||||
ports:
|
||||
- "8080:80"
|
||||
volumes:
|
||||
- ./data/html:/usr/share/nginx/html
|
||||
- ./data/default.conf:/etc/nginx/conf.d/default.conf
|
||||
- ./data/disk:/data
|
||||
restart: unless-stopped
|
||||
|
27
aria2/nginx.conf
Normal file
27
aria2/nginx.conf
Normal file
@ -0,0 +1,27 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name aria2.example.com;
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443;
|
||||
server_name aria2.example.com;
|
||||
ssl_certificate /etc/nginx/ssl/example.com.crt;
|
||||
ssl_certificate_key /etc/nginx/ssl/example.com.key;
|
||||
|
||||
location / {
|
||||
proxy_pass http://172.17.3.25:8080;
|
||||
}
|
||||
|
||||
location /jsonrpc {
|
||||
proxy_pass http://172.17.3.25:6800;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_redirect off;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user