terraform
: Scripts that are used to provision EC2 instances. Mainly spin up N instances across K regions.ansible
- Scripts that are used to deploy theseismic-reth
andseismic-consensus
Docker images to the EC2 instances, pull logs from the EC2 instances, etc.seismic-reth
: Dockerfile for seismic-reth. Pulls the latest version from Github.seismic-consensus
: Dockerfile for seismic-consensus. Pulls the latest version from Github.tx-sender
: Transaction spammer.
Follow these instructions to spin up a testnet and spam it with transactions.
- Install terraform on your local machine
- Install ansible on your local machine
- Install Rust on your local machine
- Install Prometheus
- Install Grafana
Make sure that you have valid AWS credentials at ~/.aws/credentials
. The file should look something like this:
[default]
aws_access_key_id = ...
aws_secret_access_key = ...
aws_session_token = ...
In terraform/terraform.tfvars
, you can specify the number of instances, and the different regions:
regions = ["us-west-2", "eu-central-1", "us-east-1", "ap-northeast-1", "sa-east-1"]
instances_per_region = 4
You also have to provide the path to your ssh pubkey that will be copied to the servers:
ssh_public_key_path = "~/.ssh/id_ed25519.pub"
Finally, run the terraform commands:
cd terraform
terraform init
terraform plan
terraform apply
After deploying the EC2 instances, we use the terraform output to create the ansible inventory file.
Provide your ssh pubkey and the jwt secret in ansible/generate_inventory.sh
:
[ec2_instances:vars]
ansible_ssh_private_key_file=~/.ssh/id_ed25519
jwt_secret=...
Generate the inventory.ini
:
cd ansible
chmod +x generate_inventory.sh
./generate_inventory.sh
There are two options. You can either build the Docker image on each instance, or build the image locally, and then ship the pre-built image to the EC2 instances. Building locally and then shipping the pre-built image will be much faster (unless your laptop is old), however, it requires you to install Docker locally.
Build the images (you have to only do this the first time, or when updating repos):
cd ../summit
docker build -t summit .
docker save summit > ../summit.tar
cd ../seismic-reth/
docker build -t seismic-reth .
docker save seismic-reth > ../seismic-reth.tar
Deploy the seismic-reth image first:
ansible-playbook -i inventory.ini deploy-seismic-reth.yml -e "pre_built_image_tar=../seismic-reth.tar" -e "jwt_secret=..." -e "force_rebuild=true"
Then deploy the summit image:
ansible-playbook -i inventory.ini deploy-summit.yml \
-e "pre_built_image_tar=../summit.tar" \
-e "engine_jwt=..." \
-e "base_port=8080" \
-e "base_prom_port=9090" \
-e "clear_state=true" \
-e "force_rebuild=true"
For seismic-reth:
ansible-playbook -i inventory.ini deploy-seismic-reth.yml -e "jwt_secret=..." -e "force_rebuild=true"
For summit:
ansible-playbook -i inventory.ini deploy-summit.yml \
-e "engine_jwt=..." \
-e "base_port=8080" \
-e "base_prom_port=9090" \
-e "clear_state=true" \
-e "force_rebuild=true"
In terraform-spamnet/terraform.tfvars
, you can specify the number of instances, and the different regions:
regions = ["us-west-2", "eu-central-1", "us-east-1", "ap-northeast-1", "sa-east-1"]
instances_per_region = 4
You also have to provide the path to your ssh pubkey that will be copied to the servers:
ssh_public_key_path = "~/.ssh/id_ed25519.pub"
Finally, run the terraform commands:
cd terraform-spamnet
terraform init
terraform plan
terraform apply
Build the Docker image: (You can skip these steps if you want to build Docker image on the instances)
cd tx-sender
cp ../ansible/inventory.ini .
docker build -t tx-sender .
docker save tx-sender > ../tx-sender.tar
Generate the inventory_spamnet.ini
:
cd ../ansible
./generate_inventory.sh
Deploy tx-sender:
ansible-playbook -i inventory_spamnet.ini deploy-tx-sender.yml -e "num_keys=2000" -e "pre_built_image_tar=../tx-sender.tar"
If you didn't built the Docker image, drop the pre_built_image_tar
flag
Generate the Prometheus config from the terraform output:
chmod +x generate_prometheus.sh
./generate_prometheus.sh
Start Prometheus:
prometheus --config.file=prometheus.yml
Check that we are collecting metrics at http://localhost:9090/targets
Start Grafana server:
sudo systemctl daemon-reload
sudo systemctl start grafana-server
Open Grafana dashboard at http://localhost:3000/ and select Prometheus as a data source.