@ -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"] | |||
@ -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 | |||
- [email protected] | |||
- 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 !</dev/tcp/db/5432; do sleep 1; done; uwsgi /opt/healthchecks/docker/uwsgi.ini' | |||
@ -0,0 +1,18 @@ | |||
[uwsgi] | |||
master | |||
die-on-term | |||
http-socket = :8000 | |||
harakiri = 10 | |||
post-buffering = 4096 | |||
processes = 4 | |||
enable-threads | |||
threads = 1 | |||
chdir = /opt/healthchecks | |||
module = hc.wsgi:application | |||
thunder-lock | |||
disable-write-exception | |||
static-map = /static=/opt/healthchecks/static-collected | |||
hook-pre-app = exec:./manage.py migrate | |||
attach-daemon = ./manage.py sendalerts | |||
attach-daemon = ./manage.py sendreports --loop |
@ -0,0 +1,34 @@ | |||
<h1>Running with Docker</h1> | |||
<p>In the Healthchecks source code, <a href="https://github.com/healthchecks/healthchecks/tree/master/docker">/docker/ directory</a>, | |||
you can find a sample configuration for running the project with | |||
<a href="https://www.docker.com">Docker</a> and <a href="https://docs.docker.com/compose/">Docker Compose</a>.</p> | |||
<p><strong>Note: The Docker configuration is a recent addition, and, for the time being, | |||
should be considered highly experimental</strong>.</p> | |||
<p>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.</p> | |||
<h2>Getting Started</h2> | |||
<ul> | |||
<li>Grab the Healthchecks source code | |||
<a href="https://github.com/healthchecks/healthchecks">from the Github repository</a>.</li> | |||
<li>Edit the <code>/docker/docker-compose.yml</code> file; add your SMTP credentials | |||
and any other needed <a href="../self_hosted_configuration/">environment variables</a>.</li> | |||
<li> | |||
<p>Create and start containers:</p> | |||
<div class="highlight"><pre><span></span><code>$ <span class="nb">cd</span> docker | |||
$ docker-compose up | |||
</code></pre></div> | |||
</li> | |||
<li> | |||
<p>Create a superuser:</p> | |||
<div class="highlight"><pre><span></span><code>$ docker-compose run web /opt/healthchecks/manage.py createsuperuser | |||
</code></pre></div> | |||
</li> | |||
<li> | |||
<p>Open <a href="http://localhost:8000">http://localhost:8000</a> in your browser and log in with | |||
the credentials from the previous step.</p> | |||
</li> | |||
</ul> |
@ -0,0 +1,31 @@ | |||
# Running with Docker | |||
In the Healthchecks source code, [/docker/ directory](https://github.com/healthchecks/healthchecks/tree/master/docker), | |||
you can find a sample configuration for running the project with | |||
[Docker](https://www.docker.com) and [Docker Compose](https://docs.docker.com/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. | |||
## Getting Started | |||
* Grab the Healthchecks source code | |||
[from the Github repository](https://github.com/healthchecks/healthchecks). | |||
* Edit the `/docker/docker-compose.yml` file; add your SMTP credentials | |||
and any other needed [environment variables](../self_hosted_configuration/). | |||
* 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](http://localhost:8000) in your browser and log in with | |||
the credentials from the previous step. |