Skip to content

A server implementation for Harmony, the ComputerCraft audio streaming service

License

Notifications You must be signed in to change notification settings

Daxanius/harmony-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Harmony Server

A server implementation for Harmony, the ComputerCraft audio streaming service.

Installation

The following installation guide is written with arch linux in mind, please look up how to install these programs for your own distro.

Install Tools

Git

$ sudo pacman -S git

The Rust toolchain

$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Setup the toolchain

$ rustup default stable

PostgreSQL

$ sudo pacman -S postgresql

Diesel

$ cargo install diesel_cli --no-default-features --features postgres

FFmpeg

$ sudo pacman -S ffmpeg

yt-dlp

$ sudo pacman -S yt-dlp

Setup database

Switch to the postgresql user that the database provided

$ sudo su postgres 

Initialize the database

$ initdb -D /var/lib/postgres/data

Start postgresql

$ sudo systemctl enable --now postgresql.service

Create a PostgreSQL user (remember the credentials)

$ createuser --interactive

Create a database for harmony which the new user can access

$ createdb harmony -O database-username

Switch back to your user

$ su your_user 

Setup repo

Clone Repo

Clone this repo using git

$ git clone [repo_url]

Create database schema

Change into the harmony-data directory

$ cd ./harmony-server/harmony-data

Setup the database with the diesel cli

$ sudo ~/.cargo/bin/diesel migration run --database-url postgres://[user_you_created]:[user_password]@localhost/harmony

Setup Variables

Go to the root project folder

$ cd ..

Create and edit the .env file

$ nano .env

The .env file should contain the following:

# Database
DATABASE_URL=postgres://[user_you_created]:[user_password]@localhost/harmony # Never share this with anyone!

# Audio files
MAX_DOWNLOAD_FILESIZE=10M
DOWNLOAD_DIRECTORY=./temp # Make sure these folders exist on your system
SONG_DIRECTORY=./audio # Make sure these folders exist on your system

# Audio stream
STREAM_LIFETIME=10 # Determines how long a stream lives in seconds after no requests have been made to it

# JWT
JWT_SECRET=[A secret token generated by https://jwtsecret.com/ # Never share this with anyone!
JWT_TIME_VALID=[Time in seconds before a login session expires]

Replace [] with the values, then exit nano by pressing ctrl + x and then y.

Start the server

You are now ready to start the server! Simply run the server with

$ cargo run --release

About

A server implementation for Harmony, the ComputerCraft audio streaming service

Topics

Resources

License

Stars

Watchers

Forks