Example to create microservices using spring boot, spring cloud
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
Java jdk 8
- Eclipse
- Intellij IDEA
- Server config
- Registry-service
- Gateway-service
- Customer-service
- Financial-service
- Security-service
- workspace (in this folder you'll find properties files [local, docker[feature]])
- create docker image-instance mysql
java -jar [parameters] [name component].jar
` java -jar -Dname.property=value example.jar `
Follow the next steps.
-
run Server-config, this will run on port localhost:8888, on this you need to pass some variables like parameters
-Dgit.uri=none -Dapi.profiles.mode=native -Dgit.username=none -Dgit.password=none -Dnative.searchLocation=[path folder workpace/profile]
-
Run Registry-servivce this will run on port http://localhost:8000
this is the part where server-config plays, give the properties to Registry-service
-Dconfig-server.uri=http://localhost:8888
if you did all well in this step put on the browser http://localhost:8000 and will load Eureka's page
-
Run Customer-service this will run on port http://localhost:7001 this is the part where server-config plays, give the properties to Customer-service
-Dconfig-server.uri=http://localhost:8888
-
Run Financial-service this will run on port http://localhost:7000 this is the part where server-config plays, give the properties to Financial-service
-Dconfig-server.uri=http://localhost:8888
-
Run Security-service this will run on port http://localhost:7002 this is the part where server-config plays, give the properties to Security-service
-Dconfig-server.uri=http://localhost:8888
-
Run Gateway-service this will run on port http://localhost:8080 this is the part where server-config plays, give the properties to Gateway-service
-Dconfig-server.uri=http://localhost:8888
-
Creating docker container database - mysql
docker run --name=mysql1 -d mysql/mysql-server:tag
Example
-
we wil download the image and create container
` docker run --name=mysql-docker -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -d mysql:latest ` by default user = root
-
We will run de container
docker run <container id> -it /bin/bash
get in de docker container
-
We log in in mysql container
` mysql -u root -p ` after mysql asks for password which is *root*
-
We will use mysql commnads
` show databases; ` output ` +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+ `
-
we create databases according to properties [Security-services and Customer-services] execute the next statements
CREATE DATABASE customer_service;
CREATE DATABASE security_service;
-
This is the first version.
- Lewis Florez Renza - Initial work
This project is licensed under the MIT License - see the LICENSE.md file for details