Boilerplate for a project using React frontend with a Terraform controlled backend API.
- Cloud - AWS ECS Fargate, Cloudfront, Route53, SSL Certificate
- API - Flask, Celery, Websockets
- Frontend - React
- Docker - Container developer environment
- Terraform - Cloud infrastructure
- direnv - Environment variable management
- jq - JSON cli processor
- awscli - AWS CLI tool (brew install awscli)
Setup domain that is already registered in AWS Route53 in env.dist:
export PROJECT_DOMAIN="example.com"Create AWS Terraform shared environment for shared state locking. The file backend_config.tf is generated with Terraform setup information. NOTE:
Run from the terraform directory
$ cd terraform
terraform $ make bootstrapTerraform will create all the necessary resources on AWS. Environment variables will be saved to the file aws.env, and the environment will need to be refreshed after running this step.
NOTE: Run from the terraform directory
$ cd terraform
$ make init
$ make plan
$ make applyIf you recieve InvalidViewerCertificate the first time your run plan/apply, run terraform plan apply process a second time. The SSL certificate needs to be validated when created and takes a bit of time.
$ make plan applyDeploy the backend containers to the ECR and update the two services. NOTE: Run from the root directory of the project
$ make dist-backend-build
$ make dist-backend-deployDeploy the frontend react app to a serverless cloudfront distribution
$ make dist-frontend-build
$ make dist-frontend-deploy
Get coffee...
Tear down and remove all AWS infastructure components. NOTE: Run from the Terraform directory
$ cd terraform
$ make destroyGet coffee...