heroku

Introduction

Heroku is an extremely popular web hosting platform that makes it as easy as a git push to deploy your code online. Light works well in Heroku with server mode enabled and is lightning fast even with Heroku's cold boots on the free tier.

Setup

This guide assumes that you have a heroku account set up and have already created a project on their website. Additionally, you need to have the Heroku CLI installed and logged in. If you have not already, follow the getting started guide to get your app up and running and initialize a git repository with git init.

Then add the following start script to your package.json so that Heroku knows how to start the production server.

{
  // ...
  "scripts": {
    "start": "light start"
  }
  // ...
}

Then just commit, add your heroku project repo, and push!

git add .
git commit -m "initial commit"
heroku git:remote -a light-example
git push heroku master

Once you have pushed your code, Heroku will automatically detect that this is a node/light project and deploy it accordingly. You can see a working example at light-example.herokuapp.com. The source code is available on GitHub.

For additional information, check out the light CLI options with light start -h and visit the Heroku documentation for environment and other configuration options.

Last updated