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
npm
inpackage.json
. -
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
git
.➽ 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
git init
. -
Add a file called
Procfile
to 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 wordproduction
ordevelopment
. (Used for npm install.)VERSION
: should contain the version of strongloop you want to install, e.g.1.1.0-1
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 login
or if using multiple accountsheroku 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
heroku
to 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
--app name
option.(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 (-a
sets 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) useheroku 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:master
Use 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 create
command. You can troubleshoot usingheroku logs
.
- https://devcenter.heroku.com/articles/nodejs
- https://github.com/ramr/strongloop-buildpack
- https://devcenter.heroku.com/articles/multiple-environments
- https://devcenter.heroku.com/articles/regions
- http://railsware.com/blog/2013/02/05/how-to-set-up-the-heroku-tools-for-deployment-with-multiple-accounts/
- Download tarball from Strongloop.
- ...
The build pack now is
https://github.com/strongloop/strongloop-buildpacks.git
checkout http://docs.strongloop.com/display/SL/Heroku