Wilson Mar bio photo

Wilson Mar

Hello. Hire me!

Email me Calendar Skype call 310 320-7878

LinkedIn Twitter Gitter Google+ Youtube

Github Stackoverflow Pinterest

Get setup for the Industrial Internet


Overview

This article provides step-by-step instructions to register and install Predix, GE’s brand name for their “Industrial Internet” sales.

Actions to get started:

  1. Slack channel setup
  2. Predix Account setup
  3. Predix Developers Forum

  4. Select an approach to install 3rd-party utilities
  5. Hosting in the Cloud Foundry cloud
  6. Local install
  7. Devbox with pre-built virtual machines

I want you to feel confident that you’ve mastered this skill. That’s why this takes a hands-on approach where you type in commands and we explain the responses and possible troubleshooting. This is a “deep dive” because all details are presented.

Like a good music DJ, I’ve carefully arranged the presentation of concepts into a sequence for easy learning, so you don’t have to spend as much time as me making sense of the flood of material around this subject.

Sentences that begin with PROTIP are a high point of this website to point out wisdom and advice from experience. NOTE point out observations that many miss. Search for them if you only want “TL;DR” (Too Long Didn’t Read) highlights.

Stuck? Contact me and I or one of my friends will help you.


Slack channel setup

  1. Join the Intelligent-world Slack channel for Predix developers

    Once you receive a confirmation email, activate the Slack app on your Mac or PC if you’d like to switch among differen Slack channels.

  2. Click the “+” at the lower left corner.

  3. Type in the teamdomain of “intelligentworld” and click Continue.

  4. Type in the email you used to register and click Continue.

  5. If you clicked “Send Magic Link”, open the email and click “Sign into Slack”.

    That action opens browser for you to click “Launch Slack”.

  6. Choose whether to enable desktop notifications.

  7. Now return temporarily to your browser to close the tabs to access Slack.

Predix Account setup

  1. Click the link below to register for a Predix account at
    https://www.predix.io/registration

    QUESTION: After the free days, $ ___ per month?

  2. Confirm phone and email while on the page.

    A GitHub repo account needs to be specified.

    PROTIP: Don’t expect a response if you provide a gmail or hotmail account, even after phone ane email confirmation code confirmations. That’s my personal experience

  3. Wait for the confirm email from Predix. If you’re deemed legitimate:

    “Thanks for your interest in a Predix trial account. We’ll validate your information, and will respond within five business days.”

  4. Wait for the email from Predix.

    Each developer’s GitHub account is granted access to the repository and a number of subrepositories:

  5. Once approved, you can then enroll in training.

    “Please connect to BlueSSO and go to training.predix.io. From there, log in with your Predix credentials and enroll in the “On-Demand” courses. This is where you will find access to the free eLearning videos.”

    Note that the training site is different from
    https://www.predix.io/resources/training

  6. After approval, you’ll be able to post on the
    Predix Developers Forum

Third-party components

Collaboration:

  • GIT, SVN, Pair Programming*,
  • Environment Portability*,
  • Multiple Sandbox Environments*

IDE / Editors:

Front End:

Back End:

  • Cloud Foundry CLI, User Authentication and Authorization CLI,
  • Microsoft
  • Java,
  • Maven,
  • Ruby,
  • Python
  • RabbitMQ Message Queue

Database:

  • PostgreSql 9.3 and psql utilities,
  • Couchdb

Big Data:

  • Anaconda distribution of Python (Pandas, Scipy, Numpy, and sklearn)

Predix Components

Local install

Devbox

If you’re running on a Oracle/Red Hat Linux System

https://www.predix.io/resources/tutorials

https://www.predix.io/services/other-resources/devbox.html:


Eclipse STS IDE

