Installation Guide
The purpose of the following guide is to provide detailed steps for installing the music streaming web application. With the help of this guide, you can easily set up the required environment, install the necessary dependencies, and start the application.
Requirements
In this section, you will find the hardware and software requirements needed to run the application.
Domain
Buy a domain name, we recommend to use Cloudflare. (https://www.cloudflare.com/products/registrar/ (opens in a new tab))
Server
Recommended Server Specifications
To ensure optimal performance for your music streaming web application, we recommend the following server specifications:
CPU: Quad-core processor (4 cores) Memory: 16 GB RAM Storage: 160 GB SSD
We recommend to use Hetzner Cloud. (https://www.hetzner.com/cloud/ (opens in a new tab))
DNS management
Create DNS management account, we recommend to use Cloudflare. (https://www.cloudflare.com (opens in a new tab))
Server management
Create server management account, we recommend to use RunCloud. (https://runcloud.io (opens in a new tab))
Deploy management
Create a deploying account, we recommend to use Vercel. (https://vercel.com (opens in a new tab))
Database management
Create a database management account, we recommend to use Supabase. (https://supabase.com (opens in a new tab))
Step-by-Step Installation Instructions
This section contains detailed steps for installing the application. The steps include downloading the code from GitHub, installing the necessary dependencies, setting up environment variables, and finally starting the application.
-
Deploy the "site" GitHub repository (https://github.com/skymusicdev/site (opens in a new tab)) using Vercel.
-
Add the domain name (example.app) to the "site" project on Vercel.
-
Deploy the "app" GitHub repository (https://github.com/skymusicdev/app (opens in a new tab)) using Vercel.
-
Add the sub domain name (play.example.app) to the "app" project on Vercel.
-
Add the environment variables to the Vercel project for "app," and then configure them.
-
Create Web Application (s5.example.app) on RunCloud using the following settings: Web Application Type set to Custom, Web Application Stack set to Native NGINX with Custom config, and PHP Version set to PHP 8.1.
-
Create the NGINX config to the S5 Web Application on RunCloud. Press the "Add a new config" button. Then select Predefined Config -> Proxy - Effortlessly turn NGINX into a proxy server. Next, modify the Config Content.
# Original line
# proxy_pass http://127.0.0.1:<port number of your app>;
# Modified line
proxy_pass http://127.0.0.1:5050;
-
Create Web Application (api.example.app) on RunCloud using the following settings: Web Application Type set to Custom, Web Application Stack set to Native NGINX with Custom config, and PHP Version set to PHP 8.1.
-
Create the NGINX config to the api Web Application on RunCloud. Press the "Add a new config" button. Then select Predefined Config -> Proxy - Effortlessly turn NGINX into a proxy server. Next, modify the Config Content.
# Original line
# proxy_pass http://127.0.0.1:<port number of your app>;
# Modified line
proxy_pass http://127.0.0.1:3000;
-
Install S5 according to this guide (https://docs.sfive.net/install/index.html (opens in a new tab)) into the S5 Web Application folder on the server.
-
Add this code to the config.toml file.
[accounts.database]
path = "/db/accounts"
[accounts]
enabled = true
alwaysAllowedScopes = [
'account/login',
'account/register',
's5/registry/read',
's5/metadata',
's5/debug/storage_locations',
's5/debug/download_urls',
's5/blob/redirect',
]
[store.sia]
workerApiUrl = "http://127.0.0.1:9980/api/worker"
bucket = "s5"
apiPassword = "Your renterd api password"
downloadUrl = "https://dl.example.app"
-
Add this Middleware API (https://github.com/skymusicdev/middleware (opens in a new tab)) to the api Web Application folder on the server.
-
Configure the app.js file.
Application url -> play.example.app
Development url -> dev.example.app
-
Create Web Application (renterd.example.app) on RunCloud using the following settings: Web Application Type set to Custom, Web Application Stack set to Native NGINX with Custom config, and PHP Version set to PHP 8.1.
-
Create the NGINX config to the renterd Web Application on RunCloud. Press the "Add a new config" button. Then select Predefined Config -> Proxy - Effortlessly turn NGINX into a proxy server. Next, modify the Config Content.
# Original line
# proxy_pass http://127.0.0.1:<port number of your app>;
# Modified line
proxy_pass http://127.0.0.1:9980;
-
Install renterd according to this guide (https://docs.sia.tech/renting/setting-up-renterd/linux/ubuntu (opens in a new tab)) into the server.
-
(Optional) Use the Sia Satellite and configure to renterd. (https://ss-alpha.online (opens in a new tab))
-
Create Web Application (dl.example.app) on RunCloud using the following settings: Web Application Type set to Custom, Web Application Stack set to Native NGINX with Custom config, and PHP Version set to PHP 8.1.
-
Create the NGINX config to the dl Web Application on RunCloud. Press the "Add a new config" button. Then select Predefined Config -> Proxy - Effortlessly turn NGINX into a proxy server. Next, delete the Config Content and add these code. Important! -> (You can generate the "Your renterd api password" part by encoding your Sia renterd API password to base64 (input: :APIPASSWORD) on https://gchq.github.io/CyberChef/#recipe=To_Base64('A-Za-z0-9%2B/%3D (opens in a new tab)'))
if ($request_method = 'GET') {
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
}
rewrite ^/(.*)$ /api/worker/objects/s5/$1?bucket=s5 break;
proxy_pass http://127.0.0.1:9980;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Range "";
proxy_set_header Authorization "Basic Your renterd api password";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
if ($request_method != GET) {
return 405;
}
- Navigate to the Middleware API project directory in the terminal where the app.js file is located, and run:
npm install pm2 -g
pm2 start server.js --watch
- Test all the URLs listed now to see if they work.
s5.example.app
renterd.example.app
dl.example.app
-
Add these tables to your Supabase project:
-
(Optional) Upload musics in the Admin area. (dev.example.app/admin)
-
🎉🎉🎉 Congratulations. Your web application is now live. :)
Troubleshooting
In this section, you will find common issues and their solutions. If any problems arise during the installation or running of the application, this section will help you identify and resolve the errors.
Coming soon!