~serra/Soil

Backend for hypnos
Implement user deletion
Properly handle missing session cookie
Merge branch 'user_api'

clone

read-only
https://git.sr.ht/~serra/Soil
read/write
git@git.sr.ht:~serra/Soil

You can also use your local clone with git send-email.

#Hypnos - The selfhosted audio cloud

Hypnos allows you to listen to your music from anywhere in the world, where you have access to an internet connection.

It uses the embedded tags in your files to determine the audio metadata. Cover art is supported via external files in the same directory as the songs.

Screenshot - AlbumList - Desktop Screenshot - Album - Desktop Screenshot - Album - Mobile

#How it works

Hypnos consists of two parts.

A backend called Soil. It reads your audio library on startup and saves the found Songs into a Postgresql database. It provides an API which you can use to get information about your audio library. The backend will transparently transcode your songs for playback using ffmpeg.

There is also a frontend called Solanum. It runs in the browser and allows you to browse your library and play songs.

#Features

  • Transcode songs on the fly.
  • Reuse the tags of your songs.
  • Support for album art.
  • LibreJS compatible.
  • Responsive UI

#Supported Files

Currently the following files are supported:

Songs:

  • .flac
  • .mp3
  • .wv

Cover Art:

  • .png
  • .jpg | .jpeg

#Supported Tags

Field Tags Required
Album Artist album artist, albumartist, album_artist Yes
Album Title album Yes
Song Title title Yes
Track Number track, tracknumber Yes
Disc disc No

#How to install

#Packages

On Archlinux you can use the hypnos-soil AUR package.

#Set up Soil

Checkout Soil and compile it with cargo build --release. This should result in a binary at target/release/soil. Soil is configured entirely with environment variables:

Parameter Info
DB_HOST The host of the Postgresql DB (e.g. localhost)
DB_USER Which user to connect to the DB
DB_PW Which password to use to connect to the DB
DB_NAME Which Database to connect to
LISTEN On which IP address and port to listen. Use 0.0.0.0 to listen on all interfaces
MUSIC_LIB Path to the folder containing your Songs (e.g. /srv/hypnos/music)
#Use with systemd

You might want to use systemd to launch soil. The author uses the following unit file:

# /etc/systemd/system/soil.service
[Unit]
Description=Soil - Hypnos backend
After=network.target

[Service]
User=soil
EnvironmentFile=/etc/conf.d/soil
ExecStart=/usr/bin/soil

[Install]
WantedBy=multi-user.target

#Set up Solanum

Please refer to the Solanum documentation

#Security

Soil by itself does not support https or access management. You might want to use a reverse proxy to limit access. The author uses an httpd configuration like the following

<VirtualHost _default_:443>
	ServerName your.domain.com

	SSLEngine On
	SSLCertificateFile /path/to/SSLCert
	SSLCertificateKeyFile /path/to/SSLKey

	# Serves the Solanum frontend
	DocumentRoot "/srv/http/solanum"
	<Directory /srv/http/solanum>
		AuthName "Hypnos - Come and chill"
		AuthUserFile "/etc/httpd/conf/users"
		AuthType Basic
		Header always unset Strict-Transport-Security
		Require valid-user granted
		AllowOverride None
	</Directory>

	# Serves the Soil backend
	<LocationMatch "/(albums|song/.*|cover/.*)$">
		AuthName "Hypnos - Come and chill"
		AuthUserFile "/etc/httpd/conf/users"
		AuthType Basic
		Require valid-user granted
		ProxyPassMatch http://localhost:3030/$1
		ProxyPassReverse http://localhost:3030/$1
	</LocationMatch>
</VirtualHost>

#Further information

If you encounter any bugs in either Soil or Solanum please create a ticket at https://todo.sr.ht/~serra/hypnos. You can also add feature requests there.

If you have any improvements, questions or suggestions that don't seem fit for the bugtracker please write a mail to hypnos@peterlamby.de.

If you want to contribute code please send your patches to hypnos@peterlamby.de. You can either use git-send-email to send the patches directly or just host your patches somewhere and send me a pull request via email.

Do not follow this link