1
2
mirror of https://github.com/vimagick/dockerfiles synced 2024-06-28 17:51:24 +00:00
dockerfiles/aria2/README.md

139 lines
3.1 KiB
Markdown
Raw Normal View History

2015-07-03 13:22:03 +00:00
aria2
=====
2016-03-05 13:42:38 +00:00
![](https://badge.imagelayers.io/vimagick/aria2:latest.svg)
2015-07-03 13:22:03 +00:00
- `aria2` is a utility for downloading files.
- `yaaw` is yet another aria2 web frontend.
2015-06-10 15:41:53 +00:00
2015-06-10 16:19:01 +00:00
## directory tree
```
~/fig/aria2/
├── docker-compose.yml
2015-07-03 13:22:03 +00:00
├── html/
│ ├── README.md
│ ├── TODO.md
│ ├── css/...
│ ├── img/...
│ ├── index.html
│ ├── js/...
│ └── offline.appcache
2015-07-05 04:32:56 +00:00
├── data -> /home/aria2/
2015-06-10 16:19:01 +00:00
└── keys/
├── server.crt
└── server.key
```
2015-07-05 05:13:42 +00: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 04:32:56 +00:00
2015-06-10 15:41:53 +00:00
## docker-compose.yml
2020-08-14 10:41:35 +00:00
```yaml
version: "3.8"
services:
aria2:
image: vimagick/aria2
ports:
- "6800:6800"
volumes:
- ./data:/home/aria2
- ./keys:/etc/aria2/keys
environment:
- TOKEN=e6c3778f-6361-4ed0-b126-f2cf8fca06db
restart: unless-stopped
yaaw:
image: nginx:alpine
ports:
- "8080:80"
volumes:
- ./html:/usr/share/nginx/html
restart: unless-stopped
2015-06-10 15:41:53 +00:00
```
2015-08-04 13:32:50 +00:00
## aria2.conf
2020-08-14 10:41:35 +00:00
```ini
2015-08-04 13:32:50 +00:00
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 17:02:57 +00:00
## server
2015-06-10 15:41:53 +00:00
2020-08-14 10:41:35 +00:00
```bash
2015-07-05 04:32:56 +00:00
$ mkdir -p ~/fig/aria2/{html,keys}/
2015-06-10 17:02:57 +00:00
$ cd ~/fig/aria2/
2015-07-05 04:32:56 +00:00
$ ln -s /home/aria2 data
2015-07-03 13:22:03 +00:00
$ curl -sSL https://github.com/binux/yaaw/archive/master.tar.gz | tar xz --strip 1 -C html
2015-06-10 17:02:57 +00:00
$ openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout keys/server.key -out keys/server.crt
2015-07-03 13:22:03 +00:00
$ vim docker-compose.yml
2015-06-10 17:02:57 +00:00
$ fig up -d
```
## client
2020-08-14 10:41:35 +00:00
```bash
2015-06-11 10:23:58 +00:00
$ scp server:fig/aria2/keys/server.crt /usr/local/share/ca-certificates/
$ update-ca-certificates --fresh
2015-06-10 17:02:57 +00:00
$ uuidgen
3c5323b8-79f7-49d4-8303-fcfe51488db5
2015-07-03 13:22:03 +00:00
$ http --verify no https://server:6800/jsonrpc \
2015-06-10 17:02:57 +00:00
id=3c5323b8-79f7-49d4-8303-fcfe51488db5 \
2015-06-10 15:41:53 +00:00
method=aria2.getGlobalStat \
params:='["token:e6c3778f-6361-4ed0-b126-f2cf8fca06db"]'
2015-07-03 13:22:03 +00:00
$ curl https://server:6800/jsonrpc --data '
2015-06-10 17:02:57 +00:00
{
"id": "3c5323b8-79f7-49d4-8303-fcfe51488db5",
"method": "aria2.getGlobalStat",
"params": ["token:e6c3778f-6361-4ed0-b126-f2cf8fca06db"]
}' | jq .
2015-06-10 15:41:53 +00:00
{
2015-06-10 17:02:57 +00: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 15:41:53 +00:00
}
2015-07-03 13:22:03 +00:00
$ firefox http://server:8080/
2015-07-04 16:02:15 +00: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 15:41:53 +00:00
```
2015-06-10 17:02:57 +00:00
> Please choose `CommonName` properly when generating keys.
2015-07-03 13:22:03 +00: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 13:26:30 +00:00
2015-07-05 05:13:42 +00:00
[1]: http://souptonuts.sourceforge.net/quota_tutorial.html