xDai Stable Chain xDai Stable Chain BlockScout BlockScout TokenBridge TokenBridge

Deploying BlockScout with Ansible Playbooks / Terraform

Note: Up-to-date instructions are also located in the BlockScout Documentation.

When using playbooks to deploy BlockScout, make sure you have all dependencies and their correct versions installed (double check the correct versions are installed - incorrect node and/or elixir versions can cause issues).

There are also instructions available for manual BlockScout deployment.

Note: Deployment requires a robust AWS instance, typically 10+ VPC instances. If you receive minimum requirement errors (for example Need at least 1 healthy instances in ASG, have 0) you will need to request increased VPC limits from AWS.

Preparing the Infrastructure

Before you start:

Ansible script deployment:

  1. git clone https://github.com/poanetwork/blockscout-terraform

  2. cd blockscout-terraform

  3. Merge infrastructure and all config template files into single config file: cat group_vars/infrastructure.yml.example group_vars/all.yml.example > group_vars/all.yml

  4. Set the variables at group_vars/all.yml config template file as described in the github repository

  5. Run ansible-playbook deploy_infra.yml

    a. During the deployment a “diffs didn’t match” error may occur, it will be ignored automatically. If the Ansible play recap shows 0 failed plays, then the deployment was successful despite the error.

    b. Optionally, you may want to check the variables were uploaded to the Parameter Store at AWS Console.

Deploying BlockScout

  1. Ensure all infrastructure prerequisites are met and return to the blockscout-terraform folder from the infrastructure deployment section above.

  2. Merge blockscout and all config template files into single config file:
    cat group_vars/blockscout.yml.example >> group_vars/all.yml

  3. Set the variables at group_vars/all.yml config template file as described at the github repository;

    Note: Use chain_custom_environment to update the variables in each deployment. Map each deployed chain with variables as they should appear at the Parameter Store. An example is in the group_vars/blockscout.yml.example config file. chain_* variables are ignored during BlockScout software deployment.

    Note: If using a Mac, please see additional instructions in the repository

  4. Run ansible-playbook deploy_software.yml

  5. When the ‘open your browser’ prompt appears, check that server is running and there are no visual artifacts. The server will launch at port 4000 at the same machine where you run the Ansible playbooks. If you find errors you can either fix them or cancel the deployment by pressing Ctrl+C and then pressing A when prompted.

  6. When the server is ready to be deployed, press enter. BlockScout will be deployed to the appropriate S3.

  7. Additional prompts will appear during deployment. EnterYes to continue.
    a. Would you like to remove staging dependencies? [Yes/No]
    b. Do you want to update the Parameter Store variables? [Yes/No]
    c. Do you want to deploy BlockScout? [Yes/No]

  8. Monitor and manage your deployment at the CodeDeploy service page in your AWS Console. You will need to manually reroute traffic and terminate the original instance. Instructions available here.