Running Play Framework + Scala Apps on Heroku

Building Play Framework apps with Scala is all the rage right now. And for good reason… It’s never been easier to build and deploy JVM-based web apps! Lets walk through how to build a Play app with Scala and then deploy it on the cloud with Heroku.

Step 1) Install the Play Framework (make sure you have at least version 1.2.3)

Step 2) Install the Play Scala module:

play install scala

Step 3) Create a new Play app with Scala support:

Learning Scala: Function Literals

I’ve gradually been learning Scala over the past few months and I really have been enjoying it. For me Scala is like Shakespeare. It seems familiar and totally foreign at the same time. I don’t enjoy Shakespeare plays nearly as much as someone who has taken the time to learn the language of Shakespeare. Some have interpreted Scala being “familiar yet totally foreign” as Scala being “hard” but I’d say it’s just different. With Scala there is probably more about programming that I need to unlearn than to learn. My perspectives on programming languages have been shaped by the ones I’ve used most (Java, ActionScript, etc). And now my perspecives are being reshaped. It might take some time and work but I believe that using Scala will soon be very enjoyable for me.

Heroku Java User Group Tour Part 1: Los Angeles and Salt Lake City

This week I’m starting a Java User Group tour where I’ll be travelling to JUGs around the US (or maybe world). On the tour I’ll be giving a talk about Running Java, Play! and Scala Apps on the Cloud. Here is the description:

Heroku is a Polyglot Cloud Application Platform that makes it easy to deploy Java, Play! and Scala apps on the cloud. Deployment is as simple as doing a “git push”. This session will teach you how to instantly deploy and scale Java, Play! and Scala apps on Heroku.

Heroku is Hiring

It’s been four months since I started working at Heroku as a Developer Evangelist. Now it is clear to me that I got really lucky. Heroku is a top-notch place to work. The product is sexy. The people are all rock stars. Heroku is owned by Salesforce.com so there is the stability of a large company but the start-up culture remains in place.

Heroku is looking to hire lots of people (engineers, marketing, etc) but of particular interest to my readers might be the Java Developer Evangelist position. Come work with me to help educate Java developers about Heroku!

Getting Started with Scala on Heroku

Over the past year I’ve been gradually learning Scala and I think it’s fantastic! So I’m incredibly excited that Scala now runs on Heroku! Of course you can use the standard Java on Heroku / Maven method of running Scala on Heroku. But as of today you can also use sbt (the Scala Build Tool) to run Scala apps on Heroku. If you are new to Heroku, it is a Polyglot Cloud Application Platform. Put very simply:

Java Concurrency with Akka: Composing Futures

I’ve been intrigued by Akka for a while but finally I was able to take it for a spin. The first thing I wanted to learn was how to compose Futures. Composing Futures provides a way to do two (or more) things at the same time and then wait until they are done. Typically in Java this would be done with a <del datetime="2011-09-23T22:23:58+00:00">CyclicBarrier</del> ExecutorService. But setting up the code to manage a CyclicBarrier is challenging. (UPDATE: Turns out it’s not very challenging, I just didn’t know how to do it. I’m new to concurrency in Java and didn’t find much on this stuff - probably because I didn’t even know what to search for.) So I put together a quick little demo that shows how to do the same thing with Futures in Akka.

Flex AOP and Puzzlers at Flash Camp Italy

Next week I’ll be speaking at the Flex Camp in Rimini, Italy. On September 23, Mike Labriola and I will be doing two sessions. First is “Planet of the AOPs” where we will show how Aspect Oriented Programming can be implemented in Flex using runtime bytecode modification. Mike and I will also be doing a little “Flex Puzzlers” session where you will discover some very peculiar things about Flex and Flash Player. It’s going to be a blast and I hope to see you there! Also, there will be a raffle for a copy of Creative Suite 5.5 and a Playbook. So go sign up NOW!

Sending Play Framework File Uploads to Amazon S3

UPDATE: I’ve released a S3 Play Module based on this project.

A couple of questions [1, 2] on StackOverflow.com led me to look into how we can send file uploads in a Play Framework application to Amazon S3 instead of the local disk. For applications running on Heroku this is especially important because the local disk is not persistent. Persistent disk storage makes it hard to scale apps. Instead of using the file system, it’s better to use an external service which is independent of the web tier.