This project contains a sample microservices application. I designed and developed a full-stack web app using a microservices architecture included both front-end and back-end services.
The application is built using a microservices architecture comprising:
- Front-end Service: The user interface of the application. (JavaScript, ReactJS)
- Back-end Services: Multiple services handling different business logic and data processing tasks:
- Auth Service: Handles user authentication, including login, registration, and session management. (JavaScript, NodeJS, ExpressJS) → MySQL
- Student Service: Manages student information, including storage, retrieval, update, and delete of student data. (Java, Spring Boot framework) → MySQL
- Lecturer Service: Manages lecturer information, including storage, retrieval, update, and delete of lecturer data. (Python, Flask) → MongoDB
- Class Service: Manages class information, including storage, retrieval, update, and delete of class data. (PHP) → PostgreSQL
Once a deployment phase is complete, the application is packaged and deployed to a local development environment. This setup allow us to verify that services, running as containers, perform as expected and conduct to necessary tests before moving to others environments.
For microservices, where each service may use different technologies and languages, creating well-designed Dockerfiles is crucial. They must include all necessary configurations for effective packaging and deployment, and be clearly defined for easy testing and updates.
Docker Compose plays a vital role in managing Docker-based applications. It simplifies the process of running multiple containers together and setting up a specific environment using a single YAML file. This file defines containers, ports, services, networks, volumes, and more, making packaging, distribution, and deployment straightforward, often with a single command.
- A Virtual Machine - Ubuntu (prefer): This VM will host the necessary components for containerized application deployment and testing. Install required software:
- A DockerHub account: Create an account on DockerHub if you don't already have one. DockerHub will be used to store and manage Docker images for the application.
→ You can sign up for a DockerHub account here: DockerHub Sign Up
This project is set up for auto deployment with Jenkins server by defining a Jenkins file (Jenkinsfile.dev). You can also configure and deploy manually by following these steps below:
📝 Notice: This repo contains a .env file which defines sensitive information (such as databases's name, username, password and more). You should re-define to suit with your context.
Clone this project to the VM manually:
git clone --recurse-submodules https://github.com/NT114-O21-DACN-DevOps/class-management.git
→ The command above will clone this repo along with all its submodules which contain all of the source codes for both front-end and back-end services.
After cloning the repositories, use docker compose
command to build and run the application locally:
docker compose up --build -d
→ The -d
option will help to run the command in detached mode (background), allowing you to continue working in the terminal without being occupied by Docker Compose logs.
If you do not modify the docker compose file, you can access to the application front-end by the exposed port. (3000)
Enter the URL below in the browser:
http://localhost:3000/