Skip to content

Run Spotisub using Docker

Fabio Valentino edited this page Sep 20, 2024 · 12 revisions

Executing program

Run as Flask App with docker compose:

cd /opt/projects/spotisub
docker compose up

Using with Navidrome

Sample docker-compose file using Navidrome

services:
    navidrome:
        container_name: navidrome
        image: deluan/navidrome:latest
        user: 1000:1000
        ports:
            - "4533:4533"
        environment:
            ND_SCANSCHEDULE: "@every 1m"
            ND_LOGLEVEL: "info"
            ND_SESSIONTIMEOUT: "24h"
            ND_BASEURL: "/music"
            ND_MUSICFOLDER: /music
            ND_PLAYLISTSPATH: playlist
            ND_SPOTIFY_ID: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
            ND_SPOTIFY_SECRET: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
            ND_LASTFM_APIKEY: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
            ND_LASTFM_SECRET: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
            ND_ENABLETRANSCODINGCONFIG: true
            ND_MAXSIDEBARPLAYLISTS: 50
        volumes:
            - "./data:/data"
            - "/music:/music:ro"
        deploy:
            restart_policy:
                condition: on-failure
                delay: 5s
                max_attempts: 3
                window: 120s
        networks:
            - ndspotisubnet
        labels:
            - "com.centurylinklabs.watchtower.enable=true"
    spotisub:
        container_name: spotisub
        environment:
            - SPOTIPY_CLIENT_ID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
            - SPOTIPY_CLIENT_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
            - SPOTIPY_REDIRECT_URI=http://127.0.0.1:8080/
            - SUBSONIC_API_BASE_URL=/music
            - SUBSONIC_API_HOST=http://navidrome
            - SUBSONIC_API_PORT=4533
            - SUBSONIC_API_USER=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
            - SUBSONIC_API_PASS=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
            - ITEMS_PER_PLAYLIST=100
            - NUM_USER_PLAYLISTS=5
            - ARTIST_GEN_SCHED=2
            - RECOMEND_GEN_SCHED=8
            - PLAYLIST_GEN_SCHED=6
            - SAVED_GEN_SCHED=24
            - SCHEDULER_ENABLED=1
            - SPOTDL_ENABLED=0
            - SPOTDL_FORMAT="/music/{artist}/{artists} - {album} ({year}) - {track-number} - {title}.{output-ext}"
            - LOG_LEVEL=20
        image: "blastbeng/spotisub:latest"
        pull_policy: build
        build:
          context: ./spotisub
          dockerfile: Dockerfile
        restart: always
        networks:
            - ndspotisubnet
        volumes:
            - "./cache:/home/user/spotisub/cache"
        #    - "/path/to/your/music:/music" !!! REQUIRED IF SPOTDL IS ENABLED !!!
        ports:
            - 5183:5183
        healthcheck:
            test: curl -s http://127.0.0.1:5183/utils/healthcheck | grep -q 'Ok!' || exit 1
            interval: 30s
            retries: 20
            start_period: 30s
        labels:
            - "com.centurylinklabs.watchtower.enable=true"
networks:
  ndspotisubnet: