-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
task 2.2: implement automated deployment #2
Conversation
I spend some time to get a deeper insight on what is happening in suggested serverless plugins to use.
So I have explored ways to write better plugin or find ones that fit better. Configuration is pretty straight forward and these plugins solves all above points. $ npm run build && sls deploy # to deploy/update resources, sync s3, run invalidation
$ sls remove # to cleanup s3 and remove all resources |
* add serverless framework to manage deployment * define needed resources: bucket, distribution, policies * define plugin to sync FE build to s3 bucket * define plugin to invalidate cloudfront distribution after deploy * add custom plugin to output distribution url after deploy * add corresponded npm scripts
Initial deploy of infrastructure and already builded app. npm run deploy
> [email protected] deploy
> sls deploy
Deploying guria-aws-js-practitioner to stage dev (us-east-1)
DistributionIdKey: WebAppDistributionIdOutput
CloudfrontInvalidate: Invalidation started
Web App deployed to: https://d117vzcvm45m9s.cloudfront.net
✔ Service deployed to stack guria-aws-js-practitioner-dev (294s)
|
Make visible changes and redeploy s3 bucket with distribution invalidation. npm run build:deploy
> [email protected] build:deploy
> run-s build deploy
> [email protected] build
> tsc && vite build
vite v3.1.4 building for production...
✓ 1760 modules transformed.
dist/index.html 0.53 KiB
dist/assets/dehydrated.2e689d50.js 1.55 KiB / gzip: 0.44 KiB
dist/assets/index.a7196b63.js 215.17 KiB / gzip: 65.31 KiB
dist/assets/libs.b35d0422.js 107.82 KiB / gzip: 35.44 KiB
dist/assets/react.fbb230d2.js 197.86 KiB / gzip: 60.38 KiB
> [email protected] deploy
> sls deploy
Deploying guria-aws-js-practitioner to stage dev (us-east-1)
DistributionIdKey: WebAppDistributionIdOutput
CloudfrontInvalidate: Invalidation started
Web App deployed to: https://d117vzcvm45m9s.cloudfront.net
Change set did not include any changes to be deployed. (19s) |
Removing serverless deployment with all created resources. npm run remove
> [email protected] remove
> sls remove
Removing guria-aws-js-practitioner from stage dev (us-east-1) |
Direct access to s3 bucket content is not allowed:
http://guria-aws-js-practitioner-dev.s3-website-us-east-1.amazonaws.com |
Task 2.2