This advises the use of STS

  1. Use an interest browser to the STS website.
  2. Select a download site to begin download. Wait for the file to download.
  3. Unzip
  4. In Finder, navigate inside the folder, such as:

    ~/Documents/workspace-sts-3.8.0.RELEASE

    This contains the server.

  5. Move and/or rename the folder according to your organization’s standards.

  6. In Finder navigate to /Applications.
  7. Move (drag and drop) STS.app to /Applications.
  8. Open STS by double-clicking the icon.
  9. Click Open icon for first-time confirmation.
  10. Specify your workspace.

STS (Spring Tools Suite)

Included with STS (Spring Tools Suite) is the developer edition of Pivotal tc Server, the drop-in replacement for Apache Tomcat that’s optimized for Spring.

The Spring Insight console, tc Server Developer Edition, provides a graphical real-time view of application performance metrics that lets developers identify and diagnose problems from their desktops.

Spring framework

https://spring.io/guides

The framework is based on the Java Spring framework, which many now consider “heavy”.

This is surprising considering most others in their industry have gone to Python or React.

QUESTION: Why Spring and not Node or Python or React?

Maybe it’s because there are more Java Spring developers unemployed than the other hotter frameworks?

Or that Spring is more “mature” as a framework since it’s been around since the 90’s.

predixdev

During register for a Predix account, each developer’s GitHub account is granted access to the repository and a number of subrepositories at

Cloud Foundry cloud

https://www.vmware.com/products/vfabric-tcserver/ Cloud Foundry is by VMware Pivotal is purchased as part of the VMWare Fabric containing the “VMware vFabric tc Server”.

  1. At https://github.com/cloudfoundry/cli/releases click the “Latest Release”.

  2. Use Homebrew:

    brew tap cloudfoundry/tap

The response (on 7 July 2016):

==> Tapping cloudfoundry/tap
Cloning into '/usr/local/Library/Taps/cloudfoundry/homebrew-tap'...
remote: Counting objects: 7, done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 7 (delta 0), reused 3 (delta 0), pack-reused 0
Unpacking objects: 100% (7/7), done.
Checking connectivity... done.
Tapped 2 formulae (33 files, 27K)
  
  1. Install Command Line Interface:

    brew install cf-cli

    The response:

    ==> Installing cf-cli from cloudfoundry/tap
    ==> Downloading https://cli.run.pivotal.io/stable?release=macosx64-binary&version=6.20.0&source=homebrew
    ==> Downloading from https://s3.amazonaws.com/go-cli/releases/v6.20.0/cf-cli_6.20.0_osx.tgz
    ######################################################################## 100.0%
    🍺  /usr/local/Cellar/cf-cli/6.20.0: 2 files, 22.1M, built in 18 seconds
    
  2. Verify:

    cf help

    The response expand the width of shell window to see:

    NAME:
    cf - A command line tool to interact with Cloud Foundry
    
    

USAGE: cf [global options] command [arguments…] [command options]

VERSION: 6.20.0+25b1961-2016-06-29

GETTING STARTED: help Show help version Print the version login Log user in logout Log user out passwd Change user password target Set or view the targeted org or space

api Set or view target api url auth Authenticate user non-interactively

APPS: apps List all apps in the target space app Display health and status for app

push Push a new app or sync changes to an existing app scale Change or view the instance count, disk space limit, and memory limit for an app delete Delete an app rename Rename an app

start Start an app stop Stop an app restart Restart an app restage Restage an app </pre>

