20
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

nem / symbolAdvent Calendar 2023

Day 14

From Bootstrap to Shoestring: Transforming Symbol Node Operations

Last updated at Posted at 2023-12-14

Introduction

Have you ever heard of Shoestring tools? it’s a lightweight development tool designed to generate all the necessary configurations for Symbol client.

In this article, I'll introduce two ways to migrate from Bootstrap to Shoestring, each catering to different user needs and expertise levels.

Migrate to Shoestring using wizard

  • This method is user-friendly and simplifies the complex steps into just a few clicks. It's ideal for those who prefer ease of use. However, it does have limitations, such as less flexibility in modifying or adding additional property information.

Migrate to Shoestring Manually

  • While this approach is a bit more complex, it offers greater flexibility. It's well-suited for advanced users who require customization in their setting properties.

By the end of this guide, you’ll have a clear understanding of both methods, allowing you to choose the one that best fits your needs and technical proficiency.

Why Shoestring

If you’re currently running a node, you might wonder why you should use Shoestring instead of Symbol-bootstrap, especially if you haven’t encountered any issues with Symbol-bootstrap.

Here are some reasons why switching to Shoestring could be beneficial:

Aspect Bootstrap Shoestring
Ownership & Updates Maintained by a third party, which may cause update delays. Maintained by the Core team, ensuring timely updates.
Software Requirements Requires Node.js installation. Utilizes pre-installed Python.
Release Synchronization Each client release requires a corresponding Bootstrap release. Client configuration is moved to packages (sai/mainnet) hosted on GitHub, independent of releases.
User-Friendliness No Wizard Features a Wizard for easier use by novices.

As you can see, Shoestring is a more streamlined tool that generates all the required config files without needing to install additional software. Following best IT practices, it's advisable to minimize the amount of software on production servers. Shoestring aligns with this principle by offering a simpler, more efficient alternative.

Installation Requirements

Before starting the node, it's essential to ensure that your server meets the necessary specifications.

Here are the specifications for my server:

Ubuntu 22.04.3 LTS (GNU/Linux 6.2.0-1012-aws x86_64)
Python 3.10

Python Libraries

Install the necessary Python libraries and tools:

# Install Python libraries and SSL development files
sudo apt install python3.10-venv python3-pip libssl-dev

# Install OpenSSL for generating PEM file CA
sudo apt install openssl

# Create a virtual Python environment for Shoestring
python3 -m venv node-venv

# Activate the virtual environment
source node-venv/bin/activate

# Install Shoestring
pip install symbol-shoestring

Note: If your server is only use for Symbol client, you can set the virtual python env in profile.

example:
nano ~/.bashrc
add PATH="/your-path/node-venv/bin:$PATH” in end of the file
source ~/.bashrc

Verification

After installation, run the following command to check if everything is set up correctly:

python3 -m shoestring

You should see an output indicating that Shoestring is running properly.

image.png

Migration Options to Shoestring

When it comes to migrating to Shoestring for managing your Symbol nodes, you have two primary methods to choose from: using the Shoestring Wizard for a guided experience, or manually setting up for those who prefer a more hands-on approach. Each method has its advantages and caters to different levels of user experience and comfort with node configuration.

Migrate to Shoestring using wizard

Shoestring features a user-friendly wizard interface in the terminal, making migration smooth and straightforward.

Initial Setup

  • Create a folder to store the configuration files generated by the wizard:
mkdir symbol
  • Launch the Wizard:
python3 -m shoestring.wizard

Configuration Steps

1. Setup:

  • Follow the wizard's steps, starting with setup.

image.png

2. Generate CA:

  • Ensure the symbol directory exists.
  • Keep the default CA PEM file name or modify it as needed.
  • Import your main account private key (recommend to do it offline).

image.png

image.png

3. Select Network:

  • Choose 'mainnet' if you're running a node on the mainnet.

image.png

4. Node Type:

  • The wizard provides two options for node types. For others, manual setup is required.

image.png

5. Harvester settings:

  • View your current Bootstrap config:
cat target/nodes/node/server-config/resources/config-harvesting.properties
  • Update the configuration in the wizard based on your existing settings.

image.png

6. Voter settings:

  • Skip this step if your account balance does not meet the requirements.

image.png

7. Node settings:

  • View your Bootstrap config:
cat target/nodes/node/server-config/resources/config-node.properties
  • Enter your domain name or IP address and a friendly name for the node.

image.png

8. CA Name + Cert:

  • You can rename these or keep the default settings.

image.png

Final Review:

  • Double-check all configurations as they vary for each user.

image.png

Once you complete the setup, Shoestring will generate all configurations into the symbol folder.

Completing the Setup

  • Shoestring will generate all necessary configurations in the symbol folder.

Migrate to Shoestring Manually

1. Generate the Configuration File:

  • Execute the following command to create the mainnet.ini file:
python3 -m shoestring init --package mainnet mainnet.ini

2. Edit the mainnet.ini File:

  • Open the file using:
nano mainnet.ini
  • In the [node] section, configure the settings as per your requirements. Here’s an example configuration:
[node]

# Set this based on your preference
# features it supports: API | PEER | HARVESTER | VOTER
# API - REST support
# PEER - Peer support
# HARVESTER - Node will be configured to harvest and accept delegated harvesters
# VOTER - Node will be configured to vote

features = API | HARVESTER # Set this based on your preference
userId = 1000
groupId = 1000
caPassword =
apiHttps = false # Set to true if you have a domain name

caCommonName = any-name-ca # Choose a preferred name
nodeCommonName = any-name-node # Choose a preferred name

Note: for features, you should choose either API or PEER.

3. Generate a PEM File:

  • To generate a PEM file, it required main account private key hex, run:
python3 -m shoestring pemtool --output ca.key.pem

4. Create the overrides.ini File:

  • This file will override settings in the config. Create and edit it with:
nano overrides.ini
  • Content:
[node.localnode]

host: hostname.com # Use your domain or IP address
friendlyName: Hello World # Choose a preferred name

5. Verify Your Files:

  • ensure the following files are present:
    • ca.key.pem
    • node-venv
    • overrides.ini
    • sai.ini

6. Generate Node Configuration:

  • Create a directory and generate the node configuration:
mkdir ~/symbol
python3 -m shoestring setup --package mainnet --ca-key-path ca.key.pem --config mainnet.ini --overrides override.ini --directory ~/symbol

Starting Your Node

1. Stop the Bootstrap Node:

symbol-bootstrap stop

2. Start the Node with Shoestring Configuration:

cd symbol
docker-compose up -d

Troubleshooting

  • If you encounter a network error like:
failed to create network catapult-node-network: Error response from daemon: Pool overlaps with other one on this address space.
  • Remove the conflicting network in Docker:
docker network ls # list network

docker network inspect <network_id> # check which one is using network `172.20.0.0/24`

docker network rm <network_id>

Conclusion

The article primarily aims to highlight the differences between Bootstrap and Shoestring, considering that Bootstrap is more commonly used. It offers guidance through either a wizard-based or a manual approach, allowing you to choose the one that suits you best.

I hope this article can assists you in transitioning smoothly to Shoestring. If you encounter any issues during setup, please feel free to contact me.

Lastly, thank you for taking the time to read this article.

20
11
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
20
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?