1
0
mirror of https://github.com/vimagick/dockerfiles.git synced 2024-12-14 11:23:02 +02:00
dockerfiles/aria2/README.md

134 lines
3.0 KiB
Markdown
Raw Normal View History

2015-07-03 15:22:03 +02:00
aria2
=====
- `aria2` is a utility for downloading files.
- `yaaw` is yet another aria2 web frontend.
2015-06-10 17:41:53 +02:00
2015-06-10 18:19:01 +02:00
## directory tree
```
~/fig/aria2/
├── docker-compose.yml
2015-07-03 15:22:03 +02:00
├── html/
│ ├── README.md
│ ├── TODO.md
│ ├── css/...
│ ├── img/...
│ ├── index.html
│ ├── js/...
│ └── offline.appcache
2015-07-05 06:32:56 +02:00
├── data -> /home/aria2/
2015-06-10 18:19:01 +02:00
└── keys/
├── server.crt
└── server.key
```
2015-07-05 07:13:42 +02:00
> You may make `data` a symbolic link to `/home/aria2` or somewhere else.
> To implement disk quota, you can even create a [virtual disk][1].
2015-07-05 06:32:56 +02:00
2015-06-10 17:41:53 +02:00
## docker-compose.yml
```
aria2:
image: vimagick/aria2
ports:
- "6800:6800"
volumes:
2015-06-11 12:23:58 +02:00
- "data:/home/aria2"
2015-08-04 15:32:50 +02:00
- "keys:/etc/aria2/keys"
# - "aria2.conf:/etc/aria2.conf"
2015-06-10 17:41:53 +02:00
environment:
- TOKEN=e6c3778f-6361-4ed0-b126-f2cf8fca06db
restart: always
2015-07-03 15:22:03 +02:00
yaaw:
image: vimagick/nginx
ports:
- "8080:80"
volumes:
- html:/usr/share/nginx/html
restart: always
2015-06-10 17:41:53 +02:00
```
2015-08-04 15:32:50 +02:00
## aria2.conf
```
dir=/home/aria2
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
```
2015-06-10 19:02:57 +02:00
## server
2015-06-10 17:41:53 +02:00
```
2015-07-05 06:32:56 +02:00
$ mkdir -p ~/fig/aria2/{html,keys}/
2015-06-10 19:02:57 +02:00
$ cd ~/fig/aria2/
2015-07-05 06:32:56 +02:00
$ ln -s /home/aria2 data
2015-07-03 15:22:03 +02:00
$ curl -sSL https://github.com/binux/yaaw/archive/master.tar.gz | tar xz --strip 1 -C html
2015-06-10 19:02:57 +02:00
$ openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout keys/server.key -out keys/server.crt
2015-07-03 15:22:03 +02:00
$ vim docker-compose.yml
2015-06-10 19:02:57 +02:00
$ fig up -d
```
## client
```
2015-06-11 12:23:58 +02:00
$ scp server:fig/aria2/keys/server.crt /usr/local/share/ca-certificates/
$ update-ca-certificates --fresh
2015-06-10 19:02:57 +02:00
$ uuidgen
3c5323b8-79f7-49d4-8303-fcfe51488db5
2015-07-03 15:22:03 +02:00
$ http --verify no https://server:6800/jsonrpc \
2015-06-10 19:02:57 +02:00
id=3c5323b8-79f7-49d4-8303-fcfe51488db5 \
2015-06-10 17:41:53 +02:00
method=aria2.getGlobalStat \
params:='["token:e6c3778f-6361-4ed0-b126-f2cf8fca06db"]'
2015-07-03 15:22:03 +02:00
$ curl https://server:6800/jsonrpc --data '
2015-06-10 19:02:57 +02:00
{
"id": "3c5323b8-79f7-49d4-8303-fcfe51488db5",
"method": "aria2.getGlobalStat",
"params": ["token:e6c3778f-6361-4ed0-b126-f2cf8fca06db"]
}' | jq .
2015-06-10 17:41:53 +02:00
{
2015-06-10 19:02:57 +02:00
"id": "3c5323b8-79f7-49d4-8303-fcfe51488db5",
"jsonrpc": "2.0",
"result": {
"downloadSpeed": "0",
"numActive": "0",
"numStopped": "0",
"numStoppedTotal": "0",
"numWaiting": "0",
"uploadSpeed": "0"
}
2015-06-10 17:41:53 +02:00
}
2015-07-03 15:22:03 +02:00
$ firefox http://server:8080/
2015-07-04 18:02:15 +02:00
#
# Settings » JSON-RPC Path:
# wss://token:e6c3778f-6361-4ed0-b126-f2cf8fca06db@server:6800/jsonrpc
#
# Firefox » Top-Right Corner:
# Aria2 1.18.10
# ↓0 KB/s / ↑0 KB/s
#
2015-06-10 17:41:53 +02:00
```
2015-06-10 19:02:57 +02:00
> Please choose `CommonName` properly when generating keys.
2015-07-03 15:22:03 +02:00
> `httpie` will throw error without `--verify no` option, I don't know why!
> Open `https://server:6800` in your browser, and accept security certificate.
2015-07-03 15:26:30 +02:00
2015-07-05 07:13:42 +02:00
[1]: http://souptonuts.sourceforge.net/quota_tutorial.html