Skip to content
 
 

Repository files navigation

Leds DevOps Challenge 💻

TechnologiesGetting StartedAPI EndpointsCollaboratorsContribute

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
Additionally, the application relies on an AWS RDS database for persistent storage, ensuring scalability and reliability.

💻 Technologies

Java Spring Apache Maven jUnit Mockito Swagger Postgres GitHub Actions Docker SonarQube Terraform AWS

🚀 Getting started

📌 Prerequisites

Ensure you have the following installed:

📥 Cloning

Run the following command to clone the project:

git clone https://github.com/jhonatademuner/leds-devops.git
cd leds-devops 

🛠️ Database Setup

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_data

2️⃣ 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:16

Explanation of the parameters:

  • --name postgres-db → Assigns a name to the container
  • -e POSTGRES_USER=admin → Sets the database username to admin
  • -e POSTGRES_PASSWORD=admin → Sets the database password to admin
  • -e POSTGRES_DB=leds_devops → Creates a database named leds_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 ps

⚙️ Configuring the Application

After 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=admin

🚀 Running the Application

From the project root directory, execute:

mvn clean install    # Builds the project
mvn spring-boot:run  # Starts the application

📍 API Endpoints

​ The following endpoints are the core of the application, responsible for matching candidates with exams:
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

🔎 GET /match/candidate/{citizenId}

📌 Response Example:

[
  {
    "agency": "SETADES",
    "notice": "8/2016",
    "code": "01403106938"
  },
  {
    "agency": "SESA",
    "notice": "9/2016",
    "code": "22480949466"
  },
  ...
]

🔎 GET /match/exam/{examCode}

📌 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"
  },
  ...
]

📜 Full API Documentation

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. 🚀

🤝 Collaborators

Jhonata Demuner Profile Picture
Jhonata Demuner

📫 Contribute

Want to contribute? Follow these steps:

  1. Fork the repository
  2. Clone your fork:
git clone https://github.com/your-username/leds-devops.git
cd leds-devops
  1. Create a branch following the naming convention:
git checkout -b feature/ISSUE-BEING-SOLVED
  1. Follow "Conventional Commits" for commit messages
  2. Open a Pull Request (PR) with a clear description of your changes

Documentations that might help

📝 How to create a Pull Request

About

Repositório com desafio técnico para avaliar habilidades de candidatos à vagas de DevOps no LEDS.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages