Giter Site home page Giter Site logo

alexandreroman / fortune-teller Goto Github PK

View Code? Open in Web Editor NEW
2.0 4.0 1.0 91 KB

A demo project showcasing Spring Cloud Netflix on PCF

License: Apache License 2.0

Kotlin 82.94% HTML 6.44% JavaScript 5.57% CSS 5.05%
cloudfoundry spring-cloud netflix-eureka netflix-hystrix netflix-ribbon kotlin pivotal-cloud-foundry

fortune-teller's Introduction

Fortune Teller

Fortune Teller is a demo project written in Kotlin, showcasing cloud-native technologies such as Spring Boot and Spring Cloud.

Thanks to Spring Cloud Services for PCF, this app is leveraging key technologies for microservices:

  • Netflix Eureka: a service registry for locating microservices;
  • Netflix Ribbon: a client-side load balancer to distribute load among microservices;
  • Netflix Hystrix: a latency and fault tolerance library;
  • Open Feign: a REST client library that allows you to consume HTTP APIs with minimal overhead.

This app is made of two main components:

  • fortune-service: a microservice connected to a database, serving fortunes;
  • fortune-ui: a simple HTML frontend, rendering fortunes to users.

How to use it?

Run locally

Compile this project using Maven and JDK 8:

$ ./mvnw clean package

When running locally, this app requires an Eureka server:

$ java -jar eureka-server/target/eureka-server.jar

You also need to run a RabbitMQ server. The easiest way is to use the official RabbitMQ Docker image:

$ docker run --hostname rabbit --rm -p "5672:5672/tcp" rabbitmq:3

You are now ready to start the two main components:

$ java -jar fortune-service/target/fortune-service.jar
$ java -jar fortune-ui/target/fortune-ui.jar

Go to http://localhost:8080:

You may want to start more processes. All you need is to set a different port for each process:

$ PORT=1234 java -jar fortune-service/target/fortune-service.jar
$ PORT=5678 java -jar fortune-service/target/fortune-service.jar

Thanks to Eureka, these new processes are automatically registered, and consumers like fortune-ui seamlessly access these services.

Deploy to Pivotal Cloud Foundry

Prior to deploying this app to Pivotal Cloud Foundry, you need to create required services:

$ cf create-service p-circuit-breaker-dashboard standard circuit-breaker
$ cf create-service p-service-registry standard service-registry

Monitor service creation (it can take some time):

$ cf services
name               service                       plan       bound apps   last operation
circuit-breaker    p-circuit-breaker-dashboard   standard                create succeeded
service-registry   p-service-registry            standard                create succeeded

Now it's time to deploy the app to PCF:

$ cf push

Deploy to Pivotal Web Services

In case you want to deploy to Pivotal Web Services (a public instance of PCF for testing purposes), you should use a different manifest when pushing the app:

$ cf push -f manifest-pws.yml

Contribute

Contributions are always welcome!

Feel free to open issues & send PR.

License

Copyright © 2018 Pivotal Software, Inc.

This project is licensed under the Apache Software License version 2.0.

fortune-teller's People

Contributors

alexandreroman avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

aspineon

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.