Starting A Live Stream Server from Scratch
Intro
This tutorial will set up a live stream server from scratch with Docker, Nginx, Git & Github, SSH, and Coffee. All you need is:
- A Computer connected to the Internet
- 1 hour
- $9 dollars
- Some programming knowledge (e.g how to npm install and ssh?)
Initial Setup
1. Choose a provider, I prefer dynadot.com where you can buy .top domain for less than $5, but you can find others.
2. Purchase hosting. vpsag.com has offers such that $3.5 gets you 2 GB RAM, 20GB Storage Server in EU :) Select Ubuntu 20.04 and build a server. Note down the IP.
3. Using IP from step 2, Update hosting. Add "A Record" with IP as value. Doing this early gives it time to propagate.
Local Setup
We will be using WebRTC Video/Audio Broadcast by Gabriel Tanner 👏.
4. Clone this repository to your local machine.
5. npm install then node server
6. Visit localhost:4000/broadcast.html to start broadcasting. On a different tab/browser visit localhost:4000 to live stream.
Host Setup
Our host will use Git, Nginx Server, and Docker as well as SSH.
7. After logging in, create this folder /var/repo/live-stream.git and open it.
8. Type git init --bare to initialize an empty repository.
9. Create/Open this file /var/repo/live-stream.git/hooks/post-receive and add the following contents:
10. Create the following folder and leave empty
11. Type the following:
12. Install LetsEncrypt and Nginx.
13. Create the Nginx server block for your application /etc/nginx/sites-enabled/live-stream
14. Test your nginx configuration: sudo nginx -t and restart it sudo systemctl restart nginx. You can use docker here too 👺
15. Secure domain with Certbot. Ensure you redirect HTTP to HTTPS.
15. On Local Machine open where you cloned this GitHub repo via Terminal and add remote and push:
Conclusion
With great power comes great responsibility. If you are having challenges, please reach out I will be glad to assist.
Comments
Post a Comment