New GET /api/v1/art/album?artist=&album= resolves and streams an album's cover art. Lookups go through MusicBrainz release-group search then Cover Art Archive's release-group front-image endpoint, both free and keyless - no setup required by self-hosters. Results (hits, misses and errors) are cached in a new album_art table keyed case-insensitively on (artist, album), since Scrobble.mbid can't be trusted as a release identifier. The service layer separates resolving where the art is (lookup()) from fetching the bytes (fetch_image()) so a future move to storing the bytes ourselves only touches the latter. Also widens the UI's CSP (img-src) to allow blob: URLs, since the frontend will fetch art with the existing bearer-auth header and hand the browser a blob: object URL rather than hotlinking. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
129 lines
4.3 KiB
YAML
129 lines
4.3 KiB
YAML
# Core services: docker compose up (db, api, worker, ui)
|
|
# With monitoring: docker compose --profile monitoring up
|
|
# Published images: SCROBBLER_IMAGE_TAG=main docker compose up --no-build
|
|
name: scrobbler
|
|
|
|
services:
|
|
db:
|
|
image: postgres:16
|
|
environment:
|
|
POSTGRES_USER: scrobbler
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-scrobbler}
|
|
POSTGRES_DB: scrobbler
|
|
ports:
|
|
- "${DB_PORT:-5432}:5432"
|
|
volumes:
|
|
- db-data:/var/lib/postgresql/data
|
|
- ./deploy/postgres/init-test-db.sql:/docker-entrypoint-initdb.d/init-test-db.sql:ro
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U scrobbler"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 10
|
|
|
|
api:
|
|
image: ${SCROBBLER_REGISTRY:-pkgs.daubney.dev/scrobbler}/scrobbler-api:${SCROBBLER_IMAGE_TAG:-local}
|
|
build:
|
|
context: .
|
|
dockerfile: docker/api.Dockerfile
|
|
environment:
|
|
DATABASE_URL: postgresql+psycopg://scrobbler:${POSTGRES_PASSWORD:-scrobbler}@db:5432/scrobbler
|
|
SECRET_KEY: ${SECRET_KEY:-change-me}
|
|
CORS_ORIGINS: ${CORS_ORIGINS:-http://localhost:8080}
|
|
UI_BASE_URL: ${UI_BASE_URL:-http://localhost:8080}
|
|
WEB_CONCURRENCY: ${WEB_CONCURRENCY:-2}
|
|
FORWARDED_ALLOW_IPS: "*"
|
|
LASTFM_API_KEY: ${LASTFM_API_KEY:-}
|
|
MUSICBRAINZ_CONTACT: ${MUSICBRAINZ_CONTACT:-}
|
|
FEDERATION_ENABLED: ${FEDERATION_ENABLED:-0}
|
|
FEDERATION_DOMAIN: ${FEDERATION_DOMAIN:-}
|
|
FEDERATION_BASE_URL: ${FEDERATION_BASE_URL:-}
|
|
FEDERATION_KEY_SECRET: ${FEDERATION_KEY_SECRET:-}
|
|
ports:
|
|
- "${API_PORT:-5050}:8000"
|
|
expose:
|
|
- "9100" # metrics: internal network only
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
|
|
# Background work: history imports, and tasks registered by optional modules.
|
|
worker:
|
|
image: ${SCROBBLER_REGISTRY:-pkgs.daubney.dev/scrobbler}/scrobbler-api:${SCROBBLER_IMAGE_TAG:-local}
|
|
build:
|
|
context: .
|
|
dockerfile: docker/api.Dockerfile
|
|
command: ["flask", "--app", "scrobbler", "worker"]
|
|
environment:
|
|
DATABASE_URL: postgresql+psycopg://scrobbler:${POSTGRES_PASSWORD:-scrobbler}@db:5432/scrobbler
|
|
SECRET_KEY: ${SECRET_KEY:-change-me}
|
|
LASTFM_API_KEY: ${LASTFM_API_KEY:-}
|
|
FEDERATION_ENABLED: ${FEDERATION_ENABLED:-0}
|
|
FEDERATION_DOMAIN: ${FEDERATION_DOMAIN:-}
|
|
FEDERATION_BASE_URL: ${FEDERATION_BASE_URL:-}
|
|
FEDERATION_KEY_SECRET: ${FEDERATION_KEY_SECRET:-}
|
|
RUN_MIGRATIONS: "0" # the api service applies them
|
|
expose:
|
|
- "9101" # metrics: internal network only
|
|
healthcheck:
|
|
disable: true
|
|
depends_on:
|
|
api:
|
|
condition: service_healthy
|
|
|
|
ui:
|
|
image: ${SCROBBLER_REGISTRY:-pkgs.daubney.dev/scrobbler}/scrobbler-ui:${SCROBBLER_IMAGE_TAG:-local}
|
|
build:
|
|
context: .
|
|
dockerfile: docker/ui.Dockerfile
|
|
environment:
|
|
API_BASE_URL: ${API_BASE_URL:-http://localhost:5050}
|
|
# Forward the fediverse paths (/.well-known/webfinger, /users/, /inbox, ...) to the API.
|
|
API_INTERNAL_URL: ${API_INTERNAL_URL:-http://api:8000}
|
|
ports:
|
|
- "${UI_PORT:-8080}:80"
|
|
|
|
prometheus:
|
|
profiles: [monitoring]
|
|
image: prom/prometheus:v3.5.0
|
|
command:
|
|
- --config.file=/etc/prometheus/prometheus.yml
|
|
- --storage.tsdb.retention.time=30d
|
|
volumes:
|
|
- ./deploy/prometheus:/etc/prometheus:ro
|
|
- prometheus-data:/prometheus
|
|
ports:
|
|
- "${PROMETHEUS_PORT:-9090}:9090"
|
|
|
|
postgres-exporter:
|
|
profiles: [monitoring]
|
|
image: quay.io/prometheuscommunity/postgres-exporter:v0.17.1
|
|
environment:
|
|
DATA_SOURCE_URI: db:5432/scrobbler?sslmode=disable
|
|
DATA_SOURCE_USER: scrobbler
|
|
DATA_SOURCE_PASS: ${POSTGRES_PASSWORD:-scrobbler}
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
|
|
grafana:
|
|
profiles: [monitoring]
|
|
image: grafana/grafana:12.1.0
|
|
environment:
|
|
GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_ADMIN_PASSWORD:-admin}
|
|
GF_USERS_ALLOW_SIGN_UP: "false"
|
|
GF_DASHBOARDS_DEFAULT_HOME_DASHBOARD_PATH: /var/lib/grafana/dashboards/api-overview.json
|
|
volumes:
|
|
- ./deploy/grafana/provisioning:/etc/grafana/provisioning:ro
|
|
- ./deploy/grafana/dashboards:/var/lib/grafana/dashboards:ro
|
|
- grafana-data:/var/lib/grafana
|
|
ports:
|
|
- "${GRAFANA_PORT:-3000}:3000"
|
|
depends_on:
|
|
- prometheus
|
|
|
|
volumes:
|
|
db-data:
|
|
prometheus-data:
|
|
grafana-data:
|