Distributed version of Spring Petclinic built with Spring Cloud
Java HTML JavaScript CSS
Switch branches/tags
Nothing to show
Clone or download
Latest commit 8fa041c Jul 16, 2018
Permalink
Failed to load latest commit information.
docker Reduce memory consumption of Docker images #76 (#77) May 2, 2018
spring-petclinic-admin-server Upgrade to Spring Cloud Finchley #72 (#80) Jul 14, 2018
spring-petclinic-api-gateway Upgrade to Spring Cloud Finchley #72 (#80) Jul 14, 2018
spring-petclinic-config-server Upgrade to Spring Cloud Finchley #72 (#80) Jul 14, 2018
spring-petclinic-customers-service Upgrade to Spring Cloud Finchley #72 (#80) Jul 14, 2018
spring-petclinic-discovery-server Upgrade to Spring Cloud Finchley #72 (#80) Jul 14, 2018
spring-petclinic-monitoring Upgrade to Spring Cloud Finchley #72 (#80) Jul 14, 2018
spring-petclinic-tracing-server Upgrade to Spring Cloud Finchley #72 (#80) Jul 14, 2018
spring-petclinic-vets-service Upgrade to Spring Cloud Finchley #72 (#80) Jul 14, 2018
spring-petclinic-visits-service Upgrade to Spring Cloud Finchley #72 (#80) Jul 14, 2018
.editorconfig Replace .tern-project by .editorconfig Oct 24, 2016
.gitignore Using gulp for minifying CSS and JS Oct 23, 2016
.travis.yml Using to openjdk8 to fix "CrossOrigin is missing value for the attrib… Nov 12, 2016
LICENSE #42 Add LICENSE (#43) Jan 25, 2017
README.md Upgrade to Spring Cloud Finchley #72 (#80) Jul 14, 2018
db_readme.txt Distribute springboot-petclinic-server among microservices Nov 12, 2016
docker-compose.yml Reduce memory consumption of Docker images #76 (#77) May 2, 2018
petclinic_db_setup_mysql.txt Distribute springboot-petclinic-server among microservices Nov 12, 2016
pom.xml Upgrade to Spring Cloud Finchley #72 (#80) Jul 14, 2018
sonar-project.properties test methods:used should/shouldNot Jan 16, 2015

README.md

Distributed version of the Spring PetClinic Sample Application built with Spring Cloud

Build Status License Dependency Status

This microservices branch was initially derived from AngularJS version to demonstrate how to split sample Spring application into microservices. To achieve that goal we used Spring Cloud Netflix technology stack.

Starting services locally without Docker

Every microservice is a Spring Boot application and can be started locally using IDE or mvn spring-boot:run command. Please note that supporting services (Config and Discovery Server) must be started before any other application (Customers, Vets, Visits and API). Tracing server and Admin server startup is optional. If everything goes well, you can access the following services at given location:

You can tell Config Server to use your local Git repository by using local Spring profile and setting GIT_REPO environment variable, for example: -Dspring.profiles.active=local -DGIT_REPO=/projects/spring-petclinic-microservices-config

Starting services locally with docker-compose

In order to start entire infrastructure using Docker, you have to build images by executing mvn clean install -PbuildDocker from a project root. Once images are ready, you can start them with a single command docker-compose up. Containers startup order is coordinated with wait-for-it.sh script. After starting services it takes a while for API Gateway to be in sync with service registry, so don't be scared of initial Zuul timeouts. You can track services availability using Eureka dashboard available by default at http://localhost:8761.

NOTE: Under MacOSX or Windows, make sure that the Docker VM has enough memory to run the microservices. The default settings are usually not enough and make the docker-compose up painfully slow.

Understanding the Spring Petclinic application with a few diagrams

See the presentation here

You can then access petclinic here: http://localhost:8080/

springboot-petclinic

In case you find a bug/suggested improvement for Spring Petclinic Microservices

Our issue tracker is available here: https://github.com/spring-petclinic/spring-petclinic-microservices/issues

Database configuration

In its default configuration, Petclinic uses an in-memory database (HSQLDB) which gets populated at startup with data. A similar setup is provided for MySql in case a persistent database configuration is needed. Note that whenever the database type is changed, the data-access.properties file needs to be updated and the mysql-connector-java artifact from the pom.xml needs to be uncommented.

You may start a MySql database with docker:

docker run -e MYSQL_ROOT_PASSWORD=petclinic -e MYSQL_DATABASE=petclinic -p 3306:3306 mysql:5.7.8

Looking for something in particular?

Spring Cloud components Resources
Configuration server Config server properties and Configuration repository
Service Discovery Eureka server and Service discovery client
API Gateway Zuul reverse proxy and Routing configuration
Docker Compose Spring Boot with Docker guide and docker-compose file
Circuit Breaker TBD
Graphite Monitoring TBD
Front-end module Files
Node and NPM The frontend-maven-plugin plugin downloads/installs Node and NPM locally then runs Bower and Gulp
Bower JavaScript libraries are defined by the manifest file bower.json
Gulp Tasks automated by Gulp: minify CSS and JS, generate CSS from LESS, copy other static resources
Angular JS app.js, controllers and templates

Contributing

The issue tracker is the preferred channel for bug reports, features requests and submitting pull requests.

For pull requests, editor preferences are available in the editor config for easy use in common text editors. Read more and download plugins at http://editorconfig.org.