1
0
mirror of https://github.com/vimagick/dockerfiles.git synced 2024-11-28 09:08:50 +02:00
dockerfiles/aria2/README.md
2021-09-07 11:26:11 +08:00

2.8 KiB

aria2

  • aria2 is a utility for downloading files.
  • yaaw is yet another aria2 web frontend.
  • AriaNg is a modern web frontend making aria2 easier to use.

directory tree

~/fig/aria2/
├── docker-compose.yml
└── data/
    ├── 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.

docker-compose.yml

version: "3.8"

services:

  aria2:
    image: vimagick/aria2
    ports:
      - "6800:6800"
    volumes:
      - ./data/aria2.conf:/etc/aria2/aria2.conf
      - ./data/disk:/data
    environment:
      - TOKEN=e6c3778f-6361-4ed0-b126-f2cf8fca06db
    restart: unless-stopped

  webui:
    image: vimagick/ariang
    ports:
      - "8080:80"
    restart: unless-stopped

aria2.conf

dir=/data
disable-ipv6=true
enable-rpc=true
max-download-limit=0
max-upload-limit=0
rpc-allow-origin-all=true
rpc-listen-all=true
rpc-listen-port=6800
rpc-secret=00000000-0000-0000-0000-000000000000
seed-ratio=0
seed-time=0

server

$ mkdir -p ~/fig/aria2/data/html
$ cd ~/fig/aria2/data
$ ln -s /mnt/usb disk
$ 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
$ docker-compose up -d

client

$ uuidgen
3c5323b8-79f7-49d4-8303-fcfe51488db5

$ http http://server:6800/jsonrpc \
       id=3c5323b8-79f7-49d4-8303-fcfe51488db5 \
       method=aria2.getGlobalStat \
       params:='["token:e6c3778f-6361-4ed0-b126-f2cf8fca06db"]'

$ curl http://server:6800/jsonrpc --data '
       {
         "id": "3c5323b8-79f7-49d4-8303-fcfe51488db5",
         "method": "aria2.getGlobalStat",
         "params": ["token:e6c3778f-6361-4ed0-b126-f2cf8fca06db"]
       }' | jq .

{
  "id": "3c5323b8-79f7-49d4-8303-fcfe51488db5",
  "jsonrpc": "2.0",
  "result": {
    "downloadSpeed": "0",
    "numActive": "0",
    "numStopped": "0",
    "numStoppedTotal": "0",
    "numWaiting": "0",
    "uploadSpeed": "0"
  }
}

$ firefox http://server:8080/
#
# Settings » JSON-RPC Path:
#   ws://token:e6c3778f-6361-4ed0-b126-f2cf8fca06db@server:6800/jsonrpc
#
# Firefox » Top-Right Corner:
#   Aria2 1.18.10
#   ↓0 KB/s / ↑0 KB/s
#