monit-buildpack

by formsort

GitHub Readme.md

Heroku Buildpack: Monit

Run Monit on Heroku.

Usage:

Create a new directory and git repository:

mkdir heroku-monit
cd heroku-monit
git init .

Initialise the Heroku app:

heroku create --buildpack=https://github.com/matiaskorhonen/monit-buildpack.git

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/.monit.id.
set idfile /app/tmp/.monit.id
set pidfile /app/tmp/.monit.pid
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/pre-web.sh script, which will run bin/pre-web-monit.sh 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/pre-web.sh file looks like:

#!/usr/bin/env bash

if [ -f "bin/pre-web-monit.sh" ]; then
    echo "pre-web.sh: pre-web-monit.sh starting"
    bash bin/pre-web-monit.sh
    echo "pre-web.sh: pre-web-monit.sh done"
else
    echo "pre-web.sh: noop"
fi

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.

License

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

See the LICENSE file for more details.

Dependencies

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