Deploying to Heroku

One of the easiest ways to run Bolt online is to deploy to a cloud service like Heroku.

The steps are follow here are similar to those listed in Setting Up Bolt.

Bolt also relies on MongoDB, so ensure you have MonogoDB up and running. Since this is an online deployment, you will be using one of the numerous MongoDB cloud service providers, like mlab. After you successfully provision a MongoDB database instance and create a user with read-write access to the database, you should be given a connection string, usually following format: mongodb://<user>:<password>@ds056789.mlab.com:56789/bolt.

In the end Bolt is just a Node.js app, and you deploy it to Heroku like you deploy any other Node app. See this article for help.

Next you set up environment variables. I have deployed a Bolt instance to Heroku under the name guarded-journey-25495. The app is now available at https://guarded-journey-25495.herokuapp.com.

Navigate to your Heroku dashboard and click on the app.

Click on Settings, then Reveal Config Vars to view and create environment variables.

You can see that I have created the necessary environment variables. Notice the variable MONGODB_URI which points to an online MongoDB instance being hosted by mlab.

On the terminal/console, execute the following commands to deploy on Heroku:

  • heroku config:set NODE_MODULES_CACHE=false : This command is optional. Execute it if you want Heroku to recreate the node_modules folder instead of using a cached version. Note that this may not be what you want, especially when syncing local deployment with Heroku deployment.
  • heroku features:enable http-session-affinity : This command is necessary because Bolt makes use of the socket.io module.
  • git commit -am '' : Commit your changes. You can add the --allow-empty option to this command to make an empty commit.
  • git push heroku master : Push to Heroku.
  • heroku config:unset NODE_MODULES_CACHE : This command is optional. Execute it if you want to unset (reset?) the configuration variable NODE_MODULES_CACHE which you may have set to false a few lines above.

results matching ""

    No results matching ""