### Sample app #

  1. In an internet browser, explore sample apps in Cloud Foundry’s sample organization:
    https://github.com/cloudfoundry-samples

    Back at the Termial:

  2. Clone the sample app:

    mkdir ~/gits/pivotal
    cd ~/gits/pivotal
    git clone https://github.com/cloudfoundry-samples/cf-sample-app-spring.git

    The response:

    Cloning into 'cf-sample-app-spring'...
    remote: Counting objects: 69, done.
    remote: Total 69 (delta 0), reused 0 (delta 0), pack-reused 69
    Unpacking objects: 100% (69/69), done.
    Checking connectivity... done.
    
  3. Navigate to the repo created:

    cd cf-sample-app-spring

  4. Sign in to PWS:

    cf login -a https://api.run.pivotal.io

    The response:

    API endpoint: https://api.run.pivotal.io
    Email> 
    
  5. Type in your Email, then Password.

    The response:

    API endpoint:   https://api.run.pivotal.io (API version: 2.57.0)
    User:           xxx@gmail.com
    No org or space targeted, use 'cf target -o ORG -s SPACE'
    
  6. Type in email and password (which is not reflected back to the screen):

    Authenticating...
    OK
     
    Targeted org montana
     
    Select a space (or press enter to skip):
    
  7. development
  8. joliet   Space> 2 </pre>

  9. Type in the number associated with the space you want to use (based on the list):

    Targeted space joliet
     
    API endpoint:   https://api.run.pivotal.io (API version: 2.57.0)
    User:           xxx@gmail.com
    Org:            montana
    Space:          joliet
    

    API End-points

    API endpoint: https://api.run.pivotal.io

    Predix Basic for individual emails:

    • https://api.system.aws-usw02-pr.ice.predix.io

    Predix Select for company names:

    • https://api.system.asv-pr.ice.predix.io

    Deploy app

  10. Deploy the app to PWS:

    cf push

    The response begins with:

    Using manifest file /Users/mac/gits/pivotal/cf-sample-app-spring/manifest.yml
     
    Creating app cf-spring in org montana / space joliet as wilsonmar@gmail.com...
    OK
     
    Creating route cf-spring-isomagnetic-pleiophylly.cfapps.io...
    OK
     
    Binding cf-spring-isomagnetic-pleiophylly.cfapps.io to cf-spring...
    OK
     
    Uploading cf-spring...
    Uploading app files from: /Users/mac/gits/pivotal/cf-sample-app-spring
    Uploading 1M, 44 files
    Done uploading               
    OK
     
    Starting app cf-spring in org montana / space joliet as xxx@gmail.com...
    

    The response ends with:

    requested state: started
    instances: 1/1
    usage: 512M x 1 instances
    urls: cf-spring-isomagnetic-pleiophylly.cfapps.io
    last uploaded: Wed Jul 20 02:10:46 UTC 2016
    stack: unknown
    buildpack: java-buildpack=v3.8.1-offline-https://github.com/cloudfoundry/java-buildpack.git#29c79f2 open-jdk-like-jre=1.8.0_91-unlimited-crypto open-jdk-like-memory-calculator=2.0.2_RELEASE spring-boot-cli=1.3.5_RELEASE
     
      state     since                    cpu    memory           disk         details
    #0   running   2016-07-19 08:11:24 PM   0.0%   338.7M of 512M   155M of 1G
    
  11. TODO: Change the log color.

  12. View log snapshots

    cf logs cf-spring –recent

    From Marketplace

  13. List the available ElephantSQL service plans in the Marketplace:

    cf marketplace -s elephantsql

    The response:

    Getting service plan information for service elephantsql as wilsonmar@gmail.com...
    OK
     
    service plan   description                                            free or paid
    turtle         4 concurrent connections, 20MB Storage                 free
    panda          20 concurrent connections, 2GB Storage                 paid
    hippo          300 concurrent connections, 100 GB Storage             paid
    elephant       300 concurrent connections, 1000 GB Storage, 500Mbps   paid
    
  14. Create a service instance with the free plan “turtle”:

    cf create-service elephantsql turtle cf-spring-db

    The response:

    Creating service instance cf-spring-db in org montana / space joliet as xxx@gmail.com...
    OK
    
  15. Bind the newly created service to the app:

    cf bind-service cf-spring cf-spring-db

    NOTE: When a service is bound to an app, environment variables are stored that allow the app to connect to the service after a push, restage, or restart command.

    The response:

    Binding service cf-spring-db to app cf-spring in org montana / space joliet as wilsonmar@gmail.com...
    OK
    TIP: Use 'cf restage cf-spring' to ensure your env variable changes take effect
    
  16. Restart the app:

    cf restart cf-spring

    The response:

    Stopping app cf-spring in org montana / space joliet as xxx@gmail.com...
    OK
     
    Starting app cf-spring in org montana / space joliet as xxx@gmail.com...
     
    0 of 1 instances running, 1 starting
    
  17. Verify the new service is bound to the app:

    cf services

    The response:

    name           service       plan     bound apps   last operation
    cf-spring-db   elephantsql   turtle   cf-spring    create succeeded
    

    Configure scaling

  18. Increase the number of app instances from one to two:

    cf scale cf-spring -i 2

  19. Check the status of the app and verify there are two instances running:

    cf app cf-spring

    WARNING: Scaling your app vertically changes the disk space limit or memory limit for each app instance.

  20. Increase the memory limit for each app instance:

    cf scale cf-spring -m 1G

  21. Increase the disk limit for each app instance:

    cf scale cf-spring -k 512M


  1. Install uaac:

    gem install cf-uaac

    The response:

    Fetching: multi_json-1.12.1.gem (100%)
    Successfully installed multi_json-1.12.1
    Fetching: cf-uaa-lib-3.4.0.gem (100%)
    Successfully installed cf-uaa-lib-3.4.0
    Fetching: highline-1.6.21.gem (100%)
    Successfully installed highline-1.6.21
    Fetching: eventmachine-1.0.9.1.gem (100%)
    Building native extensions.  This could take a while...
    Successfully installed eventmachine-1.0.9.1
    Fetching: launchy-2.4.3.gem (100%)
    Successfully installed launchy-2.4.3
    Fetching: cookiejar-0.3.3.gem (100%)
    Successfully installed cookiejar-0.3.3
    Fetching: em-socksify-0.3.1.gem (100%)
    Successfully installed em-socksify-0.3.1
    Fetching: http_parser.rb-0.6.0.gem (100%)
    Building native extensions.  This could take a while...
    Successfully installed http_parser.rb-0.6.0
    Fetching: em-http-request-1.1.5.gem (100%)
    Successfully installed em-http-request-1.1.5
    Fetching: json_pure-1.8.3.gem (100%)
    Successfully installed json_pure-1.8.3
    Fetching: rack-1.5.5.gem (100%)
    Successfully installed rack-1.5.5
    Fetching: cf-uaac-3.3.0.gem (100%)
    Successfully installed cf-uaac-3.3.0
    Parsing documentation for multi_json-1.12.1
    Installing ri documentation for multi_json-1.12.1
    Parsing documentation for cf-uaa-lib-3.4.0
    Installing ri documentation for cf-uaa-lib-3.4.0
    Parsing documentation for highline-1.6.21
    Installing ri documentation for highline-1.6.21
    Parsing documentation for eventmachine-1.0.9.1
    Installing ri documentation for eventmachine-1.0.9.1
    Parsing documentation for launchy-2.4.3
    Installing ri documentation for launchy-2.4.3
    Parsing documentation for cookiejar-0.3.3
    Installing ri documentation for cookiejar-0.3.3
    Parsing documentation for em-socksify-0.3.1
    Installing ri documentation for em-socksify-0.3.1
    Parsing documentation for http_parser.rb-0.6.0
    Installing ri documentation for http_parser.rb-0.6.0
    Parsing documentation for em-http-request-1.1.5
    Installing ri documentation for em-http-request-1.1.5
    Parsing documentation for json_pure-1.8.3
    Installing ri documentation for json_pure-1.8.3
    Parsing documentation for rack-1.5.5
    Installing ri documentation for rack-1.5.5
    Parsing documentation for cf-uaac-3.3.0
    Installing ri documentation for cf-uaac-3.3.0
    Done installing documentation for multi_json, cf-uaa-lib, highline, eventmachine, launchy, cookiejar, em-socksify, http_parser.rb, em-http-request, json_pure, rack, cf-uaac after 10 seconds
    12 gems installed
    
  2. Verify use of uaac:

    uaac

    The response:

    UAA Command Line Interface
    
    

