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