From Bootstrap to Shoestring: Transforming Symbol Node Operations

## 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](https://pypi.org/project/symbol-shoestring/).

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:

```bash
# 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:

```bash
python3 -m shoestring
```

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

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/539995/4d609c80-e35c-ee45-22a0-f44d48d43ea2.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:

```bash
mkdir symbol
```

- Launch the Wizard:

```bash
python3 -m shoestring.wizard
```

## Configuration Steps

### 1. Setup:
- Follow the wizard's steps, starting with `setup`.

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/539995/13032be7-bfcc-6b51-8b21-1ba5e5b696a9.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](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/539995/d9d8fa7e-e683-48ea-fc38-1cbc247bab69.png)

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/539995/22e6e12e-4b57-459b-e586-1658657233cd.png)

### 3. Select Network:
- Choose 'mainnet' if you're running a node on the mainnet.

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/539995/682ff094-5b29-cd3a-6c71-97e00c092889.png)


### 4. Node Type:
- The wizard provides two options for node types. For others, manual setup is required.

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/539995/d50bc503-9d91-df70-b344-34d721adaa4e.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](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/539995/b3ba87cc-d772-5a13-f4d8-2220962e0f06.png)


### 6. Voter settings:
- Skip this step if your account balance does not meet the requirements.

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/539995/7623252e-2427-dadd-0921-5b3727882eac.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](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/539995/969a2856-f4ae-7a66-8888-548077f2fbf9.png)


### 8. CA Name + Cert:
- You can rename these or keep the default settings.

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/539995/23a79d53-eeae-1c39-b8be-28eb5b22e33f.png)

### Final Review:

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

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/539995/21702e1d-a522-6e8e-6604-d22bde437ba4.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:

```bash
python3 -m shoestring init --package mainnet mainnet.ini
```

### 2. Edit the mainnet.ini File:

- Open the file using:

```bash
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:

```bash
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:

```bash
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:

```bash
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:

```bash
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.