Miscellaneous version Display version help [topic|command…] Display summary or details of command or topic target [uaa_url] Display current or set new target </pre>

  1. Install bower for front-end UI flat (non-recursive) dependencies tree:

    npm install -g bower

    See https://coolestguidesontheplanet.com/installingbower-on-osx/

    Verify:

    bower –version

Install Predix

See https://www.predix.io/resources/tutorials/tutorial-details.html?tutorial_id=1523

  1. Create a folder (~/gits/predix) to hold repos and cd to it.

    Predix offers two samples:

    • git clone https://github.com/PredixDev/predix-microservice-cf-jsr.git
    • git clone https://github.com/PredixDev/predix-microservice-cf-spring.git
  2. Create repo for JSR and cd into it:

    git clone https://github.com/PredixDev/predix-microservice-cf-jsr.git
    cd predix-microservice-cf-jsr

    The tree of folders and files for JSR is more complex than Spring:

    |-- COPYRIGHT.md
    |-- LICENSE.md
    |-- README.md
    |-- config
    |   `-- application.properties
    |-- manifest.yml
    |-- pom.xml
    `-- src
     |-- main
     |   |-- java
     |   |   `-- com
     |   |       `-- ge
     |   |           `-- predix
     |   |               `-- solsvc
     |   |                   |-- boot
     |   |                   |   |-- Application.java
     |   |                   |   |-- PredixBootSecurityConfig.java
     |   |                   |   `-- service
     |   |                   |       `-- cxf
     |   |                   |           |-- ApplicationJSONProvider.java
     |   |                   |           |-- DefaultService.java
     |   |                   |           |-- DynamicService.java
     |   |                   |           `-- DynamicServiceImpl.java
     |   |                   `-- spi
     |   |                       |-- IServiceManagerService.java
     |   |                       |-- NamedCxfProperties.java
     |   |                       `-- ServiceManagerServiceImpl.java
     |   `-- resources
     |       |-- META-INF
     |       |   `-- spring
     |       |       |-- predix-microservice-cf-jsr-cxf-context.xml
     |       |       `-- predix-microservice-cf-jsr-scan-context.xml
     |       |-- application-default.properties
     |       `-- application.properties
     `-- test
         |-- java
         |   `-- com
         |       `-- ge
         |           `-- predix
         |               `-- solsvc
         |                   `-- boot
         |                       `-- HelloControllerTest.java
         `-- resources
             `-- application.properties
     
    23 directories, 21 files
    
  3. Create the repo for Spring and cd into it:

    git clone https://github.com/PredixDev/predix-microservice-cf-spring.git
    cd predix-microservice-cf-spring

    The tree of folders and files for Spring is less complex than JSR:

    |-- COPYRIGHT.md
    |-- LICENSE.md
    |-- README.md
    |-- config
    |   `-- application.properties
    |-- manifest.yml
    |-- pom.xml
    `-- src
     |-- main
     |   |-- java
     |   |   `-- com
     |   |       `-- ge
     |   |           `-- predix
     |   |               `-- solsvc
     |   |                   |-- boot
     |   |                   |   |-- Application.java
     |   |                   |   `-- PredixBootSecurityConfig.java
     |   |                   `-- service
     |   |                       `-- HelloController.java
     |   `-- resources
     |       |-- application-default.properties
     |       `-- application.properties
     `-- test
         `-- java
             `-- com
                 `-- ge
                     `-- predix
                         `-- solsvc
                             `-- boot
                                 |-- HelloControllerIT.java
                                 `-- HelloControllerTest.java
    18 directories, 13 files
    

Build using Maven

mvn clean package

The end of a long list is like this:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:27 min
[INFO] Finished at: 2016-07-08T08:55:47-06:00
[INFO] Final Memory: 30M/152M
[INFO] ------------------------------------------------------------------------
   

API Setup

https://www.youtube.com/watch?v=9SEVfK-1sCQ Predix Intelligent Environment API Quick Start Demo

More

This is one of several related topics: