You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

441 lines
18 KiB

10 years ago
9 years ago
9 years ago
9 years ago
9 years ago
10 years ago
10 years ago
10 years ago
5 years ago
update Readme with pip install dependencies pip install will fail when you cannot compile some of the dependencies. one is gcc the other is the Python.h ``` Building wheels for collected packages: rcssmin, rjsmin Running setup.py bdist_wheel for rcssmin ... error Complete output from command /home/ubuntu/webapps/hc-venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-ipfho29k/rcssmin/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-u0q6mggl --python-tag cp36: running bdist_wheel running build running build_py creating build creating build/lib.linux-x86_64-3.6 copying ./rcssmin.py -> build/lib.linux-x86_64-3.6 running build_ext building '_rcssmin' extension creating build/temp.linux-x86_64-3.6 x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DEXT_MODULE=_rcssmin -UEXT_PACKAGE -I_setup/include -I/usr/include/python3.6m -I/home/ubuntu/webapps/hc-venv/include/python3.6m -c rcssmin.c -o build/temp.linux-x86_64-3.6/rcssmin.o unable to execute 'x86_64-linux-gnu-gcc': No such file or directory error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 ---------------------------------------- Failed building wheel for rcssmin Running setup.py clean for rcssmin Running setup.py bdist_wheel for rjsmin ... error Complete output from command /home/ubuntu/webapps/hc-venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-ipfho29k/rjsmin/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-axnaq3w9 --python-tag cp36: running bdist_wheel running build running build_py creating build creating build/lib.linux-x86_64-3.6 copying ./rjsmin.py -> build/lib.linux-x86_64-3.6 running build_ext building '_rjsmin' extension creating build/temp.linux-x86_64-3.6 x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DEXT_MODULE=_rjsmin -UEXT_PACKAGE -I_setup/include -I/usr/include/python3.6m -I/home/ubuntu/webapps/hc-venv/include/python3.6m -c rjsmin.c -o build/temp.linux-x86_64-3.6/rjsmin.o unable to execute 'x86_64-linux-gnu-gcc': No such file or directory error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 ``` ``` Running setup.py bdist_wheel for rjsmin ... error Complete output from command /home/ubuntu/webapps/hc-venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-cfntw7bo/rjsmin/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-ytqxu9_b --python-tag cp36: running bdist_wheel running build running build_py creating build creating build/lib.linux-x86_64-3.6 copying ./rjsmin.py -> build/lib.linux-x86_64-3.6 running build_ext building '_rjsmin' extension creating build/temp.linux-x86_64-3.6 x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DEXT_MODULE=_rjsmin -UEXT_PACKAGE -I_setup/include -I/usr/include/python3.6m -I/home/ubuntu/webapps/hc-venv/include/python3.6m -c rjsmin.c -o build/temp.linux-x86_64-3.6/rjsmin.o In file included from rjsmin.c:18:0: _setup/include/cext.h:34:10: fatal error: Python.h: No such file or directory #include "Python.h" ^~~~~~~~~~ compilation terminated. ```
6 years ago
6 years ago
update Readme with pip install dependencies pip install will fail when you cannot compile some of the dependencies. one is gcc the other is the Python.h ``` Building wheels for collected packages: rcssmin, rjsmin Running setup.py bdist_wheel for rcssmin ... error Complete output from command /home/ubuntu/webapps/hc-venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-ipfho29k/rcssmin/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-u0q6mggl --python-tag cp36: running bdist_wheel running build running build_py creating build creating build/lib.linux-x86_64-3.6 copying ./rcssmin.py -> build/lib.linux-x86_64-3.6 running build_ext building '_rcssmin' extension creating build/temp.linux-x86_64-3.6 x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DEXT_MODULE=_rcssmin -UEXT_PACKAGE -I_setup/include -I/usr/include/python3.6m -I/home/ubuntu/webapps/hc-venv/include/python3.6m -c rcssmin.c -o build/temp.linux-x86_64-3.6/rcssmin.o unable to execute 'x86_64-linux-gnu-gcc': No such file or directory error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 ---------------------------------------- Failed building wheel for rcssmin Running setup.py clean for rcssmin Running setup.py bdist_wheel for rjsmin ... error Complete output from command /home/ubuntu/webapps/hc-venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-ipfho29k/rjsmin/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-axnaq3w9 --python-tag cp36: running bdist_wheel running build running build_py creating build creating build/lib.linux-x86_64-3.6 copying ./rjsmin.py -> build/lib.linux-x86_64-3.6 running build_ext building '_rjsmin' extension creating build/temp.linux-x86_64-3.6 x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DEXT_MODULE=_rjsmin -UEXT_PACKAGE -I_setup/include -I/usr/include/python3.6m -I/home/ubuntu/webapps/hc-venv/include/python3.6m -c rjsmin.c -o build/temp.linux-x86_64-3.6/rjsmin.o unable to execute 'x86_64-linux-gnu-gcc': No such file or directory error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 ``` ``` Running setup.py bdist_wheel for rjsmin ... error Complete output from command /home/ubuntu/webapps/hc-venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-cfntw7bo/rjsmin/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-ytqxu9_b --python-tag cp36: running bdist_wheel running build running build_py creating build creating build/lib.linux-x86_64-3.6 copying ./rjsmin.py -> build/lib.linux-x86_64-3.6 running build_ext building '_rjsmin' extension creating build/temp.linux-x86_64-3.6 x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DEXT_MODULE=_rjsmin -UEXT_PACKAGE -I_setup/include -I/usr/include/python3.6m -I/home/ubuntu/webapps/hc-venv/include/python3.6m -c rjsmin.c -o build/temp.linux-x86_64-3.6/rjsmin.o In file included from rjsmin.c:18:0: _setup/include/cext.h:34:10: fatal error: Python.h: No such file or directory #include "Python.h" ^~~~~~~~~~ compilation terminated. ```
6 years ago
10 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. # Healthchecks
  2. [![Build Status](https://travis-ci.org/healthchecks/healthchecks.svg?branch=master)](https://travis-ci.org/healthchecks/healthchecks)
  3. [![Coverage Status](https://coveralls.io/repos/healthchecks/healthchecks/badge.svg?branch=master&service=github)](https://coveralls.io/github/healthchecks/healthchecks?branch=master)
  4. ![Screenshot of Welcome page](/static/img/welcome.png?raw=true "Welcome Page")
  5. ![Screenshot of My Checks page](/static/img/my_checks.png?raw=true "My Checks Page")
  6. ![Screenshot of Period/Grace dialog](/static/img/period_grace.png?raw=true "Period/Grace Dialog")
  7. ![Screenshot of Cron dialog](/static/img/cron.png?raw=true "Cron Dialog")
  8. ![Screenshot of Integrations page](/static/img/channels.png?raw=true "Integrations Page")
  9. healthchecks is a watchdog for your cron jobs. It's a web server that listens for pings from your cron jobs, plus a web interface.
  10. It is live here: [http://healthchecks.io/](http://healthchecks.io/)
  11. The building blocks are:
  12. * Python 3.6+
  13. * Django 3
  14. * PostgreSQL or MySQL
  15. ## Setting Up for Development
  16. These are instructions for setting up healthchecks Django app
  17. in development environment.
  18. * install dependencies (Debian/Ubuntu)
  19. $ sudo apt-get update
  20. $ sudo apt-get install -y gcc python3-dev python3-venv
  21. * prepare directory for project code and virtualenv:
  22. $ mkdir -p ~/webapps
  23. $ cd ~/webapps
  24. * prepare virtual environment
  25. (with virtualenv you get pip, we'll use it soon to install requirements):
  26. $ python3 -m venv hc-venv
  27. $ source hc-venv/bin/activate
  28. * check out project code:
  29. $ git clone https://github.com/healthchecks/healthchecks.git
  30. * install requirements (Django, ...) into virtualenv:
  31. $ pip install -r healthchecks/requirements.txt
  32. * healthchecks is configured to use a SQLite database by default. To use
  33. PostgreSQL or MySQL database, create and edit `hc/local_settings.py` file.
  34. There is a template you can copy and edit as needed:
  35. $ cd ~/webapps/healthchecks
  36. $ cp hc/local_settings.py.example hc/local_settings.py
  37. * create database tables and the superuser account:
  38. $ cd ~/webapps/healthchecks
  39. $ ./manage.py migrate
  40. $ ./manage.py createsuperuser
  41. * run development server:
  42. $ ./manage.py runserver
  43. The site should now be running at `http://localhost:8000`.
  44. To access Django administration site, log in as a super user, then
  45. visit `http://localhost:8000/admin`
  46. ## Configuration
  47. Site configuration is loaded from environment variables. This is
  48. done in `hc/settings.py`. Additional configuration is loaded
  49. from `hc/local_settings.py` file, if it exists. You can create this file
  50. (should be right next to `settings.py` in the filesystem) and override
  51. settings, or add extra settings as needed.
  52. Configurations settings loaded from environment variables:
  53. | Environment variable | Default value | Notes
  54. | -------------------- | ------------- | ----- |
  55. | [SECRET_KEY](https://docs.djangoproject.com/en/2.2/ref/settings/#secret-key) | `"---"`
  56. | [DEBUG](https://docs.djangoproject.com/en/2.2/ref/settings/#debug) | `True` | Set to `False` for production
  57. | [ALLOWED_HOSTS](https://docs.djangoproject.com/en/2.2/ref/settings/#allowed-hosts) | `*` | Separate multiple hosts with commas
  58. | [DEFAULT_FROM_EMAIL](https://docs.djangoproject.com/en/2.2/ref/settings/#default-from-email) | `"[email protected]"`
  59. | USE_PAYMENTS | `False`
  60. | REGISTRATION_OPEN | `True`
  61. | DB | `"sqlite"` | Set to `"postgres"` or `"mysql"`
  62. | [DB_HOST](https://docs.djangoproject.com/en/2.2/ref/settings/#host) | `""` *(empty string)*
  63. | [DB_PORT](https://docs.djangoproject.com/en/2.2/ref/settings/#port) | `""` *(empty string)*
  64. | [DB_NAME](https://docs.djangoproject.com/en/2.2/ref/settings/#name) | `"hc"` (PostgreSQL, MySQL) or `"/path/to/project/hc.sqlite"` (SQLite) | For SQLite, specify the full path to the database file.
  65. | [DB_USER](https://docs.djangoproject.com/en/2.2/ref/settings/#user) | `"postgres"` or `"root"`
  66. | [DB_PASSWORD](https://docs.djangoproject.com/en/2.2/ref/settings/#password) | `""` *(empty string)*
  67. | [DB_CONN_MAX_AGE](https://docs.djangoproject.com/en/2.2/ref/settings/#conn-max-age) | `0`
  68. | DB_SSLMODE | `"prefer"` | PostgreSQL-specific, [details](https://blog.github.com/2018-10-21-october21-incident-report/)
  69. | DB_TARGET_SESSION_ATTRS | `"read-write"` | PostgreSQL-specific, [details](https://www.postgresql.org/docs/10/static/libpq-connect.html#LIBPQ-CONNECT-TARGET-SESSION-ATTRS)
  70. | EMAIL_HOST | `""` *(empty string)*
  71. | EMAIL_PORT | `"587"`
  72. | EMAIL_HOST_USER | `""` *(empty string)*
  73. | EMAIL_HOST_PASSWORD | `""` *(empty string)*
  74. | EMAIL_USE_TLS | `"True"`
  75. | EMAIL_USE_VERIFICATION | `"True"`
  76. | SITE_ROOT | `"http://localhost:8000"`
  77. | SITE_NAME | `"Mychecks"`
  78. | MASTER_BADGE_LABEL | `"Mychecks"`
  79. | PING_ENDPOINT | `"http://localhost:8000/ping/"`
  80. | PING_EMAIL_DOMAIN | `"localhost"`
  81. | PING_BODY_LIMIT | 10000 | In bytes. Set to `None` to always log full request body
  82. | DISCORD_CLIENT_ID | `None`
  83. | DISCORD_CLIENT_SECRET | `None`
  84. | SLACK_CLIENT_ID | `None`
  85. | SLACK_CLIENT_SECRET | `None`
  86. | PUSHOVER_API_TOKEN | `None`
  87. | PUSHOVER_SUBSCRIPTION_URL | `None`
  88. | PUSHOVER_EMERGENCY_RETRY_DELAY | `300`
  89. | PUSHOVER_EMERGENCY_EXPIRATION | `86400`
  90. | PUSHBULLET_CLIENT_ID | `None`
  91. | PUSHBULLET_CLIENT_SECRET | `None`
  92. | TELEGRAM_BOT_NAME | `"ExampleBot"`
  93. | TELEGRAM_TOKEN | `None`
  94. | TWILIO_ACCOUNT | `None`
  95. | TWILIO_AUTH | `None`
  96. | TWILIO_FROM | `None`
  97. | TWILIO_USE_WHATSAPP | `"False"`
  98. | PD_VENDOR_KEY | `None`
  99. | TRELLO_APP_KEY | `None`
  100. | MATRIX_HOMESERVER | `None`
  101. | MATRIX_USER_ID | `None`
  102. | MATRIX_ACCESS_TOKEN | `None`
  103. | APPRISE_ENABLED | `"False"`
  104. | SHELL_ENABLED | `"False"`
  105. Some useful settings keys to override are:
  106. `SITE_ROOT` is used to build fully qualified URLs for pings, and for use in
  107. emails and notifications. Example:
  108. ```python
  109. SITE_ROOT = "https://my-monitoring-project.com"
  110. ```
  111. `SITE_NAME` has the default value of "Mychecks" and is used throughout
  112. the templates. Replace it with your own name to personalize your installation.
  113. Example:
  114. ```python
  115. SITE_NAME = "My Monitoring Project"
  116. ```
  117. `REGISTRATION_OPEN` controls whether site visitors can create new accounts.
  118. Set it to `False` if you are setting up a private healthchecks instance, but
  119. it needs to be publicly accessible (so, for example, your cloud services
  120. can send pings).
  121. If you close new user registration, you can still selectively invite users
  122. to your team account.
  123. `EMAIL_USE_VERIFICATION` enables/disables the sending of a verification
  124. link when an email address is added to the list of notification methods.
  125. Set it to `False` if you are setting up a private healthchecks instance where
  126. you trust your users and want to avoid the extra verification step.
  127. `PING_BODY_LIMIT` sets the size limit in bytes for logged ping request bodies.
  128. The default value is 10000 (10 kilobytes). You can remove the limit altogether by
  129. setting this value to `None`.
  130. ## Database Configuration
  131. Database configuration is loaded from environment variables. If you
  132. need to use a non-standard configuration, you can override the
  133. database configuration in `hc/local_settings.py` like so:
  134. ```python
  135. DATABASES = {
  136. 'default': {
  137. 'ENGINE': 'django.db.backends.postgresql',
  138. 'NAME': 'your-database-name-here',
  139. 'USER': 'your-database-user-here',
  140. 'PASSWORD': 'your-database-password-here',
  141. 'TEST': {'CHARSET': 'UTF8'},
  142. 'OPTIONS': {
  143. ... your custom options here ...
  144. }
  145. }
  146. }
  147. ```
  148. ## Accessing Administration Panel
  149. healthchecks comes with Django's administration panel where you can manually
  150. view and modify user accounts, projects, checks, integrations etc. To access it,
  151. * if you haven't already, create a superuser account: `./manage.py createsuperuser`
  152. * log into the site using superuser credentials
  153. * in the top navigation, "Account" dropdown, select "Site Administration"
  154. ## Sending Emails
  155. healthchecks must be able to send email messages, so it can send out login
  156. links and alerts to users. Environment variables can be used to configure
  157. SMTP settings, or your may put your SMTP server configuration in
  158. `hc/local_settings.py` like so:
  159. ```python
  160. EMAIL_HOST = "your-smtp-server-here.com"
  161. EMAIL_PORT = 587
  162. EMAIL_HOST_USER = "username"
  163. EMAIL_HOST_PASSWORD = "password"
  164. EMAIL_USE_TLS = True
  165. ```
  166. For more information, have a look at Django documentation,
  167. [Sending Email](https://docs.djangoproject.com/en/1.10/topics/email/) section.
  168. ## Receiving Emails
  169. healthchecks comes with a `smtpd` management command, which starts up a
  170. SMTP listener service. With the command running, you can ping your
  171. checks by sending email messages
  172. to `[email protected]` email addresses.
  173. Start the SMTP listener on port 2525:
  174. $ ./manage.py smtpd --port 2525
  175. Send a test email:
  176. $ curl --url 'smtp://127.0.0.1:2525' \
  177. --mail-from '[email protected]' \
  178. --mail-rcpt '[email protected]' \
  179. -F '='
  180. ## Sending Status Notifications
  181. healtchecks comes with a `sendalerts` management command, which continuously
  182. polls database for any checks changing state, and sends out notifications as
  183. needed. Within an activated virtualenv, you can manually run
  184. the `sendalerts` command like so:
  185. $ ./manage.py sendalerts
  186. In a production setup, you will want to run this command from a process
  187. manager like [supervisor](http://supervisord.org/) or systemd.
  188. ## Database Cleanup
  189. With time and use the healthchecks database will grow in size. You may
  190. decide to prune old data: inactive user accounts, old checks not assigned
  191. to users, records of outgoing email messages and records of received pings.
  192. There are separate Django management commands for each task:
  193. * Remove old records from `api_ping` table. For each check, keep 100 most
  194. recent pings:
  195. ```
  196. $ ./manage.py prunepings
  197. ```
  198. * Remove old records of sent notifications. For each check, remove
  199. notifications that are older than the oldest stored ping for same check.
  200. ```
  201. $ ./manage.py prunenotifications
  202. ```
  203. * Remove user accounts that match either of these conditions:
  204. * Account was created more than 6 months ago, and user has never logged in.
  205. These can happen when user enters invalid email address when signing up.
  206. * Last login was more than 6 months ago, and the account has no checks.
  207. Assume the user doesn't intend to use the account any more and would
  208. probably *want* it removed.
  209. ```
  210. $ ./manage.py pruneusers
  211. ```
  212. * Remove old records from the `api_tokenbucket` table. The TokenBucket
  213. model is used for rate-limiting login attempts and similar operations.
  214. Any records older than one day can be safely removed.
  215. ```
  216. $ ./manage.py prunetokenbucket
  217. ```
  218. * Remove old records from the `api_flip` table. The Flip
  219. objects are used to track status changes of checks, and to calculate
  220. downtime statistics month by month. Flip objects from more than 3 months
  221. ago are not used and can be safely removed.
  222. ```
  223. $ ./manage.py pruneflips
  224. ```
  225. When you first try these commands on your data, it is a good idea to
  226. test them on a copy of your database, not on the live database right away.
  227. In a production setup, you should also have regular, automated database
  228. backups set up.
  229. ## Integrations
  230. ### Slack
  231. To enable the Slack "self-service" integration, you will need to create a "Slack App".
  232. To do so:
  233. * Create a _new Slack app_ on https://api.slack.com/apps/
  234. * Add at least _one scope_ in the permissions section to be able to deploy the app in your workspace (By example `incoming-webhook` for the `Bot Token Scopes`
  235. https://api.slack.com/apps/APP_ID/oauth?).
  236. * Add a _redirect url_ in the format `SITE_ROOT/integrations/add_slack_btn/`.
  237. For example, if your SITE_ROOT is `https://my-hc.example.org` then the redirect URL would be
  238. `https://my-hc.example.org/integrations/add_slack_btn/`.
  239. * Look up your Slack app for the Client ID and Client Secret at https://api.slack.com/apps/APP_ID/general? . Put them
  240. in `SLACK_CLIENT_ID` and `SLACK_CLIENT_SECRET` environment
  241. variables.
  242. ### Discord
  243. To enable Discord integration, you will need to:
  244. * register a new application on https://discordapp.com/developers/applications/me
  245. * add a redirect URI to your Discord application. The URI format is
  246. `SITE_ROOT/integrations/add_discord/`. For example, if you are running a
  247. development server on `localhost:8000` then the redirect URI would be
  248. `http://localhost:8000/integrations/add_discord/`
  249. * Look up your Discord app's Client ID and Client Secret. Put them
  250. in `DISCORD_CLIENT_ID` and `DISCORD_CLIENT_SECRET` environment
  251. variables.
  252. ### Pushover
  253. Pushover integration works by creating an application on Pushover.net which
  254. is then subscribed to by Healthchecks users. The registration workflow is as follows:
  255. * On Healthchecks, the user adds a "Pushover" integration to a project
  256. * Healthchecks redirects user's browser to a Pushover.net subscription page
  257. * User approves adding the Healthchecks subscription to their Pushover account
  258. * Pushover.net HTTP redirects back to Healthchecks with a subscription token
  259. * Healthchecks saves the subscription token and uses it for sending Pushover
  260. notifications
  261. To enable the Pushover integration, you will need to:
  262. * Register a new application on Pushover via https://pushover.net/apps/build.
  263. * Within the Pushover 'application' configuration, enable subscriptions.
  264. Make sure the subscription type is set to "URL". Also make sure the redirect
  265. URL is configured to point back to the root of the Healthchecks instance
  266. (e.g., `http://healthchecks.example.com/`).
  267. * Put the Pushover application API Token and the Pushover subscription URL in
  268. `PUSHOVER_API_TOKEN` and `PUSHOVER_SUBSCRIPTION_URL` environment
  269. variables. The Pushover subscription URL should look similar to
  270. `https://pushover.net/subscribe/yourAppName-randomAlphaNumericData`.
  271. ### Telegram
  272. * Create a Telegram bot by talking to the
  273. [BotFather](https://core.telegram.org/bots#6-botfather). Set the bot's name,
  274. description, user picture, and add a "/start" command.
  275. * After creating the bot you will have the bot's name and token. Put them
  276. in `TELEGRAM_BOT_NAME` and `TELEGRAM_TOKEN` environment variables.
  277. * Run `settelegramwebhook` management command. This command tells Telegram
  278. where to forward channel messages by invoking Telegram's
  279. [setWebhook](https://core.telegram.org/bots/api#setwebhook) API call:
  280. ```
  281. $ ./manage.py settelegramwebhook
  282. Done, Telegram's webhook set to: https://my-monitoring-project.com/integrations/telegram/bot/
  283. ```
  284. For this to work, your `SITE_ROOT` needs to be correct and use "https://"
  285. scheme.
  286. ### Apprise
  287. To enable Apprise integration, you will need to:
  288. * ensure you have apprise installed in your local environment:
  289. ```bash
  290. pip install apprise
  291. ```
  292. * enable the apprise functionality by setting the `APPRISE_ENABLED` environment variable.
  293. ### Shell Commands
  294. The "Shell Commands" integration runs user-defined local shell commands when checks
  295. go up or down. This integration is disabled by default, and can be enabled by setting
  296. the `SHELL_ENABLED` environment variable to `True`.
  297. Note: be careful when using "Shell Commands" integration, and only enable it when
  298. you fully trust the users of your Healthchecks instance. The commands will be executed
  299. by the `manage.py sendalerts` process, and will run with the same system permissions as
  300. the `sendalerts` process.
  301. ## Running in Production
  302. Here is a non-exhaustive list of pointers and things to check before launching a Healthchecks instance
  303. in production.
  304. * Environment variables, settings.py and local_settings.py.
  305. * [DEBUG](https://docs.djangoproject.com/en/2.2/ref/settings/#debug). Make sure it is set to `False`.
  306. * [ALLOWED_HOSTS](https://docs.djangoproject.com/en/2.2/ref/settings/#allowed-hosts). Make sure it
  307. contains the correct domain name you want to use.
  308. * Server Errors. When DEBUG=False, Django will not show detailed error pages, and will not print exception
  309. tracebacks to standard output. To receive exception tracebacks in email,
  310. review and edit the [ADMINS](https://docs.djangoproject.com/en/2.2/ref/settings/#admins) and
  311. [SERVER_EMAIL](https://docs.djangoproject.com/en/2.2/ref/settings/#server-email) settings.
  312. Another good option for receiving exception tracebacks is to use [Sentry](https://sentry.io/for/django/).
  313. * Management commands that need to be run during each deployment.
  314. * This project uses [Django Compressor](https://django-compressor.readthedocs.io/en/stable/)
  315. to combine the CSS and JS files. It is configured for offline compression – run the
  316. `manage.py compress` command whenever files in the `/static/` directory change.
  317. * This project uses Django's [staticfiles app](https://docs.djangoproject.com/en/2.2/ref/contrib/staticfiles/).
  318. Run the `manage.py collectstatic` command whenever files in the `/static/`
  319. directory change. This command collects all the static files inside the `static-collected` directory.
  320. Configure your web server to serve files from this directory under the `/static/` prefix.
  321. * Database migration should be run after each update to make sure the database schemas are up to date. You can do that with `./manage.py migrate`.
  322. * Processes that need to be running constantly.
  323. * `manage.py runserver` is intended for development only. Do not use it in production,
  324. instead consider using [uWSGI](https://uwsgi-docs.readthedocs.io/en/latest/) or
  325. [gunicorn](https://gunicorn.org/).
  326. * Make sure the `manage.py sendalerts` command is running and can survive server restarts.
  327. On modern linux systems, a good option is to
  328. [define a systemd service](https://github.com/healthchecks/healthchecks/issues/273#issuecomment-520560304) for it.
  329. * General
  330. * Make sure the database is secured well and is getting backed up regularly
  331. * Make sure the TLS certificates are secured well and are getting refreshed regularly
  332. * Have monitoring in place to be sure the Healthchecks instance itself is operational
  333. (is accepting pings, is sending out alerts, is not running out of resources).