Hi All,
I wanted to share some useful tips for SPKCC node operators. I observed some stability issues on my server and experimented with a different setup that seems more stable (for the pizza.spk server).
The default configuration for SPKCC nodes uses docker-compose. A docker-compose.yml file describes 2 containers to run in a cluster, one is for IPFS and one is for the Honeycomb NodeJS application. While the "configuration as code" design of docker-compose is very convenient, I experienced some stability issues with the IPFS Docker container and decided to move away from it.
It takes a little more effort, but it's possible to set up your server to run the node without Docker in the picture. go-ipfs is installed natively (no container), and managed by the popular PM2 (advanced process manager for production Node.js applications). Here's how you can do the same.
With this set up you can easily share the IPFS resource between multiple nodes. For example, if you want to run a DLUX node, a DUAT (Ragnarok) node, and a SPKCC node on the same box, they can all share the single IPFS resource.
1. Install NodeJS and PM2
First, you need to install NodeJS and PM2 on the server. This is straightforward. Use your Linux distro's package manager to install NodeJS.
Then, to install PM2, run:
npm install pm2 -g
2. Set up IPFS (non-Docker)
Download tarball (choose appropriate option for your OS/arch)
Untar, cd to the extracted folder
Run ./install.sh
Run
ipfs init --profile server
- The server profile option is recommended for running in a data center. Using this profile will prevent IPFS from trying to discover local nodes, and reduce network traffic. Some hosting providers also have a policy against running IPFS, unless you use the server profile.
Run
pm2 start "ipfs daemon" --name ipfs
Check status using command
pm2 status ipfs
. The output should say statusonline
.
3. Configure Honeycomb-spkcc to talk to your local instance of IPFS
By default, the honeycomb software will try to talk to a public IPFS node. These public nodes often have rate limiting which causes problems for honeycomb. It is highly preferred to use an instance of IPFS on the local server.
- If you haven't already, clone the honeycomb-spkcc github repo.
git clone https://github.com/spknetwork/honeycomb-spkcc
- CD into the
honeycomb-spkcc
directory - Call
npm install
to install dependencies - Create / add to your .env file in the honeycomb-spkcc dir, like below:
account="yournodehiveaccount"
active=5K...
mspublic=STM5...
msowner=5J...
domain=https://spkcc.yourdomain.com
ipfshost=0.0.0.0
ipfsport=5001
ipfsprotocol=http
The ipfs*
lines tell honeycomb to talk to your local IPFS instance instead of 3rd party endpoint.
After setting up the .env configuration file, launch the node in PM2.
pm2 start index.js --name spkcc
- Check status using command
pm2 status spkcc
. The output should say statusonline
. - Check logs and make sure the node is starting up ok
pm2 logs spkcc
.
Bonus: Auto-update script for Non-Docker Set up
Node operators can also set up a script to automatically upgrade their node. The sequence of commands varies between Docker set up and non-Docker set up.
Save one of the below scripts to a .sh file like update_spkcc.sh
file
Use crontab -e
to add a cron job like 15 * * * * /home/user/update_spkcc.sh
. This will check for updates every 15 minutes.
Note: replace user
with your account name.
update_spkcc.sh for non-Docker version:
cd /home/user/honeycomb-spkcc/
update=`git pull`
if [ "$update" == "Already up to date." ]
then
exit 0
return
fi
npm i
pm2 restart spkcc
Docker version of update_spkcc.sh
cd /home/user/honeycomb-spkcc/
update=`git pull`
if [ "$update" == "Already up to date." ]
then
exit 0
return
fi
docker-compose down
docker-compose build
docker-compose --compatibility up -d
I hope this helps node operators and the stability of the SPKCC network. Please consider delegating LARYNX Power to pizza.spk
, which is the node I operate. See also: https://hiveuprss.github.io/spkccmonitor/, which is our tool for monitoring the SPKCC network. This tool has gone through several iterations of improvement in the last few weeks.
Learn more at https://hive.pizza.
@hivetrending! The Hive.Pizza team manually curated this post.Congratulations @hivetrending! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s):
Your next target is to reach 1500 replies.
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
Support the HiveBuzz project. Vote for our proposal!
Think it might be worth it to give instructions on how to join the ipfs swarm as well since that thing looks like it does help out.
Thanks for the suggestion, I will add a new section for that.
The Hivebuzz proposal already got important support from the community. However, it lost its funding a few days ago and only needs a few more HP to get funded again.
May we ask you to support it so our team can continue its work this year?
You can do it on Peakd, ecency, or using HiveSigner.
Your support would be really appreciated.
Thank you!Dear @hivetrending, we need your help!