Jumpstart Lab Curriculum

Salesforce Elevate

Systems Setup

To get the most out of the workshop you should be working along with us. Before we get going, please go through the following setup steps.

Accounts

Heroku Account

You’ll of course need a Heroku account. If you don’t have one already, head over to Heroku and create one.

Setup a Credit Card

For our exercises we’ll be adding capabilities that go beyond the free plan. Your account must have a credit card registered to be able to add these paid features.

However, we’ll give you a code during the class that will credit your account for more than we spend.

Salesforce Developer Account

You probably have a Salesforce developer account already, but if not create one now here.

Heroku Toolbelt

Install the Heroku Toolbelt following the instructions here.

Git

We’ll need Git to handle source control and facilitate pushing code to Heroku. You can find installer packages for any platform here or:

SSH Keys

To interact with Heroku you’ll need SSH keys. If you already use Git or GitHub regularly you probably already have them setup.

For MacOS

On MacOS you can check for your public key like this:

Terminal

$
cat ~/.ssh/id_rsa.pub

If you see a bunch of output, then you have a key and are ready to move on. If nothing shows up, generate a key:

Terminal

$
ssh-keygen -t rsa

You can choose to secure your key with a password. If you choose to do so, that password will be needed any time your key is used.

For Windows

On Windows you’d look for a file C:\Users\<YourUsername>\.ssh\id_rsa.pub

If it does not exist the toolbelt will create one for you.

In case you see this error, get the location of your git folder and add it to you system path.

Terminal

 
 
Could not generate key: "ssh-keygen" is not recognized as a internal or externalcommand operable program or batch file.

You can learn how to add an additional path to your system here.

Java

You’ll need the JDK installed. For this tutorial we’re using JDK 7 available here.

Play

On top of Java, our sample app uses the Play Framework, a great way to build modern web applications in Java or Scala.

Download the binary archive version of Play 2.0 here.

We need this executable to be in your path. On a UNIX platform, like Linux or MacOS, you can get it going by:

  • Creating a directory /usr/local/play
  • Extracting/moving the Play archive into /usr/local/play/play-2.0
  • Creating an alias to the play binary with ln -s /usr/local/play/play-2.0/play /usr/local/bin
  • Verifying the install by running play help

Having downloaded the binary archive to my ~/Downloads folder, here’s the process for MacOS:

Terminal

$
$
 
 
 
 
 
 
 
$
$
 
$
 
 
 
 
 
 
 
 
 
mkdir -p /usr/local/playtar -zxvf ~/Downloads/play-2.0.zip -C /usr/local/playx play-2.0/x play-2.0/documentation/x play-2.0/documentation/api/...x play-2.0/repository/local/jaxen/jaxen/1.1.3/jars/jaxen.jar.sha1x play-2.0/repository/local/jaxen/jaxen/1.1.3/jars/jaxen.jar.md5x play-2.0/repository/local/jaxen/jaxen/1.1.3/jars/jaxen.jarln -s /usr/local/play/play-2.0/play /usr/local/binwhich play/usr/local/bin/playplay help_            __ __ | | __ _ _  _| || '_ \| |/ _' | || |_||  __/|_|\____|\__ (_)|_|            |__/play! 2.0, http://www.playframework.org...

Sample Application

We’ll be working with a Java application using the Play framework. We’re assuming that you’ve never used Play before – that’s ok!

In your terminal, move to a folder where you want to store the project. Then clone the project from GitHub:

Terminal

$
$
git clone https://github.com/JumpstartLab/play_samplecd play_sample

Verify Functionality

Play applications are very easy to get running locally if Java and Play are in the right places. Try this:

Terminal

$
 
 
 
 
 
 

 
                       
playplayGetting org.scala-tools.sbt sbt_2.9.1 0.11.2 ...:: retrieving :: org.scala-tools.sbt#boot-appconfs: [default]37 artifacts copied, 0 already retrieved (7324kB/183ms)[info] Loading project definition from /Users/jcasimir/Dropbox/Projects/play_demo_1/project[info] Set current project to computer-database-jpa (in build file:/Users/jcasimir/Dropbox/Projects/play_demo_1/)_            __ __ | | __ _ _  _| || '_ \| |/ _' | || |_||  __/|_|\____|\__ (_)|_|            |__/play! 2.0, http://www.playframework.org> Type "help play" or "license" for more information.> Type "exit" or use Ctrl+D to leave this console.[computer-database-jpa] $

Then you have a console running with the application loaded up. Type run and hit enter. It’ll prepare more dependencies then output this:

Terminal

 
 
 
 
 
--- (Running the application from SBT, auto-reloading is enabled) ---[info] play - Listening for HTTP on port 9000...(Server started, use Ctrl+D to stop and go back to the console...)

In the Browser

Now the application should be running locally. Open your web browser and visit localhost

Running Evolutions

Play applications use "Evolutions" to change the state of the database. You should see a big error page complaining that there are Evolutions which need to be run. Click the Apply this script now! button to run them.

Working Application

Now you should see the application, which lists 574 historical computers. You’re ready to go!

Running in the Cloud

Maybe you have a machine where you’re not able to install Heroku Toolbelt or have some other kind of systems-level problem/restriction. You can, instead, use a development environment in the browser.

Let’s try Cloud9 IDE.

Account Setup

Setting Up a Workspace

Once you’re into the "dashboard" interface…

  • Click "Create New Workspace" in the top left
  • Select "Create a New Workspace"
  • In the top "Name your workspace" box, enter "elevate"
  • Leave the selection as "Custom"
  • Click the "Create" button

As you return to the dashboard you’ll see your workspace spinning up on the left side. It should take less than a minute to get ready.

  • Click your "elevate" project on the left sidebar
  • Click the "Start Editing" button

Setting Up the Project

In the bottom "Terminal" window, do each of the following:

Clone the Project

Clone the sample project with this instruction:

Terminal

$
$
git clone https://github.com/JumpstartLab/play_sample.gitcd play_sample

Install Heroku Toolbelt

Cloud9 has its own package manager that can install the Heroku Toolbelt for you:

Terminal

$
c9pm install heroku

Doing Work

Cloud9 doesn’t have the Play framework easily available for installation, but you’ll still be able to deploy to Heroku and experiment with the code.

<< BACK
Feedback

Have Feedback?

Did you find an error? Something confusing? We'd love your help:

Thanks!