Fortune Teller is an application composed of two services:
-
Fortune Service - serves up random Chinese fortune cookie fortunes
-
Fortune UI - presents a UI that consumes the fortune service
These applications leverage libraries and services from Spring Cloud and Netflix OSS to demonstrate powerful practices when writing Cloud Native applications.
Fortune Teller is deployable to any Cloud Foundry environment utilizing the service components that have been packaged with the project. However, it is most easily deployed to Pivotal Cloud Foundry environments that have installed the Spring Cloud Services package.
-
Using the Maven Wrapper, build and package the application:
$ git clone [REPO] $ cd [REPO] $ ./mvnw package
Maven will automatically download all of Fortune Teller's dependencies. This may take a few moments.
For the Spring One Conference 2018: We will run scripts/create_services_S1P-2018.sh to create the services that we need on Pivotal Cloud Foundry, on PWS. This script is for the 2018 Spring One Platform Conference, and we will be using the github repo: /~https://github.com/S1PDemo/config-repo. For the conference, you will need to login to the S1PDemo github account, to change the file. Please note, that we will be using git subdirs , and search paths, to keep the configs separate. For example, the command to create the config server for S1Pdemo1 looks like:
cf cs p-config-server trial config-service -c '{ "git": { "uri": "/~https://github.com/S1PDemo/config-repo.git","searchPaths": "S1PDemo1" }}'
for S1Pdemo2
cf cs p-config-server trial config-service -c '{ "git": { "uri": "/~https://github.com/S1PDemo/config-repo.git","searchPaths": "S1PDemo2" }}'
and so on. These are using the SCS "trial" plan, and will therefore expire in 1 week, on Friday of the show.
Or
If you are running this demo as a Platform Architect, you will want to fork the config repo
using your own github account and then modify the create-services_PCF.sh or create-services_PWS.sh script to point at the correct repo, and correct mysql service.
-
Run
scripts/create-services_S1P.sh
(or the appropriate create-services script) to create the services that you need on Pivotal Cloud Foundry:$ ./create_services_S1P.sh Creating service instance fortunes-db in org S1Pdemo1 / space fortune-teller-demo as s1pcfdemo1@gmail.com... OK Creating service instance config-service in org S1Pdemo1 / space fortune-teller-demo as s1pcfdemo1@gmail.com... OK Create in progress. Use 'cf services' or 'cf service config-service' to check operation status. Creating service instance service-registry in org S1Pdemo1 / space fortune-teller-demo as s1pcfdemo1@gmail.com... OK Create in progress. Use 'cf services' or 'cf service service-registry' to check operation status. Creating service instance circuit-breaker in org S1Pdemo1 / space fortune-teller-demo as s1pcfdemo1@gmail.com... OK Create in progress. Use 'cf services' or 'cf service circuit-breaker' to check operation status.
-
Wait until the config-server, service-registry and circuit-breaker services have been created. Use cf services and wait until the last operation for these services is create succeeded. This might take a few minutes.
-
Edit the
manifest-pcf.yml
file to specify the Cloud Foundry target the apps are being pushed to, replacing the URL inTRUST_CERTS: api.sys.cloud.rick-ross.com
with the API endpoint for your Cloud Foundry deployment. This step is required to handle self-signed certificates. -
Push the microservices:
$ cf push -f manifest-pcf.yml
This will push the fortunes service and the ui application and bind all of the services.
The demos for this project are located here