Effortlessly deploy a complete infrastructure to run your own MultiversX API in just a few steps. This repository streamlines the entire process, eliminating complex configurations and providing a rapid setup solution for any server.
With a focus on simplicity and automation, this deployment is designed to make the MultiversX API accessible to everyone. Whether you're a blockchain enthusiast or a seasoned developer, you can have a fully operational API in no time. No need to gather resources from multiple repositories—everything you need is here in one place.
Deploying the infrastructure is as simple as running three commands:
- Initialize the server: Set up the requirements and create a dedicated user for running services.
- Deploy the infrastructure: Install the necessary services and configure the environment.
- Start the services: Launch the components and expose the API for external access.
Having a complete API usually required a lot of steps from a lot of repositories, here you have it all in one place.
- An Observing Squad: Access blockchain data by running observer nodes.
- ElasticSearch Indexer: Convert raw blockchain data for efficient querying.
- ElasticSearch Database: Store the converted blockchain data.
- Kibana: Visualize data and logs from the blockchain.
- MultiversX API: Query blockchain data externally via a standard API.
To support the infrastructure's heavy load, we recommend deploying on a bare-metal server with the following specifications depending on your needs:
- 12-16 CPU cores
- 32-64 GB RAM
- 1 TB SSD storage
- 1 Gbps network bandwidth
Before deployment:
- Secure your server with an SSH key.
- Ensure no sensitive data is on the server. Although the API is stateless, misuse of the infrastructure could disrupt services.
At the root of this repository you will find the file named config.cfg. It contains variables that can be configured to customize the deployment.
The following variables are available:
- USERNAME: The username for the new user that will be created.
- NETWORK: The network to deploy. Currently supports
mainnet
,devnet
andtestnet
networks.
Currently, the deployment is configured with default settings. As development progresses, more configuration options will be added, such as enabling a full history node or customizing ElasticSearch settings.
-
Ensure you are logged in as the root user
-
You will need this repository on your machine before starting:
git clone https://github.com/PhyByte/mvx-api-deployer.git
- Run the installation script that will set up the requirements for the deployment:
cd mvx-api-deployer
./1-Init.sh
- Updates and upgrades your system.
- Installs Docker and Docker Compose.
- Creates a new user,
mvx-api
, for running services. - Transfer your cloned and modified repository to the
mvx-api
user.
At the end of the previous step you should be logged in as the mvx-api
user. If not, switch to the mvx-api
user before continuing with:
su - mvx-api
As you already configured the config.cfg
file, you can now deploy the infrastructure immediately by running:
cd ~/mvx-api-deployer
./2-Install.sh
- Setup the Observing Squad with
ElasticSearch Indexer Enabled
. - Setup the ElasticSearch Indexer and deploy the ElasticSearch Database with Kibana.
- Setup the MultiversX API.
After the installation is complete, you can start the services by running:
cd ~/mvx-api-deployer
./3-Start.sh
The installation process includes copying a pre-configured .bashrc
file to the deployment server. This file provides a set of convenient commands to manage the MultiversX API services, including starting, stopping, monitoring, and checking the status of individual services.
The Observing Squad allows you to access blockchain data via observer nodes. These commands help you monitor and manage the Observing Squad services.
-
Start & Stop Observing Nodes
Use these commands to start and stop individual observing nodes:api_obssquad_start # Start all observing squad nodes api_obssquad_stop # Stop all observing squad nodes
-
Monitor Observing Nodes
Use these commands to monitor individual observing nodes:api_obssquad_monitoring_0 # Monitor node 0 at localhost:8080 api_obssquad_monitoring_1 # Monitor node 1 at localhost:8081 api_obssquad_monitoring_2 # Monitor node 2 at localhost:8082 api_obssquad_monitoring_3 # Monitor node 3 at localhost:8083 api_obssquad_monitoring_proxy # View logs of the observing squad proxy service
The ElasticSearch Indexer processes raw blockchain data into structured data for querying.
-
** Start & Stop ElasticSearch Indexer**
Use these commands to start and stop the ElasticSearch Indexer:api_indexer_start # Start the ElasticSearch Indexer api_indexer_stop # Stop the ElasticSearch Indexer
The ElasticSearch Database stores the converted blockchain data.
api_eskibana_start # Start ElasticSearch and Kibana api_eskibana_stop # Stop ElasticSearch and Kibana
The MultiversX API provides external REST access to blockchain data.
-
Start & Stop MultiversX API Use these commands to start and stop the MultiversX API:
api_mx_api_start # Start the MultiversX API api_mx_api_stop # Stop the MultiversX API
Use this command to check the status of all services:
api_check_status # Check the status of all services
You can add custom commands to the .bashrc
file to manage additional services or configurations that you would need to run your own MultiversX API. This is usually better than retyping the commands every time.