Skip to content

boreq/eggplant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

421 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Eggplant CI

Eggplant is a self-hosted music streaming service. Do you have a large music collection that you want to be able to listen to from anywhere? Simply point Eggplant at your music directory and it will make it available via your web browser. This is similar to what Jellyfin is except for music and with way fewer features.

Eggplant

Check it out

A live demo is available at music.0x46.net.

Installation

This project may be annoying to build. I recommend using Docker.

I want to use Docker

I recommend starting in an empty directory and cloning the eggplant directory into it:

$ git clone https://github.com/boreq/eggplant

The repository comes with a Dockerfile. The easiest way to use the Dockerfile is via Docker Compose.

$ ls
docker-compose.yaml eggplant

$ cat docker-compose.yaml
services:
  eggplant:
    build: ./eggplant
    volumes:
      - /host/path/to/music:/music:ro
      - /host/path/to/data:/data
      - /host/path/to/cache:/cache
    ports:
      - "8123:8118"
    restart: always

$ docker compose up

In this example Eggplant is exposed on the host system under port 8123. Normally you would then point your reverse proxy e.g. nginx at this port. If you don't want to use Docker Compose then I presume you know how to figure this out by yourself via Kubernetes or by using Docker directly based on the example above.

The layout of the music directory is documented in the section "Music directory".

I do not want to use Docker

Eggplant needs the following dependencies:

  • ffmpeg
  • ffprobe
  • libwebp

You will obtain a binary via one of the methods below but once you do you will need to generate a config file:

$ ./eggplant-linux-amd64 default_config | tee /path/to/config.toml

Then you can edit the generated config file and set the path to your music directory, data directory and cache directory. After that you can run Eggplant using the following command:

$ ./eggplant-linux-amd64 run /path/to/config.toml

I want a prebuilt binary

Prebuilt binaries are available from the actions page. Simply click on one of the builds and scroll down to the "Artifacts" section.

I want to build from source

If you prefer to suffer instead and want to build and install everything yourself then you need to ensure that you have Node version v26 and corepack as well the Go toolchain. I recommmend using nvm. Once you have that you can use the Makefile:

$ make build

Music directory

Eggplant uses the hierarchy of files and directories in your music directory to generate a music library displayed using its web interface. This means that unlike with other similar software you don't have to separately upload your music using the web interface or treat it in any special way.

Each directory inside of your music directory is treated as an album. The name of each directory is treated as an album title. The audio files inside of each of the directories are treated as tracks which belong to this album. The name of each audio file is treated as a track title. The albums can be nested however many times you want. This means that you should be able to simply use the directory in which you store all your music as your music directory. Only albums with at least one track or another album in them are displayed.

Each album can be assigned a thumbnail. For privacy reasons by default only logged in users can access your music. This can be controlled using an access file.

Thumbnails

Each album can be assigned a thumbnail. To do so simply place a file with a name equal to a thumbnail stem concatenated with a thumbnail extension eg. thumbnail.png inside of the album. The thumbnail will be automatically displayed in the user interface. This mechanism should by default support most of your thumbnails.

Access file

For privacy reasons by default each album is private and visible only to logged in users. This can be controlled at an album level using an access file. An access file applies to an album and all its children (tracks and albums inside of it). To specify if a specific album is public or not place a file eggplant.access inside of it. So far the access files support only one configuration key public with a value of yes or no.

Example eggplant.access:

public: yes

One approach is to place eggplant.access files only in the albums that you want to make public. Another is to make your entire music library public by placing an eggplant.access file in the root of your music directory. You can then limit access to specific albums placing extra eggplant.access files inside of them.

Supported thumbnail extensions

  • .jpg
  • .jpeg
  • .png
  • .gif
  • .webp

Supported thumbnail stems

  • thumbnail
  • album
  • cover
  • folder

Supported track extensions

  • .flac
  • .mp3
  • .ogg
  • .aac
  • .wav
  • .wma
  • .aiff
  • .opus

Development

Dependencies

Tools you need:

  • Go (version per backend/go.mod), the good news is that Go developers understand the phrase "backward compatibility"
  • Node (version per frontend/.nvmrc, nvm recommended), ships with corepack which provides yarn, the bad news is that Node developers have never heard the phrase "backward compatibility" in their lives
  • make, surely you have that, the good news is that compatibility is not an issue here as make has so many features nobody knows about that it would be impossible to break compatibility without breaking the entire thing

The biggest hurdle is that need Node v26. Why that version specifically? A better question is "why do Node authors hate us both for some reason?". I don't have the answer to that question but I can recommend using nvm. You should also be using corepack which ships with node and runs the right version of yarn for you. I don't know it all seems to be a bit of a mess.

Creating a config file

Generate a default config file and edit it to point at your music, data, and cache directories:

$ cd backend
$ go run cmd/eggplant/main.go default_config | tee /path/to/config.toml

Running frontend & backend locally

From the repository root:

$ make dev CONFIG=/path/to/config.toml

To expose the frontend dev server (e.g. to test from a phone, otherwise it's only accessible locally):

$ make dev-public CONFIG=/path/to/config.toml

Running CI locally

The same checks that run in the pipeline can be run locally:

$ make ci

You can run them separately as well:

$ make ci-backend
$ make ci-frontend

The backend CI target installs Go tools into $GOPATH/bin (defaults to $HOME/go/bin). Make sure that directory is on your PATH.

About

Eggplant is a self-hosted music streaming service

Topics

Resources

License

Stars

Watchers

Forks

Contributors