Skip to content

James Ward - RIA Cowboy
Syndicate content
Heroku | Java | Scala | Cloud | Open Source | Linux
Updated: 1 hour 30 min ago

Heroku at Jfokus and Spring I/O 2012

Wed, 02/01/2012 - 13:11

In just a few weeks I’ll be over in Europe presenting about Heroku at two fantastic Java conferences. First up is Jfokus in Stockholm! On February 14 at 20:00 I will be leading a Cloud Conversations BoF. Then on February 15 at 11:10 I will be speaking about how to “git push” Java & Play! Apps to the Cloud. This will be my first time speaking at Jfokus and I’m really excited because I’ve heard such great things.

On Thursday Feb 16 I will be at Spring I/O in Madrid speaking about Running Spring Apps on the Cloud with Heroku at 12:40.

Hope to see you there!

Categories: Blogs

Try the New Play Framework Heroku Plugin

Mon, 01/30/2012 - 17:32

I just published a Heroku Plugin for Play Framework. Right now it just deploys a Play app to Heroku. Try it out:

  1. Signup for a Heroku account

  2. Install the Heroku plugin locally:
    $ play install heroku
  3. Create a Play (1.2.3 or 1.2.4) app:
    $ play new foo --with heroku
  4. Deploy the app:
    $ play heroku:deploy foo

    You should see something like:

    ~        _            _ 
    ~  _ __ | | __ _ _  _| |
    ~ | '_ \| |/ _' | || |_|
    ~ |  __/|_|\____|\__ (_)
    ~ |_|            |__/   
    ~
    ~ play! 1.2.4, http://www.playframework.org
    ~
    ~ Deploying app to Heroku
    Listening for transport dt_socket at address: 8000
    Project directory: /home/jamesw/Desktop/foo
    Read Heroku API key from /home/jamesw/.heroku/credentials
    Created new ssh key pair (heroku_rsa) in: /home/jamesw/.ssh
    Added the heroku_rsa.pub ssh public key to your Heroku account
    Created a .git directory for your project
    Added and committed all of the local changes to the git repo
    Created app: cold-night-1511
    http://cold-night-1511.herokuapp.com/
    Added git remote: git@heroku.com:cold-night-1511.git
    Deploying application via git push
    Application deployed
    ~ App Deployed

    Note: I haven’t figured out how to pipe the git push output to the screen yet, so be patient when the app is being git pushed. It’s working, just takes a minute.

  5. Check out your Play app running on the cloud! Use the URL in the “heroku:deploy” output. This should work with new and existing Play apps.

All of the code for the Heroku Play module is on GitHub. There is more I want to do with this (scaling, logs, etc) and your contributions are certainly welcome! Keep checking back here for updates and let me know how it goes!

Categories: Blogs

Java on Heroku at CinJUG, Detroit JUG, and MongoDB Boulder

Wed, 01/25/2012 - 20:46

Over the next few days I’ll be presenting about Java, Play Framework, and Scala on Heroku at a couple Java User Groups and a MongoDB conference:

Hope to see you there!

Categories: Blogs

Tutorial & Screencast: Java on Heroku with Eclipse

Tue, 01/24/2012 - 20:16

I recorded a screencast and put together some instructions on how to try out Java on Heroku using just a web browser and Eclipse. First, check out the screencast:

Here are steps you can follow to get started running Java on Heroku with Eclipse and your browser:

Prerequisites) Install the EGit and Maven (m2e) Eclipse plugins into your Eclipse. In Eclipse select the “Help” menu, select “Install new Software”, from the “Work With” drop-down menu select “All Available Sites”, and enter “EGit” in the filter box. After the plugin list has loaded (could take a minute) then select the “Eclipse EGit” plugin, select “Next”, and finish walking through the wizard to the plugin. Then do the same for the Maven Plugin “m2e”.

Step 1) Go to java.herokuapp.com and select an application template. In the screencast I used the “Simple Java Web App with Maven and Tomcat” option since it uses the familiar WAR packaging and Tomcat. Enter your email address and click the “Go!” button. This will create a copy of the template, upload it to Heroku, and assign you as the owner of the app. When the app is created you will see some instructions and a link to the application running on Heroku.

Step 2) You should have received an email from Heroku indicating that an application has been shared with you. If this is your first time using Heroku you will need to click the account setup link in the email in order to set your password on Heroku.

Step 3) If this is the first time you have used Heroku then you will need to create and associate a ssh key with your Heroku account. This will be used to authenticate you for git file transfers (to copy the application to/from Heroku). One way to create a new ssh key and associate it with your Heroku account is via key.herokuapp.com. Just enter your Heroku username / password and a new ssh key will be created, associated with your account, and then downloaded. You will then need to setup Eclipse to use that key. Go to the “Window” menu -> “Preferences” -> search for “SSH”, select “Add Private Key…”, select the private key that was just downloaded, and then select “OK”.

Step 4) Now you are ready to import the created project into Eclipse. Select the “File” menu -> “Import”, select “Project from Git”, select “Clone…”, paste the git URL into the “URI” box (you will find the git URL in the java.herokuapp.com instructions or in the email from Heroku), and select “Next”.

Eclipse will fetch the branches of the remote git repository and should display just a master branch. Select “Next” and then “Finish”. A local copy of the project will now be on your computer. Now select “Next”, select “Import as general project, select “Next”, and then select “Finish” to complete the import. From here you can take a few other steps to setup the project for local development. First, install the m2e-wtp connector, create a new Tomcat server in Eclipse, change the web module context root to “/”, and then you can just right-click on the project and select “Run As” -> “Run on Server”.

Step 5) Make a change to the app that you will be able to see when the new version is pushed to Heroku. For instance, add something to the index.jsp file. If you have setup your Eclipse for local development then you should be able to test this change locally before pushing it to Heroku.

Step 6) To commit the changes to the local git repository, right-click on the project, select “Team” -> “Commit…”, enter a commit message, and select “Commit”.

Now that the changes are in the local git repository they can be pushed to Heroku. Right-click on the project, select “Team” -> “Push to Upstream”. This will send your change to Heroku and then Heroku will run the project’s Maven build and redeploy the changes. When the process has completed you will see the details of the push and the Maven build.

Now refresh (or load) the app in your browser and you should see the changes.

That should be enough to get you started. As you dive in further check out the Heroku Dev Center for a lot more details on using Java on Heroku. Let me know if you have any questions.

Categories: Blogs

Just Released the S3Blobs Play Framework Module for Amazon S3

Mon, 01/23/2012 - 20:30

I’ve just posted the first release of the S3Blobs Play Framework Module. This module makes it easy to upload and download files from Amazon S3 from a JPA entity in a Play Framework Java application. This module is based on a POC that I did a few months ago, the JPA stuff from Tim Kral, and the modularization done by Roderik van der Veer. For more details on how to use the module check out the documentation, my tutorial (slightly out of date now), and the source code. This makes it really easy to save file uploads to an external system when running Play! apps on Heroku. Let me know if you have any questions. Thanks!

Categories: Blogs