manga-dlp/docker/README.md

128 lines
3.4 KiB
Markdown
Raw Normal View History

2021-12-24 16:30:50 +01:00
# Docker container of manga-dlp
## Quick start
> the pdf creation only works on amd64 images, as it unfortunately is incompatible with arm64.
2021-12-24 16:30:50 +01:00
```sh
# with docker-compose
curl -O docker-compose.yml https://raw.githubusercontent.com/olofvndrhr/manga-dlp/master/docker/docker-compose.yml
# adjust settings to your needs
docker-compose up -d
# with docker run
docker run -v ./downloads:/app/downloads -v ./mangas.txt:/app/mangas.txt olofvndrhr/manga-dlp
```
2021-12-24 16:30:50 +01:00
### Change UID/GID
> The default UID and GID are 4444.
2021-12-24 16:30:50 +01:00
You can change the UID and GID of the container user simply with:
2021-12-24 16:30:50 +01:00
```yml
# docker-compose.yml
environment:
- PUID=<userid>
- PGID=<groupid>
2021-12-24 16:30:50 +01:00
```
2021-12-24 16:30:50 +01:00
```sh
docker run -e PUID=<userid> -e PGID=<groupid>
```
## Run commands in container
2022-05-29 19:11:38 +02:00
> You don't need to use the full path of manga-dlp.py because `/app` already is the working directory
2021-12-24 16:30:50 +01:00
You can simply use the `docker exec` command to run the scripts like normal.
```sh
docker exec <container name> python3 manga-dlp.py <options>
```
## Run your own schedule
2022-05-29 19:11:38 +02:00
The default config runs `manga-dlp.py` once a day at 12:00 and fetches every chapter of the mangas listed in the file
`mangas.txt` in the root directory of this repo.
2022-05-29 20:41:10 +02:00
#### The default schedule:
2022-05-29 19:11:38 +02:00
```sh
2022-05-29 20:41:10 +02:00
#!/bin/bash
python3 /app/manga-dlp.py \
--path /app/downloads \
--read /app/mangas.txt \
--chapters all \
2022-06-26 15:50:55 +02:00
--wait 2 \
--lean
2022-05-29 19:11:38 +02:00
```
To use your own schedule you need to mount (override) the default schedule or add new ones to the crontab.
2021-12-24 16:30:50 +01:00
2022-05-29 19:11:38 +02:00
> Don't forget to add the cron entries for every new schedule
2021-12-24 16:30:50 +01:00
```yml
# docker-compose.yml
volumes:
2022-05-29 20:41:10 +02:00
- ./crontab:/etc/cron.d/mangadlp # overwrites the default crontab
- ./crontab2:/etc/cron.d/something # adds a new one crontab file
2022-05-29 19:11:38 +02:00
- ./schedule1:/app/schedules/daily # overwrites the default schedule
- ./schedule2:/app/schedules/weekly # adds a new schedule
2021-12-24 16:30:50 +01:00
```
2021-12-24 16:30:50 +01:00
```sh
2022-05-29 20:41:10 +02:00
docker run -v ./crontab:/etc/cron.d/mangadlp # overwrites the default crontab
docker run -v ./crontab2:/etc/cron.d/something # adds a new one crontab file
2022-05-29 19:11:38 +02:00
docker run -v ./schedule1:/app/schedules/daily # overwrites the default schedule
docker run -v ./schedule2:/app/schedules/weekly # adds a new schedule
```
#### The default crontab file:
```sh
2022-05-29 20:41:10 +02:00
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# default crontab to run manga-dlp once a day
# and get all (new) chapters of the mangas in
# the file mangas.txt
# "/proc/1/fd/1 2>&1" is to show the logs in the container
# "s6-setuidgid abc" is used to set the permissions
0 12 * * * root s6-setuidgid abc /app/schedules/daily > /proc/1/fd/1 2>&1
2021-12-24 16:30:50 +01:00
```
2021-12-24 16:30:50 +01:00
## Add mangas to mangas.txt
If you use the default crontab you still need to add some mangas to mangas.txt. This is done almost identical to adding
your own cron schedule. If you use a custom cron schedule you need to mount the file you specified with `--read`.
2021-12-24 16:30:50 +01:00
```yml
# docker-compose.yml
volumes:
- ./mangas.txt:/app/mangas.txt
2021-12-24 16:30:50 +01:00
```
2021-12-24 16:30:50 +01:00
```sh
docker run -v ./mangas.txt:/app/mangas.txt
```
## Change download directory
Per default as in the script, it downloads everything to "downloads" in the scripts root directory. This data does not
persist with container recreation, so you need to mount it. This is already done in the quick start section. If you want
2022-05-29 19:11:38 +02:00
to change the path of the host, simply change `./downloads/` to a path of your choice.
2021-12-24 16:30:50 +01:00
```yml
# docker-compose.yml
volumes:
2022-05-29 19:11:38 +02:00
- ./downloads/:/app/downloads
2021-12-24 16:30:50 +01:00
```
2021-12-24 16:30:50 +01:00
```sh
2022-05-29 19:11:38 +02:00
docker run -v ./downloads/:/app/downloads
2021-12-24 16:30:50 +01:00
```