Skip to content

Deployment

Dev Singh edited this page Mar 22, 2025 · 1 revision

The system supports two environments:

  1. Development (acmdev) - For testing, development, and QA tasks.
  2. Production (acmprod) - For live usage

Deployment Prerequisites

Before deploying, ensure:

  1. You have the AWS CLI installed, with a profile configured with appropriate permissions
  2. You're authenticated to the correct AWS account
  3. All changes are committed to Git
  4. Local tests pass

AWS Authentication

Before deployment, authenticate to AWS using SSO:

aws configure sso

When prompted:

  • SSO URL: https://acmillinois.awsapps.com/start/#
  • SSO Region: us-east-1
  • Select appropriate account (acmdev or acmprod)

Verify authentication:

aws sts get-caller-identity

Export the profile:

export AWS_PROFILE=ACM-DEV  # or ACM-PROD for production

Building the Application

  1. Clean previous builds:
make clean
  1. Build the Lambda functions and frontend:
make build

This creates deployment packages in the dist/ and dist_ui/ directories.

Deploying to AWS

Only those with InfraSuperuserAccess can deploy to AWS. Infra developers must create a branch on GitHub and create a Pull Request.

Development Environment

To deploy to the development environment:

make deploy_dev

This will:

  1. Deploy the CloudFormation stack
  2. Upload Lambda functions
  3. Upload frontend assets to S3
  4. Invalidate CloudFront cache

Production Environment

To deploy to the production environment:

make deploy_prod

Important: Production deployments should only be done after thorough testing in the development environment.

Deployment Process

The deployment process uses AWS CloudFormation to manage infrastructure. The templates are in the cloudformation/ directory:

  • main.yml - Main stack template
  • iam.yml - IAM roles and policies
  • sqs.yml - SQS queues
  • logs.yml - CloudWatch logs configuration

The deployment runs these steps:

  1. Package CloudFormation templates using AWS Serverless Application Model (SAM)
  2. Deploy/update CloudFormation stack
  3. Wait for stack update to complete
  4. Upload frontend assets to S3
  5. Invalidate CloudFront cache

Post-Deployment Verification

After deployment, verify that:

  1. CloudFormation stack updated successfully
  2. Lambda functions were deployed
  3. API endpoints respond correctly
  4. Frontend loads properly

We can run make dev_health_check or make prod_health_check for a basic health check.

Issues during/after deployment

If issues occur during deployment, the AWS CLI will automatically begin rollback. If an error occurs (mostly due to the Github Actions), a user with InfraSuperuserAccess may need to log into AWS and manually roll back the resources.

If issues occur after deployment, the easiest way to fix them is to check out the old commit and deploy it manually (or rerun the Github Action) for the last known good commit.

Monitoring Deployments

Monitor the deployment through:

  1. CloudFormation console
  2. CloudWatch logs
  3. Infra Cloudwatch dashboard (PROD only).

For detailed execution logs, check CloudWatch logs for the Lambda functions.