This guide will help you set up and run the Fiamma Operator on Linux systems. The process involves four simple steps:
First, clone the repository to your local machine:
git clone https://github.com/fiamma-chain/operator_for_linux.git
cd operator_for_linux
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 ..
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.
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
sudo systemctl status fiamma-operator
tail -f .logs/bitvm-operator/bitvm-operator.$(date +%Y-%m-%d).log
sudo systemctl restart fiamma-operator
sudo systemctl stop fiamma-operator
To upgrade your Fiamma Operator to the latest version, follow these steps:
Ensure the database Docker container is running:
sudo docker ps | grep postgres
Pull the latest code from the repository:
git pull
Run database migrations to apply any schema changes:
cd dal && sqlx migrate run && cd ..
Restart the Fiamma Operator service to apply updates:
sudo systemctl restart fiamma-operator
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.
If you encounter issues:
-
Verify the database and Redis are running:
sudo docker ps | grep postgres sudo docker ps | grep redis
-
Check if the environment variables are set correctly in the
.env
file. -
Ensure the operator binary has execute permissions:
chmod +x fiamma-operator
-
Check the logs for specific errors:
tail -f .logs/bitvm-operator/bitvm-operator.$(date +%Y-%m-%d).log