Code Monkey home page Code Monkey logo

locations-info-adapter-service's Introduction

locations-info-adapter-service

Project Overview

This project is a sample application built with Spring Boot 3.2.x that provides information about locations stored in a MongoDB database. The API utilizes Spring WebFlux for reactive request handling and is configured to run in a Docker container using Docker Compose. The connection to the MongoDB database is secured with SSL, demonstrating secure communication setup. Additionally, Jib is employed for streamlined Docker image creation.

Purpose

This application serves for an educational purpose to understand SSL functionality and its configuration for a data source within a Java application.

Features

  • Retrieves location information from a MongoDB database.
  • Utilizes Spring WebFlux for reactive request handling.
  • Configured to run in a Docker container with Docker Compose.
  • Secure database connection using SSL.
  • Integration with Jib for Docker image creation.

Requirements

Project Setup

1. Clone the Repository

Use the following command to clone the project.

git clone https://github.com/manuelrojas19/locations-info-adapter-service.git
cd locations-info-adapter-service

2. Generate JKS File and Add Certificate to you Truststore

This project requires a JKS certificate. You can generate it from your .crt file using the following command:

keytool -import -file mongoCA.crt -keystore mongo.jks -storepass <your_truststore_password>

If you need more detailed instructions or don't have the required certificates, refer to the certificates documentation.

Once generated, you need to add the root certificate to your system's trusted certificates store. On Linux or macOS, you can typically add it to the Java keystore (cacerts) located in your Java installation's lib/security directory:

keytool -import \
-alias mongo \
-storepass changeit \
-keystore /<your_java_home>/lib/security/cacerts \
-noprompt \
-trustcacerts \
-file ./mongoCA.crt

3. Prepare SSL Certificates

Create a certificates directory in the root of your project and place your SSL certificates and keys (.pem, .CA, .JKS files) inside this directory.

mkdir certificates
cd certificates
# Copy your SSL certificates and keys to certificates directory

Next, execute the following commands within the certificates directory to set up SSL for MongoDB and the project:

mkdir ../deploy/mongo-ssl/cert
cp mongo.pem ../deploy/mongo-ssl/cert
cp mongo.CA ../deploy/mongo-ssl/cert
cp mongo.CA src/main/jib

If you need more detailed instructions or don't have the required certificates, refer to the certificates documentation.

4. Run Docker Compose

This command will provision MongoDB with SSL configuration:

cd ../deploy
docker-compose up --build

4. Run the Project

Run the project using Maven with the specified configuration:

mvn spring-boot:run -Dspring-boot.run.profiles=localdev \ 
-Dspring-boot.run.jvmArguments="-Dspring.data.mongodb.keystore.base64=no-required-local-dev \
-Dspring.data.mongodb.keystore.password=<your_truststore_password>"

This setup ensures your SSL certificates are correctly organized and used for both MongoDB and your Spring Boot application.

locations-info-adapter-service's People

Contributors

manuelrojas19 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.