How to install a Node.js app using Strongloop on Heroku
with different environments like staging and production no less! new: now with multiple account administration!
Create a Node.js app as you would normally, managing your dependencies with
Your app should be set up to listen on
process.env.STRONGLOOP_PORT || [your usual local port].
Download and install the Heroku toolbelt. This install includes
➽ If you need to handle multiple accounts, install the accounts plugin.
If your app is not yet in git, create a new repository. You can do this on the command line with
Add a file called
Procfileto your project root. It should contain the following:
web: node app.js, specifying the correct file to start your app.
Add a directory called
strongloop, and create the following two files:
NODE_ENV: should contain the word
development. (Used for npm install.)
VERSION: should contain the version of strongloop you want to install, e.g.
You can use sample files from the Strongloop buildpack for Heroku and change them to your needs, if you like.
Create an account at Heroku as needed.
Log in with the toolbelt:
heroku loginor if using multiple accounts
heroku accounts:set [name].
Create (a) Heroku app(s):
heroku create [appname] [--remote name] [--region eu] --buildpack git://github.com/ramr/strongloop-buildpack.git
You can create multiple environments with different names and remotes e.g. a testing and a production app. By default Heroku will add a remote to your working copy called
herokuto push/deploy to.
To deploy your app in a EU datacenter specify the region.
➽ For all following commands you may specify the target app with the
(If you already created an app, you can use:
heroku config:set BUILDPACK_URL=git://github.com/ramr/strongloop-buildpack.git
and to add the remote to git only
git remote add heroku [your-heroku-git-url]or to update the heroku remote (
-asets it locally)
heroku git:remote -r name [-a name].)
If you need to set
NODE_ENV(e.g. so that Express doesn't run in development mode) use
heroku config:set NODE_ENV=production.
Deploy your app with
git push heroku master(use the correct remote), after committing everything. Heroku will install all dependencies, including Strongloop. To deploy from a different branch use a command like this:
git push heroku develop:masterUse the correct remote name and branch names.
Assign a dyno to your app:
heroku ps:scale web=1.
Your app should now run. Visit it with a browser at the URI returned by the
heroku createcommand. You can troubleshoot using
- Download tarball from Strongloop.