Open afnanhaq opened 3 weeks ago
The backend was built as a docker image & hosted on AWS App Runner.
The frontend was built into a static site (npm build
) and hosted on S3.
The guides on how to do this are below.
Pricing: S3: 724K @ $0.023 per GB/Month = negligible Apprunner: More complicated, because the pricing is different if people are hitting your App vs it being asleep. It can also scale up even more than shown if there are a huge number of parallel requests.
docker image setup:
;docker build . -t elliottking/legislation-tracker-backend
;docker run -p 3000:3000 -e NODE_ENV=production --env-file ../.env docker.io/elliottking/legislation-tracker-backend
Pushing image to ecr:
;aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 888096637450.dkr.ecr.us-east-1.amazonaws.com/sunrise-test
;docker image list
;docker tag b4ec9a7d0e4e 888096637450.dkr.ecr.us-east-1.amazonaws.com/sunrise-test
;docker push 888096637450.dkr.ecr.us-east-1.amazonaws.com/sunrise-test
Don't forget your regular env vars, plus NODE_ENV=production
& CLIENT_URL=http://sunrise-website-deployment-test.s3-website-us-east-1.amazonaws.com
:
other references:
extensions:
I only created the S3 bucket & uploaded the required files. I didn't create a GH action. I also had to manually select the bucket items & update to public ACL. Also had to set the error page as index.html
to get react router to work.
;VITE_SERVER_URL=https://pkyzwf27mv.us-east-1.awsapprunner.com/ npm run build
other references:
extensions:
For now, I only did the Distributing an AWS S3 Static Website via CloudFront section. This puts an https-enabled URL in front of the non-https s3 site. In that step, I ignored anything that pertained to a personal domain.
other references:
extensions:
afnan's work done so far exists here.
Please ensure the Dockerfiles are set up in a way that they can be used to run the containers on AWS but does not mess with local setup. Please also clarify how to connect the frontend and backend especially the API keys. We can easily store API keys in AWS and call them via environment variables etc.