healthchecks/templates/docs/self_hosted.html
2021-01-21 11:35:09 +02:00

86 lines
2.9 KiB
HTML

<h1>Self-Hosted Healthchecks</h1>
<p>Healthchecks is open-source, and is licensed under the BSD 3-clause license.</p>
<p>Rather than using the hosted service at
<a href="https://healthchecks.io">https://healthchecks.io</a>, you have the option to host an
instance yourself.</p>
<p>The building blocks are:</p>
<ul>
<li>Python 3.6+</li>
<li>Django 3</li>
<li>PostgreSQL or MySQL</li>
</ul>
<h2>Setting Up for Development</h2>
<p>You can set up a development environment in a Python
<a href="https://docs.python.org/3/tutorial/venv.html">virtual environment</a>
on your local system to develop a new feature, write a new integration
or test a bugfix.</p>
<p>The following instructions assume you are using a Debian-based OS.</p>
<ul>
<li>
<p>Install dependencies:</p>
<div class="highlight"><pre><span></span><code>$ sudo apt-get update
$ sudo apt-get install -y gcc python3-dev python3-venv
</code></pre></div>
</li>
<li>
<p>Prepare directory for project code and virtualenv. Feel free to use a
different location:</p>
<div class="highlight"><pre><span></span><code>$ mkdir -p ~/webapps
$ <span class="nb">cd</span> ~/webapps
</code></pre></div>
</li>
<li>
<p>Prepare virtual environment
(with virtualenv you get pip, we'll use it soon to install requirements):</p>
<div class="highlight"><pre><span></span><code>$ python3 -m venv hc-venv
$ <span class="nb">source</span> hc-venv/bin/activate
</code></pre></div>
</li>
<li>
<p>Check out project code:</p>
<div class="highlight"><pre><span></span><code>$ git clone https://github.com/healthchecks/healthchecks.git
</code></pre></div>
</li>
<li>
<p>Install requirements (Django, ...) into virtualenv:</p>
<div class="highlight"><pre><span></span><code>$ pip install wheel
$ pip install -r healthchecks/requirements.txt
</code></pre></div>
</li>
<li>
<p>Create database tables and a superuser account:</p>
<div class="highlight"><pre><span></span><code>$ <span class="nb">cd</span> ~/webapps/healthchecks
$ ./manage.py migrate
$ ./manage.py createsuperuser
</code></pre></div>
</li>
</ul>
<p>With the default configuration, Healthchecks stores data in a SQLite file
<code>hc.sqlite</code> in the checkout directory (<code>~/webapps/healthchecks</code>).</p>
<ul>
<li>
<p>Run tests:</p>
<div class="highlight"><pre><span></span><code>$ ./manage.py <span class="nb">test</span>
</code></pre></div>
</li>
<li>
<p>Run development server:</p>
<div class="highlight"><pre><span></span><code>$ ./manage.py runserver
</code></pre></div>
</li>
</ul>
<p>At this point, the site should now be running at <code>http://localhost:8000</code>.</p>
<p>To access Django administration site, log in as a superuser, then
visit <code>http://localhost:8000/admin/</code>.</p>
<p>FIXME note about no email configuration, no sendalerts, and the devserver</p>
<h2>Next Steps</h2>
<p>Get the <a href="https://github.com/healthchecks/healthchecks">source code</a>.</p>
<p>See <a href="../self_hosted_configuration/">Configuration</a> for a list of configuration options.</p>