james-s-tayler / sandbank

.NET Core 3.1 + Vue.js banking app
MIT License
3 stars 0 forks source link

Deploy to AWS #57

Open james-s-tayler opened 4 years ago

james-s-tayler commented 4 years ago

In order to know the complete list of resources I need to provision in order to be able to automate the infrastructure, I need to get the infrastructure working first and make sure the application is functioning as intended.

james-s-tayler commented 4 years ago

Was learning Terraform and did make a start on trying to properly deploy it. Have gotten a little sidetracked with learning a bunch of other AWS stuff for work. Have parked this for the moment and will pick it back up later.

james-s-tayler commented 4 years ago

I think I could take a shortcut with this by just deploying all the entire docker-compose as-is including the database and localstack components. Then one by one factor those out to their respective real resources.

james-s-tayler commented 4 years ago

https://getstream.io/blog/deploying-the-winds-api-to-aws-ecs-with-docker-compose/

james-s-tayler commented 4 years ago

Wound up going for CDK instead. Taking the approach of just commenting out all code related to any AWS dependencies and getting at least the backend, db and front-end working in AWS.

So far CDK-wise I've got:

Just trying to work through getting RDS to connect properly. Before I move on to CDK'ing the frontend.

After that need to work on getting a CodePipeline going to make build/deploy easier. Tidy up some stuff, make it smooth. Then start adding into CDK the AWS resources the application code is leveraging.

james-s-tayler commented 4 years ago

Backend deployment is stable now. Moving on to CDK'ing the SPA.

https://dev.to/ryands17/deploying-a-spa-using-aws-cdk-typescript-4ibf https://sbstjn.com/deploy-react-cra-with-cdk-codepipeline-and-codebuild.html

james-s-tayler commented 4 years ago

SPA deployed to S3/CloudFront! Need to externalize some configuration for the url of the API, so the SPA can talk to the API when deployed.

james-s-tayler commented 4 years ago

The backend api url is injectable via codebuild now. Just need to setup HTTPS on the ALB as the CloudFront distrubtion is served over HTTPS. May as well setup front/back to point app.domain-name.com and api.domain-name.com respectively. Probably inject additional configuration into the cdk to map the domains to custom subdomains for staging / prod etc.

Nearly there.

james-s-tayler commented 4 years ago

HTTPS and domains all setup and working. CDK'ing other infrastructure like DynamoDB table and other stuff related to exporting outbound transactions.

james-s-tayler commented 4 years ago

DynamoDB table is done, but decided to leave the outbound transactions stuff to focus on CI/CD with CDK Pipelines. Found and logged a couple of major bugs, will tidy those up after the CI/CD and logging infrastructure improvements.

Started moving everything I've got so far into a Stage

I think what I would like to have is 3 stages. In trying to model a real-world flow I think the pipeline should be able to be kicked off manually given a feature branch which would deploy it in a named QA env with a manual approval step that then deploys it into a Pre-prod / Staging env with another manual step that then finally deploys it to Production env.

A later project could be to insert automated integration tests / synthetic traffic stages.

james-s-tayler commented 4 years ago

Started working on CDK pipeline. Only have the initial self-mutating pipeline part underway just yet.