Add Docker Compose deployment
compose.yaml runs playlistd with a Postgres database. Settings come from .env (see .env.example), and Postgres must be healthy before playlistd starts. The Dockerfile builds the web UI with Node and the server with Rust, then copies both into a Debian slim image that runs as an unprivileged user. It also installs the latest yt-dlp (with its YouTube scripts) and Deno, the JavaScript runtime yt-dlp needs for YouTube. playlistd's port is only published on 127.0.0.1 by default, since it has no login. The image can't reach a database during the build, so the SQL query data from `cargo sqlx prepare` is now committed in .sqlx/. Builds with DATABASE_URL set still check queries against that database. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018opPJMJjLWr4RqdG6vuK6p
This commit is contained in:
42 files changed
+1633
No files matched your search
@@ -0,0 +1,47 @@
|
||||
# playlistd and its database. Copy .env.example to .env, fill it in, then run:
|
||||
# docker compose up -d --build
|
||||
name: playlistd
|
||||
|
||||
services:
|
||||
playlistd:
|
||||
build:
|
||||
context: .
|
||||
# podman would otherwise pick Containerfile, which builds the .deb
|
||||
dockerfile: Dockerfile
|
||||
image: playlistd
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
# playlistd has no login, so by default it's only reachable from this machine
|
||||
- "${PLAYLISTD_BIND:-127.0.0.1}:${PLAYLISTD_PORT:-8000}:8000"
|
||||
environment:
|
||||
DATABASE_URL: postgres://playlistd:${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env}@db/playlistd
|
||||
SUBSONIC_BASE: ${SUBSONIC_BASE:?Set SUBSONIC_BASE in .env}
|
||||
SUBSONIC_USERNAME: ${SUBSONIC_USERNAME:?Set SUBSONIC_USERNAME in .env}
|
||||
SUBSONIC_PASSWORD: ${SUBSONIC_PASSWORD:?Set SUBSONIC_PASSWORD in .env}
|
||||
LISTENBRAINZ_TOKEN: ${LISTENBRAINZ_TOKEN:-}
|
||||
DAEMON_INTERVAL: ${DAEMON_INTERVAL:-240}
|
||||
LOG_LEVEL: ${LOG_LEVEL:-info}
|
||||
# lets SUBSONIC_BASE point at a server on the Docker host: http://host.docker.internal:4533/rest
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
db:
|
||||
image: postgres:16-alpine
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_USER: playlistd
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env}
|
||||
POSTGRES_DB: playlistd
|
||||
volumes:
|
||||
- db:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD", "pg_isready", "-U", "playlistd", "-d", "playlistd"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 20
|
||||
|
||||
volumes:
|
||||
db:
|
||||
Reference in new issue
Block a user