Try the New Play Framework Heroku Plugin

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

    Or if you already have an existing Play app, add the follow line to the conf/dependencies.yml file and then run “play deps –sync”:

        - play -> heroku 0.2
  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!

  • http://www.facebook.com/profile.php?id=790800257 Francis Potter

    How does this differ from just pushing the app straight to Heroku as per http://devcenter.heroku.com/articles/play ?

    • http://www.jamesward.com James Ward

      Same thing under the covers.  It just does all that stuff for you.

  • http://www.facebook.com/da2nana David Osei

    Thanks

  • Richard

    Thanks James. this works beautifully.

  • Jonathan Lannoy

    Hello.

    I cannot manage to deploy on heroku with your module… Everythings got fine, as explained in your blog post; but the application is not started on Heroku. When I look at an “heroku ps”, there is one process (web.1) but with an empty command… Shouldn’t it be filled with the start command I would have put in my Procfile?

    Thanks in advance!

    • http://www.jamesward.com James Ward

      Odd.  Do you have a Procfile?  If so, it should contain the following for Play 1.2.x:
      web: play run –http.port=$PORT $PLAY_OPTS

      • Jonathan Lannoy

        I could not find one… (Maybe this is the problem…) I tried to create it myself (with this line), but it didn’t work. It should be on the root of my application, right? At the same level of app, conf, public… 

        I immediately tried with your module, I read how to do it manually but didn’t try it. I’ll try asap too.

        • http://www.jamesward.com James Ward

          Make sure the Procfile has a capital “P” and is in the root project dir.  I’m getting an error now when I try to use the heroku:deploy command.  So something might be wrong with my library.  I’ll look into this.

  • Hakan

    Hello,

    My application URL shows:
    Your application is ready!
    not my application…

    Am I missing something?

    • http://www.jamesward.com James Ward

      Looks like the app didn’t push. Did you get any errors when you pushed it?

      • Hakan

        test

        • Hakan

          No, here is the output:

          ./play heroku:deploy Octopus
          ory: /Users/Hako/Desktop/Graph/play-1.2.5/Octopus
          Using ssh key from: /Users/Hako/.ssh/heroku_rsa.pub
          Added and committed all of the local changes to the git repo
          Heroku application appears to exist already with a git url of: git@heroku.com:frozen-forest-1331.git
          Deploying application via git push
          Application deployed
          App Deployed

          By the way, my app uses port 8000, may it be the case? Thanks.

          • http://www.jamesward.com James Ward

            Hmm… Looks like it all should have worked. Maybe the app didn’t build. You can check via the heroku command: heroku logs

          • Hakan

            Yes, I guess that’s the problem:

            2013-01-26T17:19:21+00:00 heroku[slugc]: Slug compilation started
            2013-01-26T17:19:29+00:00 heroku[slugc]: Slug compilation failed: failed to compile Play! app

            Thank you.

          • http://www.jamesward.com James Ward

            Make sure your Play app compiles locally by running “play precompile”.