public
Last active

How to install a Node.js app using Strongloop on Heroku

  • Download Gist
strongloop-heroku.md
Markdown

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!

  1. Create a Node.js app as you would normally, managing your dependencies with npm in package.json.
  2. Your app should be set up to listen on process.env.STRONGLOOP_PORT || [your usual local port].
  3. Download and install the Heroku toolbelt. This install includes git.

    ➽ If you need to handle multiple accounts, install the accounts plugin.

  4. If your app is not yet in git, create a new repository. You can do this on the command line with git init.
  5. 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.
  6. Add a directory called strongloop, and create the following two files:

    • NODE_ENV: should contain the word production or development. (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.

  7. Create an account at Heroku as needed.
  8. Log in with the toolbelt: heroku login or if using multiple accounts heroku accounts:set [name].
  9. 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].)

  10. 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.
  11. 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.
  12. Assign a dyno to your app: heroku ps:scale web=1.
  13. Your app should now run. Visit it with a browser at the URI returned by the heroku createcommand. You can troubleshoot using heroku logs.

Sources:

Local setup

  1. Download tarball from Strongloop.
  2. ...

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.