I have done this many times, and it can be fairly straightforward. The most complicated bit is setting up the database. For Heroku, you can't use filesystem storage (e.g. storing everything in a db.json file) because the filesystem is not persistent. So you need an external database, and luckily Heroku offers a few of these as addons, e.g. mLab for MongoDB which I highly recommend.
Once you've provisioned the database, make sure the correct details are configured for the datasource. Here is an example from a Heroku-hosted app using mLab (I've xxxx-ed out a few details):
"db": {
"host": "ds043471-a0.mongolab.com",
"port": 43471,
"database": "heroku_appxxxxxxx",
"username": "heroku_appxxxxxxx",
"password": "xxxxxxxxxx",
"name": "KaranMongo_live",
"connector": "mongodb"
}
You can even test this locally now (though best practice is to use separate datasource json files for development/production).
Next, you need to make a few adjustments to make your application "Heroku-ready":
- Add the Strongloop buildpack, i.e.
heroku buildpacks:set https://github.com/strongloop/strongloop-buildpacks.git
- Create a Procfile, which only needs one line:
web: slc run
Then push to your heroku app (assuming you've set up the remote correctly):
git push heroku master
Magic. It builds and deploys.