update README and docker-compose configuration

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
TonyBlur 2026-05-01 10:24:22 +08:00
parent 3c32421b2a
commit 6656efabba
2 changed files with 153 additions and 14 deletions

View file

@ -1,6 +1,3 @@
## Fork note
This project is forked from [alexta69/metube](https://github.com/alexta69/metube).
# MyTube
![Build Status](https://github.com/TonyBlur/mytube/actions/workflows/main.yml/badge.svg)
@ -23,6 +20,8 @@ docker run -d -p 8081:8081 -v /path/to/downloads:/downloads ghcr.io/tonyblur/myt
## 🐳 Run using docker-compose
Save the following to `docker-compose.yml` in your working directory, update `/path/to/downloads` to your desired download location, then run `docker-compose up -d`:
```yaml
services:
mytube:
@ -33,25 +32,44 @@ services:
- "8081:8081"
volumes:
- /path/to/downloads:/downloads
environment:
- PUID=1000
- PGID=1000
- MAX_CONCURRENT_DOWNLOADS=3
```
A complete [docker-compose.yml](docker-compose.yml) with all available configuration options is included in the repository. Use it as a template for advanced setups, or quickly start with:
```bash
docker-compose up -d
```
Logs can be viewed with:
```bash
docker-compose logs -f mytube
```
## ⚙️ Configuration via environment variables
Certain values can be set via environment variables, using the `-e` parameter on the docker command line, or the `environment:` section in docker-compose.
### Setting environment variables
You can also load variables from files:
* Docker CLI supports `--env-file /path/to/.env`.
* The container entrypoint auto-loads `/app/.env` if present, and also loads a custom file when `ENV_FILE` points to it.
**Docker CLI:** `docker run -e PORT=9000 -e MAX_CONCURRENT_DOWNLOADS=5 ghcr.io/tonyblur/mytube`
**docker-compose:** Add `environment:` section with key-value pairs (see [docker-compose.yml](docker-compose.yml) for examples).
**From .env file:** `docker-compose --env-file .env up` or mount `/path/to/.env:/app/.env:ro` in volumes.
### Available variables
### ⬇️ Download Behavior
* __MAX_CONCURRENT_DOWNLOADS__: Maximum number of simultaneous downloads allowed. For example, if set to `5`, then at most five downloads will run concurrently, and any additional downloads will wait until one of the active downloads completes. Defaults to `3`.
* __DELETE_FILE_ON_TRASHCAN__: if `true`, downloaded files are deleted on the server, when they are trashed from the "Completed" section of the UI. Defaults to `false`.
* __DEFAULT_OPTION_PLAYLIST_ITEM_LIMIT__: Maximum number of playlist items that can be downloaded. Defaults to `0` (no limit).
* __SUBSCRIPTION_DEFAULT_CHECK_INTERVAL__: Default minutes between automatic checks for each subscription. Defaults to `60`.
* __SUBSCRIPTION_SCAN_PLAYLIST_END__: Maximum playlist/channel entries to fetch per subscription check (newest-first). Defaults to `50`.
* __SUBSCRIPTION_MAX_SEEN_IDS__: Cap on stored video IDs per subscription to limit state file growth. Defaults to `50000`.
* __CLEAR_COMPLETED_AFTER__: Number of seconds after which completed (and failed) downloads are automatically removed from the "Completed" list. Defaults to `0` (disabled).
* __MAX_CONCURRENT_DOWNLOADS__: Max simultaneous downloads. Defaults to `3`.
* __DELETE_FILE_ON_TRASHCAN__: Delete files when trashed from UI. Defaults to `false`.
* __DEFAULT_OPTION_PLAYLIST_ITEM_LIMIT__: Max playlist items to download. Defaults to `0` (no limit).
* __SUBSCRIPTION_DEFAULT_CHECK_INTERVAL__: Minutes between subscription checks. Defaults to `60`.
* __SUBSCRIPTION_SCAN_PLAYLIST_END__: Max playlist/channel entries per check. Defaults to `50`.
* __SUBSCRIPTION_MAX_SEEN_IDS__: Cap on stored video IDs per subscription. Defaults to `50000`.
* __CLEAR_COMPLETED_AFTER__: Seconds until auto-removing completed downloads. Defaults to `0` (disabled).
### 📁 Storage & Directories
@ -393,3 +411,6 @@ docker build -t mytube .
```
Note that if you're running the server in VSCode, your downloads will go to your user's Downloads folder (this is configured via the environment in `.vscode/launch.json`).
## 🍴 Fork note
This project is forked from [alexta69/metube](https://github.com/alexta69/metube).

118
docker-compose.yml Normal file
View file

@ -0,0 +1,118 @@
version: '3.8'
services:
mytube:
image: ghcr.io/tonyblur/mytube
container_name: mytube
restart: unless-stopped
ports:
- "8081:8081"
volumes:
# Required: download directory (matches DOWNLOAD_DIR, STATE_DIR, TEMP_DIR)
- /path/to/downloads:/downloads
# Optional: environment configuration file
# - /path/to/.env:/app/.env:ro
# Optional: yt-dlp global options file
# - /path/to/ytdl-options.json:/config/ytdl-options.json:ro
# Optional: yt-dlp presets file
# - /path/to/ytdl-presets.json:/config/ytdl-presets.json:ro
# Optional: HTTPS certificates (if HTTPS=true)
# - /path/to/ssl/crt.pem:/ssl/crt.pem:ro
# - /path/to/ssl/key.pem:/ssl/key.pem:ro
# Optional: custom robots.txt
# - /path/to/robots.txt:/etc/robots.txt:ro
environment:
# === Container Setup ===
# - PUID=1000
# - PGID=1000
# - UMASK=022
# - DEFAULT_THEME=auto
# - LOGLEVEL=INFO
# - ENABLE_ACCESSLOG=false
# === Directory Configuration ===
# - DOWNLOAD_DIR=/downloads
# - STATE_DIR=/downloads/.metube
# - TEMP_DIR=/downloads
# - AUDIO_DOWNLOAD_DIR=/audio
# === Web Server ===
# - HOST=0.0.0.0
# - PORT=8081
- PUBLIC_MODE=false
# - URL_PREFIX=/mytube/
# - PUBLIC_HOST_URL=download/
# - PUBLIC_HOST_AUDIO_URL=audio_download/
# - HTTPS=false
# - CERTFILE=/ssl/crt.pem
# - KEYFILE=/ssl/key.pem
# - CORS_ALLOWED_ORIGINS=
# - ROBOTS_TXT=
# === Download Behavior ===
# - MAX_CONCURRENT_DOWNLOADS=3
# - DELETE_FILE_ON_TRASHCAN=false
# - DEFAULT_OPTION_PLAYLIST_ITEM_LIMIT=0
# - SUBSCRIPTION_DEFAULT_CHECK_INTERVAL=60
# - SUBSCRIPTION_SCAN_PLAYLIST_END=50
# - SUBSCRIPTION_MAX_SEEN_IDS=50000
# - CLEAR_COMPLETED_AFTER=0
# === File Naming & Output ===
# - OUTPUT_TEMPLATE=%(title)s.%(ext)s
# - OUTPUT_TEMPLATE_CHAPTER=%(title)s - %(section_number)02d - %(section_title)s.%(ext)s
# - OUTPUT_TEMPLATE_PLAYLIST=%(playlist_title)s/%(title)s.%(ext)s
# - OUTPUT_TEMPLATE_CHANNEL=%(channel)s/%(title)s.%(ext)s
# === yt-dlp Options ===
# - YTDL_OPTIONS={}
# - YTDL_OPTIONS_FILE=/config/ytdl-options.json
# - YTDL_OPTIONS_PRESETS={}
# - YTDL_OPTIONS_PRESETS_FILE=/config/ytdl-presets.json
# - ALLOW_YTDL_OPTIONS_OVERRIDES=false
# === Directory Features ===
# - CUSTOM_DIRS=true
# - CREATE_CUSTOM_DIRS=true
# - DOWNLOAD_DIRS_INDEXABLE=false
# - CUSTOM_DIRS_EXCLUDE_REGEX=(^|/)[.@].*$
# - CHOWN_DIRS=true
# === Custom Environment File ===
# - ENV_FILE=/path/to/custom.env
healthcheck:
test: ["CMD", "curl", "-fsS", "http://localhost:${PORT:-8081}/"]
interval: 30s
timeout: 5s
retries: 3
start_period: 20s
# Optional: set working user
# user: "${PUID:-1000}:${PGID:-1000}"
# Optional: network configuration
# networks:
# - default
# Optional: resource limits
# deploy:
# resources:
# limits:
# cpus: '1'
# memory: 1G
# reservations:
# cpus: '0.5'
# memory: 512M
# Optional: define custom network
# networks:
# default:
# name: mytube-network
# driver: bridge