by formsort


Heroku Buildpack: Monit

Run Monit on Heroku.


Create a new directory and git repository:

mkdir heroku-monit
cd heroku-monit
git init .

Initialise the Heroku app:

heroku create --buildpack=

Then create a monitrc file (see below) and push to Heroku.

Your repository structure should look like this (the conf.d directory is optional):

├── conf.d
│   └── example
└── monitrc

monitrc must exist and at the very minimum it should have this content:

## Start Monit in the background (run as a daemon):
set daemon  60              # check services at 1-minute intervals

## Set the location of the Monit id file which stores the unique id for the
## Monit instance. The id is generated and stored on first Monit start. By
## default the file is placed in $HOME/
set idfile /app/tmp/
set pidfile /app/tmp/
set logfile /app/tmp/.monit.log
set statefile /app/tmp/.monit.state

## Monit has an embedded web server which can be used to view status of
## services monitored and manage services from a web interface.
set httpd port 2812
    allow localhost

## It is possible to include additional configuration parts from other files or
## directories.
# include /app/conf.d/*

Your Procfile should run script/ script, which will run bin/ if it exists, that is generated by the buildpack. Should you not use the buildpack, check in a noop script. If you use the buildpack it will overwrite scripts at that location.

A typical script/ file looks like:

#!/usr/bin/env bash

if [ -f "bin/" ]; then
    echo " starting"
    bash bin/
    echo " done"
    echo " noop"

The SYSTEM_NAME variable defaults to "web", but you can override it if you wish:

heroku config:add SYSTEM_NAME=fs-flow-web

For more information on how to configure Monit, see the Monit manual.


MIT License. Copyright 2012-2014 Matias Korhonen & contributors.

See the LICENSE file for more details.


Monit is downloaded as source code and built on Heroku and is licensed independently under the GNU Affero General Public License.

GNU gettext is downloaded as a binary and is licensed independently under the GNU General Public License