Skip to content

fiamma-chain/operator_for_linux

Repository files navigation

Fiamma Operator for Linux

This guide will help you set up and run the Fiamma Operator on Linux systems. The process involves four simple steps:

Setup Process

Step 1: Clone the Repository

First, clone the repository to your local machine:

git clone https://github.com/fiamma-chain/operator_for_linux.git
cd operator_for_linux

Step 2: Prepare the Environment

Run the setup script to install all dependencies and prepare your environment:

./setup.sh

Important: After the first execution of setup.sh, you need to enable the Rust environment variables:

source "$HOME/.cargo/env"

Alternatively, you can restart your terminal or run:

source ~/.bashrc
# or if you're using zsh:
source ~/.zshrc

This script will:

  • Install required packages (build-essential, gcc, g++, libssl-dev)
  • Install and configure PostgreSQL
  • Install Docker and Docker Compose (if not already installed)
  • Install Rust and SQLx CLI
  • Create a default .env file from .env_example
  • Start database and Redis containers
  • Set execute permissions on scripts

Next, run database migrations to set up the required database schema:

cd dal && cp .env.example .env && sqlx migrate run && cd ..

Step 3: Configure Environment Variables

Edit the .env file and set the following important keys:

vim .env

Make sure to update these required private keys:

BITVM_BRIDGE_OPERATOR_AUTH_SK=your_auth_private_key
BITVM_BRIDGE_OPERATOR_PEGIN_SK=your_pegin_private_key
BITVM_BRIDGE_OPERATOR_PEGOUT_SK=your_pegout_private_key

These private keys are essential for the Operator to function correctly and should not be the same.

Step 4: Start the Operator

Run the start script to set up and start the Operator as a system service:

./start_operator.sh

This script will:

  • Create a systemd service for the Operator
  • Configure it to run in the current directory
  • Start the service and verify it's running
  • Set up appropriate logs

Managing the Operator

View Status

sudo systemctl status fiamma-operator

View Logs

tail -f .logs/bitvm-operator/bitvm-operator.$(date +%Y-%m-%d).log

Restart the Service

sudo systemctl restart fiamma-operator

Stop the Service

sudo systemctl stop fiamma-operator

Upgrading the Operator

To upgrade your Fiamma Operator to the latest version, follow these steps:

Step 1: Verify Database Status

Ensure the database Docker container is running:

sudo docker ps | grep postgres

Step 2: Pull Latest Updates

Pull the latest code from the repository:

git pull

Step 3: Update Database Schema

Run database migrations to apply any schema changes:

cd dal && sqlx migrate run && cd ..

Step 4: Restart the Operator Service

Restart the Fiamma Operator service to apply updates:

sudo systemctl restart fiamma-operator

Step 5: Verify Upgrade

Check that the operator is running correctly after the upgrade:

sudo systemctl status fiamma-operator

Note: Always backup your data before performing upgrades, especially in production environments.

Troubleshooting

If you encounter issues:

  1. Verify the database and Redis are running:

    sudo docker ps | grep postgres
    sudo docker ps | grep redis
  2. Check if the environment variables are set correctly in the .env file.

  3. Ensure the operator binary has execute permissions:

    chmod +x fiamma-operator
  4. Check the logs for specific errors:

    tail -f .logs/bitvm-operator/bitvm-operator.$(date +%Y-%m-%d).log

About

operator binary setup and start for linux

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages