The users of the system will consist of both school administrators and students. School administrators will create student identities, and students will be able to enroll themselves in classes before each term.
- Backend
- Spring Boot
- MongoDB
- Maven
- & Libraries [Lombok, Map Struct, Mockito, Junit 5 and Swagger Open Api]
- DevOps
- Docker, AWS (Code PipeLine, ECR and ECS - (EC2))
Git (https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
Docker:(https://docs.docker.com/get-docker/)
Clone this repository (Click on the green button that says Clone)
- Copy the URL
- Go to the Terminal/Command Line and go to a directory/folder where you want to place the repository. You can navigate through folders with the commands
ls DIRECTORY
(shows all the folders in your current folder) andcd DIRECTORY
(changes directory) - Once you're in a directory of your choice, type
git clone PASTE_THE_URL_HERE
- cd enrollment-system
mvn clean package
or
./mvnw clean package
To build the application image, you can use a simpler Docker command line:
docker build -t enrollment-system:1.0 .
Instead of building with the Docker command line, we could use Spring boot image, but it takes a longer time [Alternative option]
./mvnw spring-boot:build-image -Dspring-boot.build-image.imageName=enrollment-system:1.0
Run docker-compose up
; this will take quite some time. (Started EnrollmentSystemApplication in 5.602 seconds (JVM running for 6.33)
is the line that confirms the startup).
docker-compose build
docker-compose up
By default, this application runs on port 8080 inside the container.
To check the API documentation, which is automatically generated using Open API (Swagger).
Go to : http://localhost:8080/swagger-ui.html
- Mac:
ctrl + c
- Windows:
ctrl + c
- or in another tab in the terminal/command line, enter the following
docker-compose down
With volumes.
docker-compose down -v
docker logs enrollment-system
docker exec -it mongodb bash
Method: Post
Url: http://localhost:8080/semesters
Body [Json] :
{
"name": "Spring2021",
"startDate": "2021-02-07",
"endDate": "2021-02-07"
}
Method: Post
Url: http://localhost:8080/classes
Body [Json] :
{
"name": "classA",
"credit": 4
}
Method: Post
Url: http://localhost:8080/students
Body [Json] :
{
"id": 1,
"firstName": "vadivel",
"lastName": "murugesan",
"nationality": "US",
}
Method: Post
Url: http://localhost:8080/enrollments
Body [Json] :
{
"semester": "Spring2021",
"id": 1,
"class": "classA"
}
Method: Get
Url: http://localhost:8080/students/1
Method: PUT
Url: http://localhost:8080/students
Body [Json] :
{
"id": 1,
"firstName": "vadivel",
"lastName": "murugesan",
"nationality": "US",
}
API to get the list of classes for a particular student for a semester or the full history of classes enrolled.
Method: GET
Urls:
http://localhost:8080/fetchClasses?semester=Spring2021&id=1
http://localhost:8080/fetchClasses?id=1
Method: GET
Urls:
http://localhost:8080/fetchStudents
http://localhost:8080/fetchClasses?id=1
http://localhost:8080/fetchClasses?semester=Spring2021
http://localhost:8080/fetchClasses?pageNo=1&pageSize=100
Method: Delete
Url: http://localhost:8080/enrollments?id=1&class=classA
Note: It is recommended to use http://localhost:8080/swagger-ui.html for detailed information.
If any code pushes to this GitHub repository, the Git webhook initiates the AWS CodePipeline automatically.
buildSpec.yml helps to do the following
- Execute the maven test and build
- Create a docker image and push it to ECR
- Create an imagedefinitions.json file for the deployment
The code pipeline for this application consists of three stages:
- Code Source - Pull from Github
- Code Build - Maven build and Create a docker Image
- Code Deploy - Deploy into ECS - Ec2 instance
Note: This code has been reviewed by SonarQube.