Set up hyperdrive served site on vps
(You can also read this on Hyper protocol here)
On your Dev system (Ubuntu/Mac)
create a new hyperdrive where you can write pages in markdown format. You can instantly preview what you write and also distribute that URL in a P2P way with other peers using
*NO setup needed for that.
add a new file/import your existing ones, open any one and press
Ctrl + B, to get a blogging + preview view in your local setup. Make edits.
copy from the URL bar, the string starting with
hyper://also, main part is the long string which is your drive key like
You want to serve the same posts over
Let's setup your blogging locally 1st
git clone https://gitlab.com/saurshaz/blogmops(A svelte powered app to read markdown based posts)-
npm i && npm run dev
the app shall be running on
http://localhost:3000- Also run
npm run build(this will give us a
__sapper__/buildfolder and we can do
node __sapper__/buildto serve the prod version)
Understand the code if you want (u shall) but important part is that your markdown files in
src/routes/blog/postswill be treated as blog-posts.- We shall have these files connected to the beaker site we had earlier. Let's do that.
Let's get the existing posts folder disappear
rm -rf src/routes/blog/posts/ src/routes/blog/posts- run
npm run devfolder, and see it fail.- Let's bring it back by connecting it to a
DO NOT try beaker auto-sync.
Auto-sync is for bringing local fie system changes into hyperdrives. we want the reverse we want this \'gotobeakerandwriteyourblogsandseedautomaticallytohttpsite\''
You'll want to map the import of content you create with same location
This is how you'll do that
hyperdrive-daemon(look below section)
hyperdrive export faa2cf86ec101ad19dea21f47279a94cfdeaff347cd4c025d3e0394503349fdb posts- (replace the drive URL /drive key to yours to display your posts)
(right now this needs to be done in a scheduled fashion every X minutes with pm2/shell script or manualy to pull in changes when there are. I'm looking for a better option. Will update this space as i get that)
~/<xx>/blogmops/src/routes/blog$ hyperdrive export faa2cf86ec101ad19dea21f47279a94cfdeaff347cd4c025d3e0394503349fdb postsExporting | =====----------------------------------- | 12% | 4/31 Content Blocks | 1 Peers
MAKE SURE YOU HAVE ATLEAST ONE SEEDER WHEN YOU ARE RUNNING THIS COMMAND
(beaker browser or other daemon)
setup hyperdrive daemon globally
npm i hyperdrive-daemon -g
- in case of
node-pre-gypissues check the permissions This may help
npm config set user 0 npm config set unsafe-perm true
hyperdrive startwill give you
Daemon started at http://localhost:3101
On a Server- get an
Ubuntu droplet from
digitalocean setup with
plesk (3 sites u can play with and more, this my 4th)
nodejs(v12.3.1) plugin on it (look up my other post)
plesk with a domain sayexample.com` and go to setup the above running app with that domainYou can use a nginx setup like this (Note that plesk generates these files automatically, so any plask change needs yopu to replace it again. keep it some place safe once it works)
Use PM2 and shell scripts
- To manage the import of new posts to your server, you could use the below scripts`blogmop-3000.sh
cd /root/code/blog && npm run build cd /root/code/blog && node __sapper__/build
To start the
sapper app do
pm2 start blogmop-3000.
pm2 start blogmop-3000.super quick.
cd /root/code/blog/src/routes/bloghyperdrive export faa2cf86ec101ad19dea21f47279a94cfdeaff347cd4c025d3e0394503349fdb posts pm2 restart blogmop-3000
To bring new content, maintain one seeder (atleast) and run
pm2 start pull-scripts.
References & Thanks
Super thanks to jsbase
beakerbrowser, for their guts
Top comments (0)