stacks-network / sbtc

Repo containing sbtc
GNU General Public License v3.0
280 stars 7 forks source link

[Feature]: Create AWS machine image #826

Open MCJOHN974 opened 3 days ago

MCJOHN974 commented 3 days ago

Feature - AWS image

1. Description

Create AWS machine image which will be synced with testnet and have all software needed to deploy an sBTC signer on testnet.

1.1 Context & Purpose

We want to deploy the sBTC to testnet with a similar setup to how we're recommending things be deployed on mainnet. For that we will build an AMI with the necessary applications to run and configure an sBTC signer.

2. Technical Details:

The high level steps to do this is as follows:

  1. Launch an EC2 instance.
  2. Install the necessary applications, which includes bitcoin-core and stacks-core.
  3. Make sure the chainstate is up-to-date on the machine.
  4. Save the AMI.

We'd like to automate the above process, so I'd recommend using packer for the automated build process, but the first time around you would do this all manually first.

A more detailed breakdown of the steps that are necessary are as follows.

  1. Get an AWS account with enough permissions to do the things that need doing.
  2. Go to AWS website, launch EC2 instance.
    1. c6i.xl with 100 GB HD. Use NVMe drives.
    2. setup VPC security groups for SSHing into the machine.
    3. create a keypair.
  3. Install dependencies: docker, watchtower, ansible.
  4. Add in docker compose file and other config files. This docker compose file will have service entries for everything that is necessary on testnet.
  5. Do docker compose pull to store the images on the machine.
  6. Get the primary testnet chainstate data. This can be done by setting up an EBS volume and attaching it to the image or by pulling it from S3 as part of the AMI build process. The stacks chainstate data can be found here https://archive.hiro.so/testnet/stacks-blockchain/, but there isn't a similar archive for the bitcoin blockchain.
  7. Do docker compose up. Not sure if we want to do this as part of the automated build process.
  8. Build AMI from running EC2 instance.
  9. Write files for automatically doing steps (2-10) using packer.

2.1 Acceptance Criteria:

3. Related Issues and Pull Requests (optional):

MCJOHN974 commented 3 days ago

@AshtonStephens can you please help figuring out what actually this issue should be

MCJOHN974 commented 3 days ago

@djordon probably you also can help here