Play!framework on Heroku を試す。

環境はMacOS Lion。

Play!をダウンロード。(1.2.5.zip)

http://playdocja.appspot.com/download

パスを通す。

$ vim ~/.bash_profile
PATH=$PATH:/Users/xxxxx/play-1.2.5
$ source ~/.bash_profile
パスが通ってるの確認
$ play
~        _            _ 
~  _ __ | | __ _ _  _| |
~ | '_ \| |/ _' | || |_|
~ |  __/|_|\____|\__ (_)
~ |_|            |__/   
~
~ play! 1.2.5, http://www.playframework.org
~
~ Usage: play cmd [app_path] [--options]
~ 
~ with,  new      Create a new application
~        run      Run the application in the current shell
~        help     Show play help
~

herokuの記事通りに進める

https://devcenter.heroku.com/articles/play

herokuの設定とサンプルアプリケーションの作成

今はまだ使わないけど共有DBも追加しておく

$ heroku login

$ heroku rename xxxxx

$ heroku addons:add shared-database

$ play new helloworld

dependencies.ymlの内容を書き換え

$ vim helloworld/conf/dependencies.yml
# Application dependencies

require:
    - play 1.2.5
Procfileの作成
$ touch Procfile
$ vim Procfile
web:    play run --http.port=$PORT $PLAY_OPTS
Gitへのコミット
$ git init
$ touch .gitignore
$ vim .gitignore
bin/
data/
db/
dist/
logs/
test-result/
lib/
tmp/
modules/
$ git add .
$ git commit -m "first commit"
herokuにデプロイ
$ heroku create
$ git push heroku master
[...略...]
Are you sure you want to continue connecting (yes/no)? yes
[...略...]
-----> Launching... done, v4
       http://xxxxx.herokuapp.com deployed to Heroku

デプロイされていることを確認

http://xxxxx.herokuapp.com

Your application is ready!


やったー!