Skip to content

Instantly share code, notes, and snippets.

@MarcDiethelm
Last active July 17, 2019 05:59
Show Gist options
  • Save MarcDiethelm/6321844 to your computer and use it in GitHub Desktop.
Save MarcDiethelm/6321844 to your computer and use it in GitHub Desktop.
How to install a Node.js app using Strongloop on Heroku

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. ...
@evert0n
Copy link

evert0n commented Oct 2, 2014

The build pack now is https://github.com/strongloop/strongloop-buildpacks.git checkout http://docs.strongloop.com/display/SL/Heroku

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment