Compare commits

..

No commits in common. "main" and "af46e1f877a673aa45dc24f4f75754235f0c4387" have entirely different histories.

4 changed files with 0 additions and 125 deletions

Binary file not shown.

View File

@ -1,60 +0,0 @@
# 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.

View File

@ -1,50 +0,0 @@
#!/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

View File

@ -1,15 +0,0 @@
#!/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