I wrote a step-by-step guide to deploy the HoneyComb node using Docker. Many people found it very useful and were able to run a node without any technical expertise. A few people approached me asking if there is a possibility to run the node without using Docker as they are not familiar with Docker. They also expressed challenges when they wanted to run multiple instances of the node.
This guide will be useful for people who would like to run the HoneyComb node (SPK claim node) without using docker. We are going to use pm2 to run the node in the background. Pm2 is a utility to run node apps in the background. It comes with lot more facilities to monitor the node, automatic restart, etc. Let's go step by step.
Step 1: Prerequisites and Server setup
You can refer to my previous article for this information. It is pretty much the same. There are no changes as far as I know. We can jump to the next step.
Step 2: Install Nodejs and Pm2
Pm2 is a package inside Nodejs, so it is mandatory to install node js. Even in the docker approach, the application was running only with the help of Nodejs but Docker would handle installing it and running it inside the container. Now that we are going to run it directly, we have to first install nodejs.
The documentation recommends from version 10 to version 15 but I did install version 16 and it appears to be fine. For Ubuntu, I usually go to the below link and grab the commands to download and install it.
https://github.com/nodesource/distributions/blob/master/README.md
It should be pretty much straightforward. If you are having trouble installing Nodejs, please leave a comment in this article and I will elaborate on this step.
After installing nodejs, we can check the version of nodejs and npm using the below command.
node -v
npm -v
Now the next task is to install pm2. The below command can be used to install pm2.
npm install -g pm2
This command will install pm2 globally. This means we will be able to use pm2 not only for this node js application but also for any node application we would like to deploy.
Step 3: Getting the latest code and updating the .env file
After cloning the latest code from the repository, we have to run the below command to install the packages. This command will install all the dependencies that are required for the node.
npm install
Updating the .env file is also similar to what we do with docker. The procedure is the same. You can refer to the previous documentation to update the environment file.
Step 4: Starting the application
This part is a little different. We are going to be using pm2 to run the application. The below command can be used to start the application.
pm2 start index.js --name spkcc --time
This command will start the node. We can also run the node without using pm2 using the below command.
node index.js
But the problem is, when we close the console, the application will stop. That is the reason why we have to run the application using a process manager like Pm2.
Final Optional steps
With this, the node should be successfully running. Whenever there is an update, it is also easy to update the code and run the updated version of the node. The following commands will be useful for that.
git pull
pm2 restart spkcc
This basically pulls the latest code and restarts the node. You can either do it manually or schedule these commands or automate this command using a shell script.
If you like what I'm doing on Hive, you can vote me as a witness with the links below.
|
|
|
|
|
|
Posted with STEMGeeks
LOL in my experience both nodejs and docker can bring problems in installation! but good alternative that you brought
!1UP
Thank you for this awesome guide. Saving it and hopefully will be able to try it out one day hehe. Cheers!
Came from LN
great tutorial. thanks man!
How are you dear friend @balaz good afternoon
Excellent tutorial, very practical, I really appreciate that you have shared this information
have a great weekend
Your content has been voted as a part of Encouragement program. Keep up the good work!
Use Ecency daily to boost your growth on platform!
Support Ecency
Vote for new Proposal
Delegate HP and earn more
Congratulations @balaz! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s):
Your next target is to reach 700 upvotes.
You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word
STOP
To support your work, I also upvoted your post!
Check out the last post from @hivebuzz:
Support the HiveBuzz project. Vote for our proposal!
This post has been manually curated by @bhattg from Indiaunited community. Join us on our Discord Server.
Do you know that you can earn a passive income by delegating to @indiaunited. We share 100 % of the curation rewards with the delegators.
Here are some handy links for delegations: 100HP, 250HP, 500HP, 1000HP.
Read our latest announcement post to get more information.
Please contribute to the community by upvoting this comment and posts made by @indiaunited.
You have received a 1UP from @gwajnberg!
@stem-curator, @vyb-curator, @pob-curator, @neoxag-curator, @pal-curator
And they will bring !PIZZA 🍕
Learn more about our delegation service to earn daily rewards. Join the family on Discord.
Thank you for sharing this amazing post on HIVE!
Your content got selected by our fellow curator @priyanarc & you just received a little thank you via an upvote from our non-profit curation initiative!
You will be featured in one of our recurring curation compilations and on our pinterest boards! Both are aiming to offer you a stage to widen your audience within and outside of the DIY scene of hive.
Join the official DIYHub community on HIVE and show us more of your amazing work and feel free to connect with us and other DIYers via our discord server: https://discord.gg/mY5uCfQ !
If you want to support our goal to motivate other DIY/art/music/homesteading/... creators just delegate to us and earn 100% of your curation rewards!
Stay creative & hive on!
Thanks for the guide!
!discovery 47
This post was shared and voted inside the discord by the curators team of discovery-it
Join our community! hive-193212
Discovery-it is also a Witness, vote for us here
Delegate to us for passive income. Check our 80% fee-back Program
Congratulations @balaz!
You raised your level and are now a Minnow!
Support the HiveBuzz project. Vote for our proposal!
Thanks for the step-by-step guide. Very useful information presented in a straight forward way.
Like this can a Hive Nod be deployed and run without using a docker? If yes, could you kindly provide a step-by-step guide for the not-so-tech-savvy Hivians to try it?