SpringBoot Micro-Services implementation and Eureka Discovery
Main Features:
- Spring boot
- Spring Boot Data Rest
- Eureka Server
- Eureka Discovery Client
- Micro-services communication using feign
- Swagger2 To document the API
- Angular (Ionic 4) Front-end Client.
- Asynchronous Programming for the Angular Client.
- Angular using Web Components.
- Angular responsive grid design, perfect for PWA and Android.
- MongoDB as Data Layer.
- MongoDB DBref references between collections.
To Run on Windows:
DATA LAYER:
-
Install MongoDB https://docs.mongodb.com/compass/master/install/
-
Start running MongoDB service using the MongoDB Compass, or type in the CMD:
$ net start MongoDB
-
Restore the Database I added to the proyect, so you don´t start from an empty database:
-
Copy the "dump" folder to "C:\Program Files\MongoDB\Server\4.0\bin" (Mongodb bin directory)
-
To load the database, in the same bin folder , just open the CMD and type:
$ mongorestore --db micro_services_followers
-
CORBA STUFF:
- Using the CMD:
$ start orbd -ORBInitialPort 1050
-
Copy folder "productor_consumidor_files" to the root of your user path: "C:\Users\david\productor_consumidor_files"
-
Start the Corba Buffer service in "ServidorComponenteCORBA\src\server\BufferServer.java" (Run as Java Application)
-
If you want to act like manager to read and write news, run "Productor-Consumidor\src\client\Servlet.java" on Tomcat. There you can access the servlet to add news to the corba server, later you can read them from the Angular Client.
PD: SOMETIMES TOMCAT FROM PRODUCTO-CONSUMIDR CAUSES CONFLICTS WITH corba_client SERVICE, TO SOLVE THIS, JUST ADD ALL THE NEWS TO CORBA BUFFER AND TURN-OFF THE TOMCAT SERVER, WORKS ONLY WITH THE CORBA BUFFER.
STARTING MICRO-SERVICES:
to start a micro-service, go to the root of the folder of a service and type (or use your IDE):
$ mvn spring-boot:run
-
Start Eureka_Server in "eureka_server"
-
Start all of the other services:
$ start start.bat
- asignar_juegos
- asignar_seguidores
- gestionar_juegos
- gestionar_jugadores
- verificar_datos
- lookup_services (IMPORTANT, This talks to the Angular front-end to get dinamically the ports of the services)
- corba_client (Reads all news from corba and convert them to JSON so Angular lists them in Tab3)
If you want some info about the API you can use Swagger2:
"http://localhost:PORT/swagger-ui.html"
STARTING ANGULAR (IONIC 4) CLIENT:
-
Make sure you have NodeJs 10 LTS https://nodejs.org/en/ (with npm)
-
Install the Ionic 4 CLI, if fails run on admin mode:
$ npm install -g ionic
- To run the Angular (Ionic) just go to "angular_frontend" folder and type:
$ ionic serve
Or build the project with the Angular CLI for production and navigate to folder www to start angular-http-server on port 8080 by default:
$ ng build --prod --buildOptimizer=true --aot=true --optimization=true
$ cd www
$ angular-http-server
- The app should detect dinamically the ports of all the micro-services and the corba client, thanks to looup-service.
That´s it :D