Deploying the Full Stack#
First Time Setup#
Copilot is an official AWS tool used to quickly stand-up infrastructure in the cloud. For this project, it is responsible for setting up a backend service for running simulations (so no inbound internet-access, only outbound) an S3 bucket, and the distributed queuing system. In the future it may also include an API for generating jobs etc, but for now, it will be expected that such work is hosted locally. Note that it is also possible (and easier) to run with a managed version of the distributed queuing system hosted by Hatchet, which substantially simplifies the setup. Separate docs for that can be found below.
Prereqs#
- Install Docker.
- Install AWS CLI & AWS Copilot.
- Configure an AWS CLI profile if you have not done so already:
aws configure --profile <your-profile-name> - You will need a domain in order to access your hosted queue which you can configure CNAME records for. Some Route53 specific instructions may be added in the future, but for now it is assumed that you will manually configure the CNAME records at the indicated point in the process.
- Clone the repository:
git clone https://github.com/szvsw/epengine. - Move into the repository:
cd epengine
Standing up the environment#
copilot app init- see
app inithelp for more details like--permissions-boundaryif needed copilot env init --name prod- (see
see inithelp for more details, as well asinitmanifest help for specs for VPCs etc.) - TODO: instructions about
CERTIFICATE_ARNenv var interpolation. - The next command will deploy an Aurora Serverless PostgresSql database, S3 bucket, and RabbitMQ broker.
- You may wish to turn on RabbitMQ console public accessibilty (ADD HOW)
- You may wish to set the instance sizes for RabbitMQ.
- You may wish to update the scaling capacities for Aurora Serverless.
copilot env deploy --name prodcopilot svc init --name hatchet-engine- TODO: instructions about
API_DOMAINenv var interpolation. copilot svc deploy --name hatchet-engine --env prod- TODO: instructions about the
FS_IDandFSAP_IDenv var interpolation. copilot svc init --name hatchet-apicopilot svc deploy --name hatchet-api --env prod- Create a
CNAMErecord to point at the load balancer (TODO: how to find the load balancer address). - Visit your domain and either login with a new account & make a tenant, or login with the default creds:
admin@example.com/Admin123!! - Make an api token (General Settings > API Tokens). TODO: (automate token creation steps with a task run)
copilot secret init --name HATCHET_CLIENT_TOKEN --overwritethen paste in your secret.
copilot svc init --name hatchet-worker- Authenticate to AWS ECR (TODO: add instructions).
copilot svc deploy --name hatchet-worker --env prod
Scaling workers up and down#
In copilot/hatchet-worker/manifest.yml, you can edit the worker count configuration to determine how many workers you would like, if scaling should be done based off of CPU utilization, etc.
After making changes, run copilot svc deploy --name hatchet-worker --env prod.
Cleanup#
- Empty your buckets if they have files in them.
copilot app delete