Compare commits
7 Commits
af46e1f877
...
main
Author | SHA1 | Date | |
---|---|---|---|
e5af19cd5e | |||
11d1169340 | |||
9eac2c9431 | |||
58b39aa84e | |||
05baac8db9 | |||
609ce6a346 | |||
65e1e26a37 |
BIN
Documentation.pdf
Normal file
BIN
Documentation.pdf
Normal file
Binary file not shown.
60
README.md
60
README.md
@ -0,0 +1,60 @@
|
|||||||
|
# Microservices Java Spring-boot app + Docker + Kubernetes
|
||||||
|
|
||||||
|
This project consists of an e-commerce application built with microservices using Spring Boot in Java 21 and Maven 4.0.0. The application is divided into three microservices: Shopfront (frontend), Product Catalogue (product catalog), and Stock Manager (inventory management). Additionally, a directory with YAML files for service deployment is included.
|
||||||
|
|
||||||
|
## Project Structure
|
||||||
|
|
||||||
|
* Simple examples of functional end-to-end tests that use JUnit and REST-assured to test the DJShopping application
|
||||||
|
* shopfront
|
||||||
|
* The 'shopfront' microservice of the DJShopping example application that provides the primary entry point for the end-user (both Web UI and API-driven)
|
||||||
|
* productcatalogue
|
||||||
|
- The 'product catalogue' microservice of the DJShopping example application, which provides product details like name and price
|
||||||
|
stockmanager
|
||||||
|
- The 'stock manager' microservice of the DJShopping example application, which provides stock information, such as SKU and quantity
|
||||||
|
|
||||||
|
* prepare-app.sh: script to prepare the application and create all related services.
|
||||||
|
* remove-app.sh: remove the application and all related services.
|
||||||
|
* Docker compose & Docker files.
|
||||||
|
|
||||||
|
## Technologies Used
|
||||||
|
|
||||||
|
* Java
|
||||||
|
* Spring-Boot 3.2.4
|
||||||
|
* Maven 4.0.0
|
||||||
|
* jdk v8
|
||||||
|
* Docker
|
||||||
|
* Kubernetes
|
||||||
|
|
||||||
|
## How to run the project
|
||||||
|
|
||||||
|
* Open console prompt
|
||||||
|
* Navigate to docker-Java-kubernetes-project
|
||||||
|
* Execute the following command:
|
||||||
|
´´´
|
||||||
|
minikube start #this will initialize the minikube service (kubernetes)
|
||||||
|
´´´
|
||||||
|
* Navigate to shopfront folder
|
||||||
|
* Run the following command:
|
||||||
|
```
|
||||||
|
mvn clean install
|
||||||
|
```
|
||||||
|
* One the building its finish execute the following command:
|
||||||
|
```
|
||||||
|
docker build -t shopfront:latest .
|
||||||
|
```
|
||||||
|
* Repeat in each folder
|
||||||
|
* Once you finish building all docker images execute:
|
||||||
|
```
|
||||||
|
docker images #to check the images in your system
|
||||||
|
```
|
||||||
|
* Execute the following command on the folder kubernetes
|
||||||
|
```
|
||||||
|
kubectl service file_name.yaml #to start the service, do it with all the services
|
||||||
|
```
|
||||||
|
* Execute the following command
|
||||||
|
```
|
||||||
|
minikube service service_name
|
||||||
|
```
|
||||||
|
- Do it with all the services, once you open the service productcatalogue got to http://localhost/port/products and the same with stockmanager -> http:localhost:port/stocks
|
||||||
|
|
||||||
|
* The application shold be running rigth now.
|
50
scripts/start-app.sh
Normal file
50
scripts/start-app.sh
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Build de los microservicios con Maven
|
||||||
|
echo "Building microservices..."
|
||||||
|
cd ../shoptfront-productcatalogue-stockmanager-Kubernetes
|
||||||
|
|
||||||
|
minikube start
|
||||||
|
|
||||||
|
cd shoptfront
|
||||||
|
mvn clean package
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
cd ../productcatalogue
|
||||||
|
mvn clean package
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
cd ../stockmanager
|
||||||
|
mvn clean package
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
# Creación de imágenes Docker
|
||||||
|
echo "Building Docker images..."
|
||||||
|
|
||||||
|
cd shoptfront
|
||||||
|
docker build -t shoptfront:latest .
|
||||||
|
|
||||||
|
|
||||||
|
cd ../productcatalogue
|
||||||
|
docker build -t productcatalogue:latest .
|
||||||
|
|
||||||
|
cd ../stockmanager
|
||||||
|
docker build -t stockmanager:latest .
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
# Despliegue en Kubernetes
|
||||||
|
echo "Deploying to Kubernetes..."
|
||||||
|
kubectl apply -f shoptfront-productcatalogue-stockmanager-kubernetes/kubernetes/shopfront-service.yaml
|
||||||
|
kubectl apply -f shoptfront-productcatalogue-stockmanager-kubernetes/kubernetes/productcatalogue-service.yaml
|
||||||
|
kubectl apply -f shoptfront-productcatalogue-stockmanager-kubernetes/kubernetes/stockmanager-service.yaml
|
||||||
|
|
||||||
|
# Openning services
|
||||||
|
|
||||||
|
minikube service shoptfront-service.yaml
|
||||||
|
|
||||||
|
minikube service productcatalogue-service.yaml
|
||||||
|
|
||||||
|
minikube service stockmanager-service.yaml
|
||||||
|
|
||||||
|
|
||||||
|
|
15
scripts/stop-app.sh
Normal file
15
scripts/stop-app.sh
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cd ../shoptfront-productcatalogue-stockmanager-kubernetes
|
||||||
|
|
||||||
|
# Eliminar despliegues en Kubernetes
|
||||||
|
echo "Deleting deployments from Kubernetes..."
|
||||||
|
kubectl delete -f shoptfront-deployment.yaml
|
||||||
|
kubectl delete -f productcatalogue-deployment.yaml
|
||||||
|
kubectl delete -f stockmanager-deployment.yaml
|
||||||
|
|
||||||
|
# Eliminar imágenes Docker
|
||||||
|
echo "Removing Docker images..."
|
||||||
|
docker rmi microservicio1
|
||||||
|
docker rmi microservicio2
|
||||||
|
docker rmi microservicio3
|
Loading…
Reference in New Issue
Block a user