Asteroid-Neo
A high-availability neo-cli service for asteroid.
Asteroid-Neo is designed to be run as either a stand-alone neo-cli instance or as a swarm with loadbalancing (Asteroid-loadBalancer).
The tool provides a number of enhancements over the conventional neo-cli deployment which targets improved uptime and deployment agility including:
- Fully functional microservice w/ easy deployment via docker
- Easy upgrade to new builds
- Automatic chain checkpointing and download
- Ability to auto-restart on failure
- (swarm) Load balancing across multiple nodes
- (swarm) Node redundancy
Currently, the container has two operating modes:
- Slave: will act in a similar fashion to neo-cli.
- Master: will occasionally pause the chain and push a checkpoint to the S3 bucket. To run in master, you must provide the following environment variables at runtime:
- aws_access_key_id
- aws_secret_access_key
When the container comes up, it will automatically search for an existing Chain directory to use. If the directory is not found, or it was generated by an unsupported neo-cli version (requires new chain data), the node will pull the latest supported chain checkpoint from S3. If this fails, it will begin a full chain sync.
To force download of a new checkpoint, bring down the container and delete the Chain folder in /var/lib/docker/volumes/asteroid-neo
, then run again.
asteroid-neo is available on ECR and can be pulled using the following command:
sudo docker pull moonlightio/asteroid-neo
@TODO: migrate ECR to Moonlight AWS
You can optionally build the container youself as well:
git clone https://github.com/Moonlight-io/asteroid-neo.git
cd asteroid-neo
docker build -t asteroid-neo .
sudo docker run -d -p 10332:10332 -v Chain:/var/www/asteroid-neo/neo-cli/Chain asteroid-neo
or using the registry:
sudo docker run -d -p 10332:10332 -v Chain:/var/www/asteroid-neo/neo-cli/Chain moonlightio/asteroid-neo
Note: You will need to open port 10332 in your security group to access the RPC endpoint
This deployment method uses docker-machine to deploy a swarm of neo-cli instances. The load-balancer service is used to guarantee that the highest available block in the swarm is returned.
Note: Load balancing in this funcationality has not yet been deployed.
Note: You will need to open ports 10332(TCP), 2376(TCP), 2377(TCP), 7946(TCP/UDP), and 4789(UDP) in your security group
docker swarm init
docker stack deploy -c docker-compose.yml asteroid-neo --with-registry-auth
To bring down the nodes
docker stack rm asteroid-neo
docker swarm leave --force