A server implementation for Harmony, the ComputerCraft audio streaming service.
The following installation guide is written with arch linux in mind, please look up how to install these programs for your own distro.
Git
$ sudo pacman -S gitThe Rust toolchain
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shSetup the toolchain
$ rustup default stablePostgreSQL
$ sudo pacman -S postgresqlDiesel
$ cargo install diesel_cli --no-default-features --features postgresFFmpeg
$ sudo pacman -S ffmpegyt-dlp
$ sudo pacman -S yt-dlpSwitch to the postgresql user that the database provided
$ sudo su postgres Initialize the database
$ initdb -D /var/lib/postgres/dataStart postgresql
$ sudo systemctl enable --now postgresql.serviceCreate a PostgreSQL user (remember the credentials)
$ createuser --interactiveCreate a database for harmony which the new user can access
$ createdb harmony -O database-usernameSwitch back to your user
$ su your_user Clone this repo using git
$ git clone [repo_url]Change into the harmony-data directory
$ cd ./harmony-server/harmony-dataSetup the database with the diesel cli
$ sudo ~/.cargo/bin/diesel migration run --database-url postgres://[user_you_created]:[user_password]@localhost/harmonyGo to the root project folder
$ cd ..Create and edit the .env file
$ nano .envThe .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.
You are now ready to start the server! Simply run the server with
$ cargo run --release