Running Blockbook as a systemd service on a VM

This guide provides step-by-step instructions to install FLO BlockBook on Ubuntu. It covers building the necessary files, installing BlockBook, and setting up a reverse proxy with Nginx and Certbot for SSL. You can either build the files from scratch or download pre-built files from the releases page. The pre-built files are specifically built for Ubuntu and need not be built again.

Table of Contents

  1. Building the Files
  2. Installing BlockBook
  3. Viewing the BlockBook Webpage
  4. Checking if Services are Running
  5. Provisioning with Terraform and Ansible

Building the Files

Prerequisite

Docker is required to build BlockBook. You can install Docker using the following guides:

You can either build the files from scratch using the following steps or download pre-built files from the releases page.

# Clone the BlockBook repository:
git clone https://github.com/ranchimall/blockbook

# Navigate to the blockbook directory:
cd blockbook

# Build deb files for FLO mainnet
make all-flo

Note: make all-flo step might take a few hours.

For development/debugging purposes, using deb instead of all will build the files faster (~15 minutes), but it is not recommended for production use. To build both backend and BlockBook, run:

make deb-flo

Or you can run the following commands separately as required:

make deb-backend-flo
make deb-blockbook-flo

The files will be built in the blockbook/build directory.

Installing Blockbook

You can either build the files from scratch using the steps given above or download pre-built files from the releases page. These files are specifically built for Ubuntu and need not be built again.

Backend

# Install the FLO backend service:
sudo apt install ./backend-flo_0.15.1.1-satoshilabs-1_amd64.deb

# Start the FLO backend service:
sudo systemctl start backend-flo.service

Once the FLO backend service is started, the blocks will begin syncing. Wait until the sync is finished.

Note: The file name backend-flo_0.15.1.1-satoshilabs-1_amd64 might be different due to the build version. Adjust the name accordingly.

Note: To check the status of your synchronization, view the debug.log file in the /opt/coins/data/flo/backend directory.

Blockbook

# Install the FLO Blockbook service:
sudo apt install ./blockbook-flo_0.4.0_amd64.deb

# Start the FLO Blockbook service:
sudo systemctl start blockbook-flo.service

Once the FLO BlockBook service is started, the blocks will begin building in RocksDB. Wait until the process is finished.

Note: The file name blockbook-flo_0.4.0_amd64 might be different due to the build version. Adjust the name accordingly.

Note: To check the status of your synchronization, view the blockbook.INFO file in the /opt/coins/blockbook/flo/logs/ directory.

Viewing the BlockBook Webpage

The BlockBook will be hosted at the following localhost port:

https://localhost:9166

You can even access it on the IP of the server

https://serverip:9166

Checking if Services are Running

Logs

  • Backend Logs: View the debug.log file in /opt/coins/data/flo/backend.
sudo tail -f /opt/coins/data/flo/backend/debug.log
  • BlockBook Logs: View the blockbook.INFO file in /opt/coins/blockbook/flo/logs/.
sudo tail -f /opt/coins/blockbook/flo/logs/blockbook.INFO

Network Status

  • Backend: Check the status with netstat -plnt | grep 8066 for mainnet and netstat -plnt | grep 18066 for testnet.
  • BlockBook: Check the status with netstat -plnt | grep 9166 for mainnet and netstat -plnt | grep 19166 for testnet.

Provisioning with Terraform and Ansible

You can use Terraform and Ansible to automate the provisioning and setup of BlockBook on an EC2 instance. The DevOps Kaizen repository contains:

  • Terraform code to provision the EC2 VM on AWS.
  • Ansible playbooks to configure the EC2 instance and perform all the mentioned steps.

Refer to the repository for detailed instructions and code examples.


This completes the installation and setup of FLO BlockBook on Ubuntu. For more detailed information, refer to the related articles in this series: