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:
- On Linux, use apt:
sudo apt-get install git-core
- On MacOS use Homebrew if it’s installed:
brew install git
. - On Windows, download the installer
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
$
|
|
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
$
|
|
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
|
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 withln -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
$ $ $ $ $ |
|
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
$ $ |
|
Verify Functionality
Play applications are very easy to get running locally if Java and Play are in the right places. Try this:
Terminal
$ |
|
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
|
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
- Visit https://c9.io/site/pricing/
- Click "Sign Up For Free" and create an account
- Login
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
$ $ |
|
Install Heroku Toolbelt
Cloud9 has its own package manager that can install the Heroku Toolbelt for you:
Terminal
$
|
|
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