Simple to use Docker image for https://github.com/healthchecks/healthchecks.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
includes fix: run as non-root user Dec 12, 2018
CODE_OF_CONDUCT.md Added CODE_OF_CONDUCT.md Aug 24, 2017
Dockerfile fix: run as non-root user Dec 12, 2018
LICENSE Initial commit Oct 6, 2016
README.md Fix #14 - Add HTTPS Proxy note to README.md Mar 11, 2018
entrypoint.sh fix: run as non-root user Dec 12, 2018

README.md

docker-healthchecks

Docker Repository on Quay.io

Image available from:

Simple to use Docker image for github.com/healthchecks/healthchecks.

Running the image

If you want to add a variable as a setting you have to prefix it with HC_. By default Healthchecks uses a SQLite database, located at /healthchecks/hc.sqlite.

docker run \
    -d \
    --name=healthchecks \
    -p 80:8000 \
    -e 'HC_HOST=0.0.0.0' \
    -e 'HC_SECRET_KEY=YOUR_SECRET_KEY' \
    -e 'HC_PING_EMAIL_DOMAIN=example.com' \
    -e 'HC_SITE_ROOT=http://example.com' \
    -e 'HC_EMAIL_HOST=smtp.example.com' \
    -e 'HC_EMAIL_PORT=25' \
    -e 'HC_EMAIL_USE_TLS=True' \
    -e 'HC_EMAIL_HOST_USER=user@example.com' \
    -e 'HC_EMAIL_HOST_PASSWORD=YOUR_PASSWORD' \
    -e 'HC_ALLOWED_HOSTS=["*"]' \
    galexrt/healthchecks:latest

The port of Healthchecks is 8000/tcp.

A HTTPS Proxy is required for healthchecks to be reachable. This is caused by the CSRF verification failing if HTTPS is not used. The HTTPS Proxy must pass through/create X-FORWARDED-* headers. An example for a simple HTTPS proxy for Docker can be found here: GitHub - jwilder/nginx-proxy.

Database configuration

When you don't want to use SQLite. The following environment variables can be used to configure the database connection:

DB_TYPE # Can be postgresql, mysql (defaults to sqlite3)
DB_HOST # the database host address
DB_PORT # the database host port
DB_NAME # the database name
DB_USER # the database user
DB_PASSWORD # the database user password

Email configuration

The following environment variables can be used to configure the smtp/mail sending:

HC_EMAIL_HOST # the smtp host address
HC_EMAIL_PORT # the smtp host port
HC_EMAIL_USE_TLS # if tls should be used for smtp
HC_EMAIL_USE_SSL # if ssl should be used for smtp
HC_EMAIL_HOST_USER # the smtp user
HC_EMAIL_HOST_PASSWORD # the smtp user password

Special configuration variables

The following environment variables can be used to configure some "special" values for Healthchecks:

HC_HOST # the listen address
HC_ALLOWED_HOSTS # the allowed hosts (value for dynamic container environment is `["*"]`)
HC_SECRET_KEY # set to a random secret value (if changed sessions are invalidated)

Other configuration variables

Checkout the healthchecks/healthchecks settings.py, if you want to set one of these variable as a setting you have to prefix it with HC_. Example for variable SLACK_CLIENT_ID would be environment variable HC_SLACK_CLIENT_ID for the container.

Run manage.py inside the container

You need the container name or id of the healthchecks instance. You can get it by running docker ps and searching for the container running healthchecks.

docker exec -it CONTAINER_NAME /entrypoint.sh app:managepy YOUR_MANAGE_PY_FLAGS_COMMAND

Activating Telegram Bot

Use the command from the last section and for YOUR_MANAGE_PY_FLAGS_COMMAND use this:

settelegramwebhook

For this to work, you need to have set the following variables:

  • SITE_NAME
  • TELEGRAM_TOKEN

Create Healthchecks superuser

You need the container name or id of the healthchecks instance. You can get it by running docker ps and searching for the container running healthchecks.

docker exec -it CONTAINER_NAME healthchecks_create_superuser.sh

Follow the assistant that will show up to create a healthchecks superuser.