hivetrending πŸ• avatar

Running a SPKCC Network Node without Docker

hivetrending

Published: 17 Aug 2022 β€Ί Updated: 17 Aug 2022Running a SPKCC Network Node without Docker

Running a SPKCC Network Node without Docker

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)

  • Go to https://dist.ipfs.io/#go-ipfs

  • 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 status online.

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 status online.
  • 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.

Leave Running a SPKCC Network Node without Docker to:

Written by

Goal: Yellow Jacket by 2026 | Hive Pizza Guild | Hive app developer | pizza.witness team

Read more #spknetwork posts


Best Posts From hivetrending πŸ•

We have not curated any of hivetrending's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From hivetrending πŸ•