nodejitsuでflatiron (インストール~デプロイ)

nodejitsu.comから直リンされてるクレームワークflatironをインストール。

$ npm install flatiron -g

で、アプリのスケルトン生成。

$ flatiron create unkoman http
info:    Creating application unkoman
info:    Using http scaffold.
prompt: author:  o_6.
prompt: description:  An http service for testing
prompt: homepage:  http://sixdot.hatenablog.com/
info:    Creating directory config
info:    Creating directory lib
info:    Creating directory test
info:    Writing package.json
info:    Writing file app.js
info:    Writing file config/config.json
info:    Application unkoman is now ready

プロンプトの内容はpackage.jsonに反映される。

flatiron create <app_name> <type>

ちなみにcreateコマンドのtypeには「http」「cli」が用意されていて、デフォルトが「http」。 flatiron/scaffoldsに元ネタが入ってる模様。

そのままjitsu deployしてみる。
package.jsonの足りない属性(nodejitsuに必要な属性)は、ちゃんとプロンプトで聞いてくれる。
サブドメインとnodeのバージョンを聞かれた。

$ cd unkoman
$ jitsu deploy
info:    Welcome to Nodejitsu 僕のかっこいいIDネーム
info:    It worked if it ends with Nodejitsu ok
info:    Executing command deploy
warn:    
warn:    Your package.json file is missing required fields:
warn:    
warn:      subdomain,   engines
warn:    
warn:    Prompting user for required fields.
warn:    Press ^C at any time to quit.
warn:    
prompt: subdomain: (IDネーム.unkoman) unkoman
prompt: engines.node: (0.6.x) 0.8.x
...
prompt: Is this ok?: (yes) y
...
info:    Starting app unkoman
info:    App unkoman is now started
info:    http://unkoman.jit.su on Port 80
info:    Nodejitsu ok

さらに虎の子のドメインをpackage.jsonに追加。

"domains" : [ "unkoman.org" ]

更新!

$ jitsu apps update

結果→ http://unkoman.org/