Thursday, July 28, 2022

How To: create a persistent seeder server using Webtorrent


{ if (error) { console.error("error", error.message) return; } if (stderr) { console.error(stderr) } if (stdout) { console.log(stdout) } }) Exit and save the file using :wq in the nano editor. Now lets turn this into a service!pm2 start ./app.js pm2 saveThat's it! To check that the service is running you can do pm2 ls and check that there is an entry for app.js.Congrats! You now have an always on seeding service. You can confirm this by issuing a restart command to your VPS and notice both the app.js process is running using pm2 ls.Step 5: Making a video player that will play the contentHere is a stripped down html version of a video player for your magnet uri link:

Movie player loading....

Next StepsYou could of course, create a multi-seeder tool that spawns one process per video and serve an entire library of content. This is apparently what Bitchute and PeerTube do.Also, hopefully by sharing this how-to, Feross, the creator of WebTorrent will be inspired to update the docs on how to run a seed server. It took me weeks to figure all this out and the result was this How-To.Thanks to Feross for a great software stack." title="How To: create a persistent seeder server using Webtorrent">full image
- Repost: How To: create a persistent seeder server using Webtorrent (from Reddit.com, How To: create a persistent seeder server using Webtorrent)
Who is this forThis is for people that want to put up a content on the internet and have it reliably served to everyone, even if the computer restarts. The best computers for this are the private virtual systems (VPS) like you can buy on Digital Ocean for $4/month. Also, servers on the internet are better because they are designed to be accessible, where your home computer network could be behind a restrictive NAT that makes connecting to other clients impossible.Also... don't try and make this seeding tool into a docker app. The major docker hosts like Digital Ocean and Render.com will KILL THE WEBSOCKET CONNECTIONS (due to security concerns) and there's no work-around that I've found. I've burned weeks trying to make it happen and I've given up on it for now.Step 1: Get a VPS on Digital OceanGet the cheapest one, which will have 500GB of storage, which is plenty to start out with. Once you have this machine up and running, use the access console to ssh into the machine through the web browser (or ssh if you know how to configure your keys).Install the following dependencies on the VPS.apt-get python3 pip3 node npm -yMake sure that you have python installed on your own computer (Windows/MacOS/Ubuntu), because we will use it later.Step 2: Upload your content to the VPSMake sure that you have python installed on both your VPS and your home computer.Next prepare the content for serving, let's call it movie.mp4. We will use magic-wormhole on both server and local computer to transfer the file, since that's the easiest way I've found it to work.Magic Wormhole to transfer the filepip install magic-wormholeOn the local machine: wormhole send myfile.mp4, you will get a command to run, something like wormhole receive waddle-coffee-pancake, paste this exactly into the remote computer and the file will be uploaded to the server.Step 3: Install webtorrent-hybrid, which will act as the seeding serverOn the remote machine install the webtorrent-hybrid command: npm install -g node-pre-gyp webtorrent-cli webtorrent-hybrid and hit enter.Once that is installed you should test seeding by using the following command:webtorrent-hybrid seed myfile --keep-seeding --port 80 -qAnd wait for the magnet uri to be printed. Save the magnet uri.Now test this link by pasting it into instant.io and verifying that the movie loads within 10 seconds.Congrats! Now you have a magnet uri that will work (most) everywhere. However we aren't done yet. As soon as your close your SSH session your seeding process will also be killed. To make a service which will always be alive, go to the next step.Step 4: Using pm2 magic to create an always on seeder service.Creating a service is normally requires advanced skills. Luckily this has all been made too easy with the excellent tool called pm2. So let's install it: npm install -g pm2In the current VPS shell, make a new file: nano ./app.js and edit it so that it has the following:const { exec } = require('child_process') // // EDIT THIS const FILE_PATH = "myfile.mp4" // // const CMD = `webtorrent-hybrid seed ${FILE_PATH} --keep-seeding --port 80 -q` exec(CMD, (error, stdout, stderr) => { if (error) { console.error("error", error.message) return; } if (stderr) { console.error(stderr) } if (stdout) { console.log(stdout) } }) Exit and save the file using :wq in the nano editor. Now lets turn this into a service!pm2 start ./app.js pm2 saveThat's it! To check that the service is running you can do pm2 ls and check that there is an entry for app.js.Congrats! You now have an always on seeding service. You can confirm this by issuing a restart command to your VPS and notice both the app.js process is running using pm2 ls.Step 5: Making a video player that will play the contentHere is a stripped down html version of a video player for your magnet uri link:

Movie player loading....

Next StepsYou could of course, create a multi-seeder tool that spawns one process per video and serve an entire library of content. This is apparently what Bitchute and PeerTube do.Also, hopefully by sharing this how-to, Feross, the creator of WebTorrent will be inspired to update the docs on how to run a seed server. It took me weeks to figure all this out and the result was this How-To.Thanks to Feross for a great software stack.


Mining:
Bitcoin, Cryptotab browser - Pi Network cloud PHONE MINING
Fone, cloud PHONE MINING cod. dhvd1dkx - Mintme, PC PHONE MINING


Exchanges:
Coinbase.com - Stex.com - Probit.com


Donations:
Done crypto



Comments System

Disqus Shortname

Disqus Shortname

designcart
Powered by Blogger.