Technologies • Getting Started • API Endpoints • Collaborators • Contribute
This project was developed as part of a challenge for a job opportunity at LEDS. Its goal is to match candidates with government-offered job opportunity exams.
The API was built using Spring Boot, following best practices such as Clean Code principles, comprehensive testing, and maintainable architecture.
It features a complete CI/CD pipeline, automating the following steps using GitHub Actions:
- Build & Test: Compiles and validates the API using Maven
- Containerization: Packages the application into a Docker container
- Code Quality Analysis: Runs static code analysis using SonarQube
- Image Deployment: Pushes the Docker image to Docker Hub
- Server Deployment: Pulls and deploys the containerized application on an AWS EC2 instance
Ensure you have the following installed:
Run the following command to clone the project:
git clone https://github.com/jhonatademuner/leds-devops.git
cd leds-devops Before configuring the application, you need to set up a PostgreSQL 16 database using Docker.
1️⃣ Create a Volume for Data Persistence
Run the following command to create a Docker volume:
docker volume create postgres_data2️⃣ Start a PostgreSQL 16 Container with a Persistent Volume
docker run --name postgres-db \
-e POSTGRES_USER=admin \
-e POSTGRES_PASSWORD=admin \
-e POSTGRES_DB=leds_devops \
-p 5432:5432 \
-v postgres_data:/var/lib/postgresql/data \
-d postgres:16Explanation of the parameters:
--name postgres-db→ Assigns a name to the container-e POSTGRES_USER=admin→ Sets the database username toadmin-e POSTGRES_PASSWORD=admin→ Sets the database password toadmin-e POSTGRES_DB=leds_devops→ Creates a database namedleds_devops-p 5432:5432→ Maps the local port 5432 to the container’s PostgreSQL port-v postgres_data:/var/lib/postgresql/data→ Persists database data in a Docker volume-d postgres:16→ Runs the container in the background using PostgreSQL 16
3️⃣ Verify if the Container is Running
docker psAfter setting up the database, update the application.properties file with your database credentials:
sspring.datasource.url=jdbc:postgresql://localhost:5432/leds_devops
spring.datasource.username=admin
spring.datasource.password=adminFrom the project root directory, execute:
mvn clean install # Builds the project
mvn spring-boot:run # Starts the application| Route | Description |
|---|---|
| GET /match/candidate/{citizenId} | Returns the exams that match the candidate roles. SEE RESPONSE EXAMPLE |
| GET /match/exam/{examCode} | Returns the candidates that match the exam roles. SEE RESPONSE EXAMPLE |
📌 Response Example:
[
{
"agency": "SETADES",
"notice": "8/2016",
"code": "01403106938"
},
{
"agency": "SESA",
"notice": "9/2016",
"code": "22480949466"
},
...
]📌 Response Example:
[
{
"name": "Nicole Spears",
"dateOfBirth": "1955-05-07T03:00:00.000+00:00",
"citizenId": "25144278168"
},
{
"name": "Tyrone Gaines",
"dateOfBirth": "1976-04-25T03:00:00.000+00:00",
"citizenId": "26401259887"
},
...
]The API includes additional endpoints for managing candidates, exams, and roles. The complete documentation is available through Swagger UI.
🔹 Access the Swagger Page:
http://localhost:8080/swagger-ui/index.html
This allows you to explore all available endpoints, test requests, and check request/response formats. 🚀
|
Jhonata Demuner |
Want to contribute? Follow these steps:
- Fork the repository
- Clone your fork:
git clone https://github.com/your-username/leds-devops.git
cd leds-devops- Create a branch following the naming convention:
git checkout -b feature/ISSUE-BEING-SOLVED- Follow "Conventional Commits" for commit messages
- Open a Pull Request (PR) with a clear description of your changes