diff --git a/CHANGELOG.md b/CHANGELOG.md index 35098918..1b2cd92b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file. - Add Signal integration (#428) - Change Zulip onboarding, ask for the zuliprc file (#202) - Add a section in Docs about running self-hosted instances +- Add experimental Dockerfile and docker-compose.yml ## Bug Fixes - Fix unwanted HTML escaping in SMS and WhatsApp notifications diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 00000000..bbc41856 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,22 @@ +FROM python:3.8 + +RUN useradd --system hc +ENV PYTHONUNBUFFERED=1 +WORKDIR /opt/healthchecks + +COPY requirements.txt /tmp +RUN \ + pip install --no-cache-dir -r /tmp/requirements.txt && \ + pip install uwsgi + +COPY . /opt/healthchecks/ + +RUN \ + rm -f /opt/healthchecks/hc/local_settings.py && \ + DEBUG=False SECRET_KEY=build-key ./manage.py collectstatic --noinput && \ + DEBUG=False SECRET_KEY=build-key ./manage.py compress + +USER hc + +CMD [ "uwsgi", "/opt/healthchecks/docker/uwsgi.ini"] + diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 00000000..1a5751cd --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,34 @@ +version: "3" +volumes: + db-data: + +services: + db: + image: postgres:12 + volumes: + - db-data:/var/lib/postgresql + environment: + - POSTGRES_DB=hc + - POSTGRES_PASSWORD=fixme-postgres-password + web: + build: + context: .. + dockerfile: docker/Dockerfile + environment: + - DEBUG=False + - DB=postgres + - DB_HOST=db + - DB_PORT=5432 + - DB_PASSWORD=fixme-postgres-password + - DEFAULT_FROM_EMAIL=healthchecks.io@healthchecks.io + - EMAIL_HOST=fixme-smtp-server.example.org + - EMAIL_HOST_USER=fixme-smtp-username + - EMAIL_HOST_PASSWORD=fixme-smtp-password + - SECRET_KEY=fixme-secret-key + - SITE_ROOT=http://localhost:8000 + ports: + - 8000:8000 + depends_on: + - db + command: bash -c 'while !Configuring Prometheus -
Healthchecks.io supports exporting metrics and check statuses to +
SITE_NAME supports exporting metrics and check statuses to Prometheus, for use with Grafana.
You can generate the metrics export endpoint by going to your project settings and clicking "Create API Keys." You will then see the link to diff --git a/templates/docs/configuring_prometheus.md b/templates/docs/configuring_prometheus.md index cecfa518..b4d3c7ab 100644 --- a/templates/docs/configuring_prometheus.md +++ b/templates/docs/configuring_prometheus.md @@ -1,6 +1,6 @@ # Configuring Prometheus -Healthchecks.io supports exporting metrics and check statuses to +SITE_NAME supports exporting metrics and check statuses to [Prometheus](https://prometheus.io/), for use with [Grafana](https://grafana.com/). You can generate the metrics export endpoint by going to your project settings diff --git a/templates/docs/self_hosted_docker.html b/templates/docs/self_hosted_docker.html new file mode 100644 index 00000000..8d23e12a --- /dev/null +++ b/templates/docs/self_hosted_docker.html @@ -0,0 +1,34 @@ +
In the Healthchecks source code, /docker/ directory, +you can find a sample configuration for running the project with +Docker and Docker Compose.
+Note: The Docker configuration is a recent addition, and, for the time being, +should be considered highly experimental.
+Note: For the sake of simplicity, the sample configuration starts a single database +node and a single web server node, both on the same host. It also does not handle SSL +termination. If you plan to expose it to the public internet, make sure you put a +SSL-terminating load balancer or reverse proxy in front of it.
+/docker/docker-compose.yml
file; add your SMTP credentials
+ and any other needed environment variables.Create and start containers:
+$ cd docker
+$ docker-compose up
+
Create a superuser:
+$ docker-compose run web /opt/healthchecks/manage.py createsuperuser
+
Open http://localhost:8000 in your browser and log in with + the credentials from the previous step.
+