Use Rclone to mount Onedrive song files, and deploy Navidrome to build a website using Docker.
Rclone#
First, you need to run it on a Windows system to obtain the configuration, and then install and mount the files on the server.
Get Token#
Download Rclone on your Windows computer, download link: https://rclone.org/downloads/
After downloading, extract the files. Once the extraction is complete, navigate to the folder using cmd and run the following command:
rclone.exe authorize "onedrive"
Login and authorize in the browser that pops up. After authorization, the Token will be printed (including the curly braces).
Get Configuration File#
Run the command:
rclone.exe config
Choose according to your needs. After completion, the configuration file will be generated at:
C:\Users\%USERNAME%\AppData\Roaming\rclone
Copy Configuration File#
First, create two folders on the server:
# This folder contains the configuration file
/home/docker/rclone/config
# This folder contains the data, i.e., the folder mapped to Onedrive
/home/docker/rclone/data
Then, place the configuration file in the corresponding folder.
Mount Directory#
Run the command to pull the image:
docker pull rclone/rclone:latest
Mount the directory:
docker run --rm \
--volume /root/rclone/config:/config/rclone \
--volume /root/rclone/data:/data:shared \
--volume /etc/passwd:/etc/passwd:ro --volume /etc/group:/etc/group:ro \
--device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined \
rclone/rclone \
mount music:/ /data/music --allow-other --allow-non-empty --vfs-cache-mode writes &
# The above command is only the last line for the Rclone command. Modify it according to the actual situation. The format is as follows:
rclone mount DriveName:Folder LocalFolder
# DriveName: The name of the Rclone mount
# Folder: The path of the cloud drive
# LocalFolder: The file mounted locally
The &
at the end of the above command indicates running in the background. After executing the command, the PID of the process will be printed. To close it, use the command:
kill PID
Want to learn more? Visit: Chapter 6 of Linux Learning: Managing Running Processes
Based on the example, here we demonstrate mounting the music
directory (case-insensitive) in Onedrive to /home/docker/rclone/data/music
References:
- https://rclone.org/onedrive/
- https://rclone.cn/install.html
- Mounting OneDrive or GoogleDrive using Rclone on Linux and Setting Up Auto Start
Deploy Navidrome#
Using docker-compose, first create a folder, for example:
/home/docker/navidrome
Create a file docker-compose.yml
and fill in the content:
vim docker-compose.yml
# Enter the content
version: "3"
services:
navidrome:
image: deluan/navidrome:latest
ports:
- "8001:4533"
restart: unless-stopped
environment:
# Optional: put your config options customization here. Examples:
ND_SCANSCHEDULE: 1h
ND_LOGLEVEL: info
ND_SESSIONTIMEOUT: 24h
ND_BASEURL: ""
volumes:
- "/home/docker/navidrome/data:/data"
- "/home/docker/rclone/data/music:/music:ro"
View more variables: Navidrome Configuration Options | Navidrome
Then run the command:
docker-compose up -d
Access IP:8001
to use.
References:
Song Information#
If you want to categorize songs, you need to embed song information, including lyrics, into the songs.
You can use the tool MusicTag to modify them.
Author's website: Music Tag PC Version
Of course, there are other tools available, or you can use this web version: xhongc/music-tag-web
Using Clients#
This web version works fine on PC, but it's not very user-friendly on mobile. Fortunately, there are some clients available.
For more details, visit: https://www.navidrome.org/docs/overview/#apps