Skip to content

Stacks: React, Spring Boot, JPQL, Docker and AWS SLS. An bookstore application that allow users to view, order and receive confirmation emails.

Notifications You must be signed in to change notification settings

johnnyn2/Johnny-s-BookStore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Johnny-s-BookStore

This is a personal project to practice my skills in React, Spring Boot, JPQL, Docker and k8s.

Deployment

  1. AWS S3(frontend) + AWS ECS(backend)
  2. AWS S3(frontend) + AWS EC2(backend)

Setup MySQL database container in AWS ECS / Create MySQL database in AWS RDS (for EC2)

  1. Reference: Spring Boot + Angular + MYSQL on AWS ECS Fargate | AWS ECS Fargate
  2. Reference: Full-Stack Spring Boot with Angular CRUD API application with MYSQL on AWS | AWS EC2 | AWS S3 | RDS

Deploy backend api to AWS ECS

  1. Create MySQL database container in ECS Fargate task
  2. Modify database link in application.properties to the previous created MySQL endpoint
  3. Generate .war file: mvn clean install -DskipTests=true
  4. Build an image(repo here) for the api: docker build -t johnnyhohohohohoho/johnny-bookstore:1.0 .
  5. Push to docker hub: docker push johnnyhohohohohoho/johnny-bookstore:1.0 or AWS ECR
  6. In AWS ECS, setup container for the backend by coping the image link(docker.io/johnnyhohohohohoho/johnny-bookstore:1.0) in docker hub
  7. For the React frontend, modify the request endpoint and build a docker image for it
  8. Push the frontend image to docker hub or ECR
  9. In AWS ECS, setup container for the frontend image
  10. Reference: Spring Boot + Angular + MYSQL on AWS ECS Fargate | AWS ECS Fargate
  11. Github: shameed1910 / springboot-angular-aws-fargate

Deploy backend api to AWS EC2

  1. Choose an AMI (Amazon Machine Image) for EC2 instance in AWS Management Console
  2. Choose EC2 instance type
  3. In security group section, click Add Rule button to add a rule allow TCP traffic on port 8080
  4. Store the key-pair .pem for accessing the EC2 instance
  5. Modify database link in application.properties to the cloud database. A better way is to separate *-dev.properties and *-prod.properties file for different database enpoints
  6. Generate .war file: mvn clean install -DskipTests=true or generate .jar file by ./gradlew bootJar
  7. Create a deploy.sh file to copy the executable jar/war to the ec2 using the .pem file to connect to ec2
  8. Include ssh command to connect to the EC2 (the command would be provided by the AWS EC2 setup page) in deploy.sh
  9. Kill the previous running process
  10. Restart the updated project by java -jar xxxx-SNAPSHOOT.jar / xxxx-SNAPSHOOT.war
  11. Reference: Deploying/Hosting Spring Boot Applications on AWS EC2
  12. Reference: Full-Stack Spring Boot with Angular CRUD API application with MYSQL on AWS | AWS EC2 | AWS S3 | RDS
  13. Github: shameed1910 / springboot-crud-api

Deploy frontend React app to AWS S3

  1. Modify the api call url to the cloud api call endpoint
  2. npm install
  3. npm run build
  4. upload the content in build folder to the AWS S3 bucket
  5. In the bucket Properties section, choose "Static website hosting" and save

About

Stacks: React, Spring Boot, JPQL, Docker and AWS SLS. An bookstore application that allow users to view, order and receive confirmation emails.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published