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

76 lines
1.6 KiB
Markdown
Raw Normal View History

2015-06-10 16:30:49 +02:00
`aria2` is a utility for downloading files.
2015-06-10 17:41:53 +02:00
2015-06-10 18:19:01 +02:00
## directory tree
```
~/fig/aria2/
├── docker-compose.yml
├── data/
└── keys/
├── server.crt
└── server.key
```
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-06-10 17:41:53 +02:00
- "keys:/etc/aria2"
environment:
- TOKEN=e6c3778f-6361-4ed0-b126-f2cf8fca06db
restart: always
```
2015-06-10 19:02:57 +02:00
## server
2015-06-10 17:41:53 +02:00
```
2015-06-10 19:02:57 +02:00
$ mkdir -p ~/fig/aria2/{data,keys}/
$ cd ~/fig/aria2/
$ vim docker-compose.yml
$ openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout keys/server.key -out keys/server.crt
$ 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
$ http --verify no https://datageek.info:6800/jsonrpc \
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-06-10 19:02:57 +02:00
$ curl https://datageek.info:6800/jsonrpc --data '
{
"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-06-10 19:02:57 +02:00
> Please choose `CommonName` properly when generating keys.
> `httpie` will throw error without `--verify no` option, I don't know why!