Skip to content

Deployment via ECS #96

@ppedziwiatr

Description

@ppedziwiatr

Current configuration:

  1. main instance: EC2 on t3.medium: https://eu-north-1.console.aws.amazon.com/ec2/home?region=eu-north-1#InstanceDetails:instanceId=i-0eda8ef302509bb14

Runs in node cluster mode (https://nodejs.org/api/cluster.html#cluster), started via PM2 (https://pm2.keymetrics.io/docs/usage/cluster-mode/) with -i max.
In case of t3.medium this effectively means 2 nodes.
image

Requires:

  • .secrets/warp-wallet-jwk.json - an Arweave wallet that is used to connect with Bundlr (which is used for bundling contracts and contracts' interactions)
  • .secrets/vrf-priv-key.txt - secp256k1 private key - required by the VRF feature
  • vrf-pub-key.txt - secp256k1 public key - required by the VRF feature

Additional notes:
Only one worker in cluster runs the gateway tasks (e.g. transactions syncing, transactions verification)
All workers in cluster run the http server and handle both the POST and GET requests.
This is handled via gateway.lock file.

  1. replica instance: EC2 on t3.micro: https://eu-north-1.console.aws.amazon.com/ec2/home?region=eu-north-1#InstanceDetails:instanceId=i-0d80ce350fba0431c
    Also runs in node cluster mode, with the --replica param. This effectively means, that node only serves data - i.e. serves only "GET" requests and does not run any tasks/jobs.

  2. ALB - https://eu-north-1.console.aws.amazon.com/ec2/home?region=eu-north-1#LoadBalancers:sort=loadBalancerName sw-gw-alb with sw-gw-target-group https://eu-north-1.console.aws.amazon.com/ec2/home?region=eu-north-1#TargetGroup:targetGroupArn=arn:aws:elasticloadbalancing:eu-north-1:731675056359:targetgroup/sw-gw-target-group/d11c3b67c5addb3a
    This group has both the above EC2 instances connected.

  3. Cloudfront - https://us-east-1.console.aws.amazon.com/cloudfront/v3/home?region=eu-north-1#/distributions/E2UWDPG250O74Q - https://d1o5nlqr4okus2.cloudfront.net
    with the alb and main instance node origins connected.
    All the 'post' requests are sent to the main node.
    The rest is sent to the ALB.
    Some caching policies are enabled for certain endpoints - https://us-east-1.console.aws.amazon.com/cloudfront/v3/home?region=eu-north-1#/distributions/E2UWDPG250O74Q/behaviors
    This cloudfront distribution is connected to the gateway.redstone.finance domain.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions