User Tools

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
services:spotizerr [2025/03/25 07:23] – created willyservices:spotizerr [2025/05/30 07:14] (current) willy
Line 1: Line 1:
 ====== Spotizerr ====== ====== Spotizerr ======
  
-[[https://github.com/Xoconoch/spotizerr|Spotizerr]] is ...+[[https://github.com/Xoconoch/spotizerr|Spotizerr]] is an amazing self-hosted web service that let's you download and search for music from Deezer and Spotify.
  
 +While i **do not recomend** to use it, as it's against those services ToS, it seems to be working pretty well at least if you have a premium account.
  
  
 ===== Installation ===== ===== Installation =====
  
 +Sporizerr is provided as a docker image that can be easily run with rootless podman. Due to this, it's important to properly setup credentials and storage locations.
 +
 +As usual, create a dedicated user and associate it to the //media// group so that downloaded files will be accessible to the other media services:
 <code bash> <code bash>
 useradd -d /data/daemons/spotizerr -m spotizerr -g media useradd -d /data/daemons/spotizerr -m spotizerr -g media
 mkdir /data/Media/spotizerr mkdir /data/Media/spotizerr
-mkdir /data/Media/spotizerr/creds 
-mkdir /data/Media/spotizerr/config 
 mkdir /data/Media/spotizerr/downloads mkdir /data/Media/spotizerr/downloads
 mkdir /var/log/spotizerr mkdir /var/log/spotizerr
-chown spotizerr:media /data/Media/spotizerr -R 
 chown spotizerr:media /var/log/spotizerr chown spotizerr:media /var/log/spotizerr
 su - spotizerr su - spotizerr
-wget https://raw.githubusercontent.com/Xoconoch/spotizerr/refs/heads/main/docker-compose.yaml+wget https://raw.githubusercontent.com/Xoconoch/spotizerr/refs/heads/main/docker-compose.yml
 </code> </code>
  
- +Now edit the default docker compose to adapt it to your needs. You can follow my docker compose: 
- +<file - docker-compose.yml>
-<file - docker-compose.yaml>+
 name: spotizerr name: spotizerr
- 
 services: services:
   spotizerr:   spotizerr:
     volumes:     volumes:
-      - /data/Media/spotizerr/creds:/app/creds +      - /data/daemons/spotizerr:/app/data 
-      - /data/Media/spotizerr/config:/app/config+      - /data/daemons/spotizerr/config:/app/config
       - /data/Media/spotizerr/downloads:/app/downloads         - /data/Media/spotizerr/downloads:/app/downloads  
       - /var/log/spotizerr:/app/logs         - /var/log/spotizerr:/app/logs  
Line 37: Line 36:
     container_name: spotizerr-app     container_name: spotizerr-app
     environment:     environment:
-#      - PUID=1000 Replace with your desired user ID  | Remove both if you want to run as root (not recommendedmight result in unreadable files) +#      - PUID=1000 podman rootless needs PUID=0or removed like this 
-#      - PGID=1000 Replace with your desired group ID | The user must have write permissions in the volume mapped to /app/downloads +#      - PGID=1000 podman rootless needs PGID=0, or removed like this 
-      - UMASK=0002 # Optional: Sets the default file permissions for newly created files within the container.+      - UMASK=0002  allow all users in media group to access music downloaded by spotizerr 
       - REDIS_HOST=redis       - REDIS_HOST=redis
       - REDIS_PORT=6379       - REDIS_PORT=6379
Line 67: Line 66:
   spotizerr-net: {}   spotizerr-net: {}
 </file> </file>
 +
 +PUID and PGID sohuld be omitted or set to 0, because i am using rootless podman and not docker. This ensure that the user running the container is actually the //spotizerr// user, which is what we want.
 +
 +Now pull the image:
 +<code bash>
 +podman compose pull
 +</code>
 +
 +
 +===== Reverse Proxy =====
 +
 +Spotizerr seems to be working only on subdomain and not on subpath. I assume you have **spotizerr.mydomain.com**. See the [[selfhost:nginx|F) The Reverse Proxy concept]] for more details.
 +
 +<file - spotizerr.conf>
 +server {
 +        server_name spotizerr.mydomain.com;
 +        listen 443 ssl;
 +        listen 8443 ssl;
 +        http2 on;
 +
 +        access_log /var/log/nginx/spotizerr.mydomain.com_access_log main;
 +        error_log /var/log/nginx/spotizerr.mydomain.com_error_log info;
 +
 +        include "com.mydomain/authelia_location.conf";
 +
 +        location / {
 +                include "com.mydomain/authelia_proxy.conf";
 +                include "com.mydomain/authelia_authrequest.conf";
 +                proxy_pass http://127.0.0.1:7171/;
 +                proxy_set_header Connection $http_connection;
 +                proxy_set_header Upgrade $http_upgrade;
 +        }
 +
 +        include org.gardiol/certbot.conf;
 +}
 +
 +Please note that Spotizerr does not provide **any** authentication or protection: you **must** put your SSO (see [[selfhost:sso|here]]) and HTTPS on top of it using the reverse proxy as in the above config example.
 +</file>
 +
 +
 +===== Configuration =====
 +
 +Setup Spotizerr require a few steps: 
 +  * Setup spotify login
 +  * Enable spotify API
 +  * Setup deezer ARL token
 +
 +Spotify has a serious rate limiting, so i strongly suggest you also setup a Deezer account.
 +
 +See [[https://github.com/Xoconoch/spotizerr?tab=readme-ov-file#spotify-credentials-setup|this page]] for the specific instructions.
 +
 +**Note:** you //must// enable "real time downloading" in settings to reduce API rate limiting from Spotify.
 +
 +=== Step 1: authenticate with Spotify ===
 +
 +You need to setup and run **librespot-auth**. The instructions are quite simple and can be run anywhere, not necessarily on the server itself:
 +<code bash>
 +it clone --depth 1 https://github.com/dspearson/librespot-auth.git
 +cargo build --release
 +# Alternatively, using podman: "podman run --rm -v "$(pwd)/librespot-auth":/app -w /app rust:latest cargo build --release"
 +./librespot-auth/target/release/librespot-auth --name "mySpotifyAccount1" --class=computer
 +</code>
 +
 +On Gentoo you should have cargo by default (it's part of rust) so you don't need to run a container for that.
 +
 +The above command will create a file called //credentials.json//, similar to the following:
 +<code>
 +{"username": "my username" "auth_type": 1 "auth_data": "a long string"}
 +</code>
 +
 +Now open Spotizerr, go to the settings (the whell icon in the lower left corner) and add the Spotify account:
 +  * name: whatever you want
 +  * username: copy "my username" from the json file
 +  * credentials: copy "a long string" from the json file
 +
 +=== Step 2: link Spotify API === 
 +
 +At this point, go to [[https://developer.spotify.com|Spotify developer console]] and login with your user. Create a new app, use the following data:
 +  * app name: something that make sense for you
 +  * app description: same as above
 +  * website: not needed, leave blank
 +  * redirect URI: https://spotizerr.mydomain.com/callback
 +  * API/SDK: i checked them all, that is probably not needed YMMV
 +  * i unrestand and agree: check, of course
 +
 +Save, and copy both **ClientID** and **ClientSecret** strings. You need togo to Spotizerr page and add the two strings in your Spotify account API configuration.
 +
 +That's it! You can start searching and downloading stuff.
 +
 +=== Step 3: setup Deezer ===
 +
 +Open your browser, login to Deezer. Open the developer console (see your browser instructions... i suggest you use Firefox for this) go to the //storage// tab and copy the ARL cookie text string under the //deezer.com// domain. 
 +
 +Go to Spotizerr config, add a new Deezer account and paste the ARL cookie text string. You can give any name you want to the account.
 +
 +
 +===== Autostart =====
 +
 +
 +To start it, and set it up on boot, as usual follow my indications [[gentoo:containers|Using Containers on Gentoo]], so link the **user-containers** init script:
 +<code>
 +ln -s /etc/init.d/user-containers /etc/init.d/user-containers.spotizerr
 +</code>
 +
 +and create the following config file:
 +<file - user-containers.spotizerr>
 +USER=spotizerr
 +DESCRIPTION="Spotify donwloader"
 +</file>
 +
 +Add the service to the default runlevel and start it now:
 +<code bash>
 +/etc/init.d/user-containers.spotizerr start
 +rc-update  user-containers.spotizerr
 +</code>
 +
 +
 +===== Logrotate =====
 +
 +Add log rotation to Spotizerr logs. Drop the following under **/etc/logrotate.d**:
 +<file - spotizer>
 +/var/log/spotizerr/* {
 +    missingok
 +    notifempty
 +}
 +</file>
 +

This website uses technical cookies only. No information is shared with anybody or used in any way but provide the website in your browser.

More information