Skip to content
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 9 r #9

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Task 9 r #9

wants to merge 6 commits into from

Conversation

Latvels
Copy link

@Latvels Latvels commented Dec 31, 2023

TASK
FE PR
Add to localStorage:
Key: authorization_token
Value: TGF0dmVsczpQYXNzd29yZDEh


Evaluation criteria (70 points for covering all criteria)

  • Dockerfile is prepared, image is building. Image size is minimized to be less than 500 MB.
  • Dockerfile is optimized. Files that change more often and commands that depend on them should be included later, files and commands that change less should be at the top.
  • Folders are added to .dockerignore, with explanations. At least 2 big directories should be excluded from build context. Elastic Beanstalk application is initialized.

Additional (optional) tasks

  • 15 - Environment is created and the app is deployed to the AWS cloud. You must provide a link to your GitHub repo with Cart Service API or PR with created Dockerfile and related configurations.
  • 15 - FE application is updated with Cart API endpoint. You must provide a PR with updates in your FE repository and OPTIONALLY link to deployed front-end app which makes proper API calls to your Cart Service.

image

image
image

hazardsoft added a commit to hazardsoft/nodejs-aws-cart-api that referenced this pull request Aug 10, 2024
… (Docker platform) (#2)

* feat: compile server and serverless implementations

* feat: add Dockerfile to build server

details: use Docker Compose to run cart-api comprising of postgres and nest.js app

* refactor: create prisma:deploy and prisma:seed scripts to run with diff envs

* feat: compile prisma seed script

* docs: add comments to .dockerignore

* feat: create Dockerfile to build image with cart api server

* fix: export port as part of Elastic Beanstalk platform Docker requirements

* feat: add cloudwatch streaming config for Elastic Beanstalk application

* feat: add .ebignore as part of Elastic Beanstalk application config

* feat: add npm scripts for Elastic Beanstalk application

details:
1. env-cmd vars expansion is used to pass DATABASE_URL to env vars of EB application
2. Dockerfile is used to build image on EC2 instance (docker-compose.yml is ignored by .ebignore)

* fix: include .ebextensions into Elastic Beanstalk deploy

* rolling-scopes-school#8: Integrate wiht AWS RDS (Postgres) (#1)

* fix: add missing properties to a user's cart

* feat: use esbuild to compile project

* feat: wrap nest app as serverless function

details: create aws cdk stack to deploy lambda handler

* feat: add Prisma ORM to the project

details: define cart and cart_items db schemas

* feat: add postgres docker image for local testing

* feat: add Product model to db schema

* feat: add Prisma seed script to fill db with initial data

* feat: add users table with relation to cart

* fix: indicate correct entry point for cart lambda handler

* refactor: rename prisma models properties

* test: actualize e2e test

* refactor: remove rows in cascade on removing relations

* refactor: drop 'count' column in products table

* feat: use Postgres to store data in cart service

* tests: add integration test for Prisma service

* feat: users service uses prisma service to store/retrieve data

* fix: does not include cdk into source files

* feat: cart controller uses basic auth for get/put methods

details: add e2e tests for cart controller

* feat: add possibility to create orders

details:
1. create 'orders' table
2. update 'checkout' endpoint in cart controller
3. create order via prisma transaction
4. add integration tests for order creation
5. add e2e tests for order creation

* feat: create rest api with proxy method to pass all the data to cart handler

details: reference already existing db instance by its attributes

* fix: include prisma linux query lib into cart lambda source code

* refactor: drop 'products' table

details: cart service should not save products data as its already present in 'products' service, so it will operate 'product_id'/'count' only

* refactor: remove jwt/local auth strategies (use basic only)

* refactor: bootstrap nest application in separate module

details: clearly split server (listening to a port) and serverless implementations

* feat: give final shape to input/output of cart controller/service

details: cart creation/update/checkout implemented fully

* refactor: remove 'calculateCartTotal' as there's no info about a product price

* tests: update integration/e2e tests of cart service

* refactor: squash prisma migrations

* refactor: resolve dest of prisma query lib relatively to output dir

* refactor: use webpack to build nest.js application

details: esbuild does not respect 'experimentalDecorators' which are heavily used by nest.js for injection (see details at https://esbuild.github.io/content-types/#tsconfig-json)

* refactor: remove PrismaModule import in AuthModule

* feat: create rds db instance (postgres) via aws cdk

* fix: correct supertest import in tests

* feat: ignore 'cdk*' files and folders with prettier

* feat: enable source maps for aws cdk build

* feat: create network construct for managing connections between lambda and rds

details:
1. network constructs creates security groups to establish connection between lambda and rds db instance
2. db instance endpoint host/port are used to create database url passed as end to lambda handler
3. lambda handler is deployed to one AZ only (the same availability zone is used by db instance)

* refactor: take server port from env var

* refactor: rename db env vars to conform with aws cdk

* feat: add scripts to deploy/seed local/remote db instance with prisma

* docs: add documentation for aws cdk stack

* refactor: move aws cdk account id/region env vars to config

* tests: actualize aws cdk unit tests

* fix: correct formatting in cdk/README.md

* fix: use .env.local or .env.remote depending where db changes are required

* docs: add documentation for cart service

* feat: add method to delete cart of a user

* docs: add mentioning of .env file used for local development by default

* tests: add Postman collection to test Cart service

details: update README with info about Postman collection

* feat: remove public access to RDS DB instance

* refactor: remove internet <-> RDS security group

* refactor: change eb instance type to t2.micro

details: t2.micro falls under Free Tier 750h/month rule in eu-central-1 (Frankfurt) region

* feat: add http api to proxy requests from HTTPS endpoint to EB HTTP endpoint

* fix: add default headers to http proxy api to support CORS

* docs: add information about docker/eb npm scripts
hazardsoft added a commit to hazardsoft/nodejs-aws-cart-api that referenced this pull request Aug 10, 2024
… (Docker platform) (#3)

* fix: add missing properties to a user's cart

* feat: use esbuild to compile project

* feat: wrap nest app as serverless function

details: create aws cdk stack to deploy lambda handler

* feat: add Prisma ORM to the project

details: define cart and cart_items db schemas

* feat: add postgres docker image for local testing

* feat: add Product model to db schema

* feat: add Prisma seed script to fill db with initial data

* feat: add users table with relation to cart

* fix: indicate correct entry point for cart lambda handler

* refactor: rename prisma models properties

* test: actualize e2e test

* refactor: remove rows in cascade on removing relations

* refactor: drop 'count' column in products table

* feat: use Postgres to store data in cart service

* tests: add integration test for Prisma service

* feat: users service uses prisma service to store/retrieve data

* fix: does not include cdk into source files

* feat: cart controller uses basic auth for get/put methods

details: add e2e tests for cart controller

* feat: add possibility to create orders

details:
1. create 'orders' table
2. update 'checkout' endpoint in cart controller
3. create order via prisma transaction
4. add integration tests for order creation
5. add e2e tests for order creation

* feat: create rest api with proxy method to pass all the data to cart handler

details: reference already existing db instance by its attributes

* fix: include prisma linux query lib into cart lambda source code

* refactor: drop 'products' table

details: cart service should not save products data as its already present in 'products' service, so it will operate 'product_id'/'count' only

* refactor: remove jwt/local auth strategies (use basic only)

* refactor: bootstrap nest application in separate module

details: clearly split server (listening to a port) and serverless implementations

* feat: give final shape to input/output of cart controller/service

details: cart creation/update/checkout implemented fully

* refactor: remove 'calculateCartTotal' as there's no info about a product price

* tests: update integration/e2e tests of cart service

* refactor: squash prisma migrations

* refactor: resolve dest of prisma query lib relatively to output dir

* refactor: use webpack to build nest.js application

details: esbuild does not respect 'experimentalDecorators' which are heavily used by nest.js for injection (see details at https://esbuild.github.io/content-types/#tsconfig-json)

* refactor: remove PrismaModule import in AuthModule

* feat: create rds db instance (postgres) via aws cdk

* fix: correct supertest import in tests

* feat: ignore 'cdk*' files and folders with prettier

* feat: enable source maps for aws cdk build

* feat: create network construct for managing connections between lambda and rds

details:
1. network constructs creates security groups to establish connection between lambda and rds db instance
2. db instance endpoint host/port are used to create database url passed as end to lambda handler
3. lambda handler is deployed to one AZ only (the same availability zone is used by db instance)

* refactor: take server port from env var

* refactor: rename db env vars to conform with aws cdk

* feat: add scripts to deploy/seed local/remote db instance with prisma

* docs: add documentation for aws cdk stack

* refactor: move aws cdk account id/region env vars to config

* tests: actualize aws cdk unit tests

* fix: correct formatting in cdk/README.md

* fix: use .env.local or .env.remote depending where db changes are required

* docs: add documentation for cart service

* feat: add method to delete cart of a user

* docs: add mentioning of .env file used for local development by default

* tests: add Postman collection to test Cart service

details: update README with info about Postman collection

* feat: compile server and serverless implementations

* feat: add Dockerfile to build server

details: use Docker Compose to run cart-api comprising of postgres and nest.js app

* refactor: create prisma:deploy and prisma:seed scripts to run with diff envs

* feat: compile prisma seed script

* docs: add comments to .dockerignore

* feat: create Dockerfile to build image with cart api server

* fix: export port as part of Elastic Beanstalk platform Docker requirements

* feat: add cloudwatch streaming config for Elastic Beanstalk application

* feat: add .ebignore as part of Elastic Beanstalk application config

* feat: add npm scripts for Elastic Beanstalk application

details:
1. env-cmd vars expansion is used to pass DATABASE_URL to env vars of EB application
2. Dockerfile is used to build image on EC2 instance (docker-compose.yml is ignored by .ebignore)

* fix: include .ebextensions into Elastic Beanstalk deploy

* feat: remove public access to RDS DB instance

* refactor: remove internet <-> RDS security group

* refactor: change eb instance type to t2.micro

details: t2.micro falls under Free Tier 750h/month rule in eu-central-1 (Frankfurt) region

* feat: add http api to proxy requests from HTTPS endpoint to EB HTTP endpoint

* fix: add default headers to http proxy api to support CORS

* docs: add information about docker/eb npm scripts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant