pivotal-cf/oss-pcf-gcp-retail-demo

Name: oss-pcf-gcp-retail-demo

Owner: Pivotal Cloud Foundry

Description: PCF on GCP Retail Demo, Open Source version

Created: 2017-08-18 15:05:45.0

Updated: 2018-03-27 00:59:49.0

Pushed: 2018-02-14 21:52:12.0

Homepage: null

Size: 4010

Language: HTML

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

PCF + GCP Retail Demo

Diagram showing major components and how data flows Caveat: this version has no Persistence Service

A demo for retailers to see how PCF and GCP turn streams of data into action.
Prerequisites
Deploy some Python apps

There are a few Python applications used here, and the easiest way to get this all deployed is to get a few of them running first.

Install Spring Cloud Dataflow (SCDF) server

SCDF is the foundation of the data flow through this system. The server orchestrates the data streams, which are composed of modular building blocks. These can be Source, Processor, or Sink. There is a large set of out of the box components available and, since they are Spring Boot apps, it is easy to build a customized module.

  1. Download the SCDF server and client JAR files, as documented here
  2. Configure the manifest
  3. Ensure RabbitMQ, MySQL, and Redis tiles are installed (using Ops Manager, in PCF)
  4. Create service instances of each of these, using cf cs ...
  5. Push this app to PCF on GCP
  6. Ensure it is running
  7. Access the SCDF Dashboard (at https://dataflow-server.YOUR_PCF_INSTALL.DOMAIN/dashboard/)
Set up the SCDF stream “data backbone” consisting of the following components
Build and upload your SCDF modules
  1. Build the Processor project: ( cd ./transform-proc/ && ./build.sh )
  2. Upload the resulting JAR, ./transform-proc/target/transform-proc-0.0.1-SNAPSHOT.jar, into a Cloud Storage bucket, so SCDF is able to acces it.
  3. Build the Sink project: ( cd ./offer-sink/ && ./build.sh )
  4. And upload its JAR, ./offer-sink/target/offer-sink-0.0.1-SNAPSHOT.jar, to Cloud Storage.
  5. In your Google Cloud Platform web console, within the Storage view, make each of these JAR files public by clicking the Share publicly box
Set up the SCDF stream

Here, you will register your modules in SCDF, define and then deploy a stream

  1. Register the default list of modules with the UI
    • Use your browser to go to the bulk import UI
    • Click the Action box associated with the Maven based Stream Applications with RabbitMQ Binder line
    • Verify you have a set of modules by clicking the APPS link in the dashboard UI. They should be listed there.
  2. Edit the script, ./scdf/scdf_create_stream.sh, substituting the appropriate values under # EDIT THESE VALUES
  3. Run the script: ./scdf/scdf_create_stream.sh NOTE: review this code snippet to see if our binding approach can be simplified (24 April 2017)
Create your Twitter API credentials
  1. Go to http://apps.twitter.com and click the Create New App button.
  2. Follow the steps on that page (requires you have a Twitter account), and the consumer key and secret will be generated.
  3. After the step above, you will be redirected to your app's page.
  4. There, create an access token under the Your access token section.
  5. Make a note of these for the next step, below.
Set up the Twitter app
  1. cd ./twitter/
  2. Edit ./twitter.py, setting the value for OUR_SCREEN_NAME to the one for your Twitter account.
  3. Copy the ./manifest_template.yml to ./manifest.yml
  4. Edit ./manifest.yml, replacing each instance of YOUR_KEY_HERE with the appropriate value from your Twitter API credential set
  5. Push the app without starting it: cf push --no-start
  6. Using cf apps, note the value in the “urls” column for the app whose name ends in “-http”
  7. Now, create a service named “http-hub” using a URI based on that value: cf cups http-hub -p '{"uri": "http://dataflow-server-hf30QYI-socialmedia-http.YOUR_PCF_INSTALL.DOMAIN"}'
  8. Bind the Twitter app to this service instance: cf bs twitter http-hub
  9. Start the Twitter app: cf start twitter
  10. Create a service based on the Twitter app: cf cups twitter-service -p '{ "uri": "http://twitter.YOUR_PCF_INSTALL.DOMAIN" }'
  11. Next, bind this service to the offer-sink app: cf bs dataflow-server-SOME_ID_STRING-socialmedia-offer-sink twitter-service
  12. Finally, restage the offer-sink app to get the binding to take effect: cf restage dataflow-server-SOME_ID_STRING-socialmedia-offer-sink
  13. cd -
Set up the Web UI

This is a little single-page UI to show the progression from incoming data to outbound offer

Review of the deployed system

SCDF Dashboard Streams View

Twitter App Showing Offer


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.