DX-10: the repo invited people to clone, build and self-host while carrying no LICENSE at all — which legally means all rights reserved, so none of that was permitted. Adds the verbatim GNU AGPL-3.0 text, the SPDX id in package.json and a README section. AGPL rather than MIT deliberately: this is a server application, so the case worth covering is someone running a modified copy as a network service. DX-12: .env.example documented PLEX_MEDIA_HOST_PATH -> /plex-media and the README advertised the Plex library, but only the localdev and home compose files carried the mount — on both PUBLIC files the module could read Plex's catalogue and then fail to open a single file, because it streams the media itself rather than proxying Plex. Both api and worker now mount it read-only with an empty named volume as the fallback, and self-hosting.md gains the section that explains the server URL/token, the path map and the mount together (it had never mentioned Plex). DX-15: the worker had no init: true on either public file, though localdev and home both carry tini with the reason written out — without PID 1 reaping, a watchdog hard-kill of a download's process group orphans its ffmpeg/yt-dlp grandchildren. Verified: 'compose config' resolves on both files, the Plex mount comes out read_only: true on api and worker, and init lands on worker (not just the bgutil-pot sidecar). Gate green: vitest 671, pytest 896.
132 lines
5.3 KiB
YAML
132 lines
5.3 KiB
YAML
# Self-hosting Siftlode — pulls the prebuilt image, no source build needed.
|
|
#
|
|
# 1. Run ./install.sh (or install.ps1 on Windows) once — it generates a .env with secrets.
|
|
# 2. docker compose -f docker-compose.selfhost.yml up -d
|
|
# 3. Open the setup wizard at the URL printed in the logs:
|
|
# docker compose -f docker-compose.selfhost.yml logs api | grep SETUP
|
|
#
|
|
# The .env only needs four values (the install script generates all of them):
|
|
# POSTGRES_PASSWORD, SECRET_KEY, TOKEN_ENCRYPTION_KEY, OAUTH_REDIRECT_URL
|
|
# Everything else — the admin account, Google sign-in, SMTP — is set in the web wizard on
|
|
# first run. See docs/self-hosting.md.
|
|
|
|
services:
|
|
db:
|
|
image: postgres:16-alpine
|
|
environment:
|
|
POSTGRES_USER: ${POSTGRES_USER:-siftlode}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD must be set (run install.sh)}
|
|
POSTGRES_DB: ${POSTGRES_DB:-siftlode}
|
|
volumes:
|
|
- siftlode_pgdata:/var/lib/postgresql/data
|
|
networks: [internal]
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-siftlode} -d ${POSTGRES_DB:-siftlode}"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 12
|
|
restart: unless-stopped
|
|
|
|
api:
|
|
image: git.b1fr0st.eu/peter/siftlode:${IMAGE_TAG:-latest}
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
DATABASE_URL: postgresql+psycopg://${POSTGRES_USER:-siftlode}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB:-siftlode}
|
|
# This instance owns the background scheduler (single writer).
|
|
SCHEDULER_ENABLED: "true"
|
|
# Download center: the API serves finished files + builds filmstrips; the worker (below) runs
|
|
# the yt-dlp job loop. Read-only root is fine — it only writes to the /downloads mount + tmpfs.
|
|
DOWNLOAD_ROOT: /downloads
|
|
WORKER_ENABLED: "false"
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
networks: [internal]
|
|
ports:
|
|
# Reachable on the host's LAN at http://<host>:8080. Put a reverse proxy (Caddy/Nginx) in
|
|
# front for HTTPS / public exposure — and set OAUTH_REDIRECT_URL to the https URL.
|
|
- "${HTTP_PORT:-8080}:8000"
|
|
volumes:
|
|
# Downloaded media. Defaults to a Docker-managed named volume; set DOWNLOAD_HOST_PATH in .env
|
|
# to a host directory (e.g. one your Plex server reads) to keep the Plex-style tree there.
|
|
- ${DOWNLOAD_HOST_PATH:-siftlode_downloads}:/downloads
|
|
# Plex library, read-only. The Plex module streams files itself, so it needs to SEE them: set
|
|
# PLEX_MEDIA_HOST_PATH in .env to the host directory holding the library (the local side of the
|
|
# admin "path map", whose default is /data=/plex-media). Left unset it falls back to an empty
|
|
# named volume — harmless, and the Plex module is off by default.
|
|
- ${PLEX_MEDIA_HOST_PATH:-siftlode_plex_media}:/plex-media:ro
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
cap_drop:
|
|
- ALL
|
|
read_only: true
|
|
tmpfs:
|
|
- /tmp
|
|
healthcheck:
|
|
test: ["CMD", "python", "-c", "import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://localhost:8000/healthz').status==200 else 1)"]
|
|
interval: 15s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 30s
|
|
restart: unless-stopped
|
|
|
|
# Download worker: same image, runs the yt-dlp / ffmpeg job loop instead of the API. Shares the
|
|
# DB (job queue) and the downloads mount with the API. Not read-only (yt-dlp/deno/ffmpeg write to
|
|
# $HOME caches + the staging dir).
|
|
worker:
|
|
image: git.b1fr0st.eu/peter/siftlode:${IMAGE_TAG:-latest}
|
|
command: ["python", "-m", "app.worker"]
|
|
# tini as PID 1: reaps orphaned ffmpeg/yt-dlp grandchildren when the watchdog hard-kills a
|
|
# download child's process group (the worker reaps its own direct children via subprocess.wait).
|
|
init: true
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
DATABASE_URL: postgresql+psycopg://${POSTGRES_USER:-siftlode}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB:-siftlode}
|
|
SCHEDULER_ENABLED: "false"
|
|
DOWNLOAD_ROOT: /downloads
|
|
WORKER_ENABLED: "true"
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
# Start only after the API is healthy (it applies the DB migrations on startup), so the
|
|
# download tables exist before the worker touches them.
|
|
api:
|
|
condition: service_healthy
|
|
bgutil-pot:
|
|
condition: service_started
|
|
networks: [internal]
|
|
volumes:
|
|
- ${DOWNLOAD_HOST_PATH:-siftlode_downloads}:/downloads
|
|
# Same read-only Plex library as the API — the worker resolves library paths too.
|
|
- ${PLEX_MEDIA_HOST_PATH:-siftlode_plex_media}:/plex-media:ro
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
cap_drop:
|
|
- ALL
|
|
tmpfs:
|
|
- /tmp
|
|
restart: unless-stopped
|
|
|
|
# PO-token provider sidecar: mints YouTube Proof-of-Origin tokens so the worker beats bot-detection
|
|
# and unlocks high-quality formats (reached at http://bgutil-pot:4416, the config default).
|
|
bgutil-pot:
|
|
image: brainicism/bgutil-ytdlp-pot-provider:1.3.1
|
|
init: true
|
|
networks: [internal]
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
restart: unless-stopped
|
|
|
|
volumes:
|
|
siftlode_pgdata:
|
|
siftlode_downloads:
|
|
# Empty fallback for the Plex media mount when PLEX_MEDIA_HOST_PATH is unset (Plex module off).
|
|
siftlode_plex_media:
|
|
|
|
networks:
|
|
internal:
|