2012年4月16日 星期一

[筆記] Deploy Mojito app to Heroku

First, you need to follow this doc (http://developer.yahoo.com/cocktails/mojito/docs/quickstart/) to install Mojito as a global node module. Why install it globally? Because you need the Mojito command line to create your first app.

Create application with command line:

mojito create app mymojito

Change working directory to "mymojito".

Create a "Procfile" whose content is:

web: mojito start $PORT

Use the following command to create an application on heroku and deploy codes to it.

  • git init
  • git add .
  • git commit -am init
  • heroku create mymojitotest --stack cedar
  • git push heroku master

After successfully commit codes to heroku, you could check running process with "heroku ps". However, you cannot find any running process. That is because there is one important step missed:

heroku ps:scale web=1

This command adds one dyno for web process. After that, you will find one web process when you check with "heroku ps". And the server is now started up. You can check your app with browser.