Commit graph

144 commits

Author SHA1 Message Date
Pēteris Caune
ff36755345
Update settings.py to populate ALLOWED_HOSTS from SITE_ROOT
The default value for ALLOWED_HOSTS was "*". The default value
now is the domain part of SITE_ROOT.
2024-12-19 12:31:40 +02:00
Pēteris Caune
a3766734ae
Update settings.py to use f-strings 2024-12-19 09:14:38 +02:00
Pēteris Caune
45b8bd64df
Simplify hosting under subpath
Instead of using SCRIPT_NAME / FORCE_SCRIPT_NAME, PATH_INFO
and their associated issues, update urls.py to add the subpath
to all routes. This allows us to get rid of several hacks:

* the uwsgi.ini magic which parses SITE_ROOT, sets SCRIPT_NAME
  and fixes PATH_INFO
* set_script_prefix() in sendalerts
* chopping the subpath off an URL in hc.accounts.views._allow_redirect

The idea comes from @apollo13
in https://code.djangoproject.com/ticket/35985#comment:5

cc: #1091
2024-12-19 09:04:45 +02:00
Pēteris Caune
0ee3f03baf
Fix redirect to login when SITE_ROOT contains a path
cc: #382, #1091
2024-12-09 12:20:09 +02:00
Pēteris Caune
7836da6448
Update settings.py to allow subpath in SITE_ROOT
If SITE_ROOT contains a subpath
(e.g., "http://example.org/healthchecks"), settings.py now adjusts
FORCE_SCRIPT_NAME and STATIC_URL.

Also, hc.lib.urls.absolute_reverse() now recognizes subpath in
SITE_ROOT, and makes sure it does not show up twice in the
generated URLs.

cc: #1091
2024-12-04 10:37:52 +02:00
Pēteris Caune
13f92b90ef
Update settings.py to read SECURE_PROXY_SSL_HEADER from env vars
And add it to docs.

And add a system check to make sure it, if set, is a tuple
with 2 elements.

cc: #851
2024-10-01 19:13:26 +03:00
Pēteris Caune
fd0c428e29
Update sqlite settings to avoid "Database is locked" errors
Fixes: #1057

"PRAGMA busy_timeout" configures the database to wait when a
database is locked instead of giving up immediately.

"transaction_mode IMMEDIATE" starts transactions in read/write
mode, required to make busy_timeout work.

Reference: https://gcollazo.com/optimal-sqlite-settings-for-django/
2024-09-09 10:11:22 +03:00
Pēteris Caune
274a59956a
Make statsd metrics collection optional
To enable, set STATSD_HOST env var (or set STATSD_HOST in
local_settings.py):

STATSD_HOST=localhost:1234

cc: #974
2024-03-18 12:55:36 +02:00
Pēteris Caune
ec0791b4ee
Update the WhatsApp integration to use Twilio Content Templates 2024-02-16 12:37:11 +02:00
Pēteris Caune
42f88f4fb0
Add S3_SECURE setting
It controls whether to use secure (TLS) connection to S3 or not.
2024-01-10 12:19:45 +02:00
Pēteris Caune
1284ee27a6
Fix the case where PING_BODY_LIMIT is None
cc: #931
2023-12-22 12:29:32 +02:00
Pēteris Caune
54ffe39143
Fix the handling of ping bodies > 2.5MB
Django has a DATA_UPLOAD_MAX_MEMORY_SIZE which controls the maximum
allowed request body size, and is 2.5MB by default.

We now bump up DATA_UPLOAD_MAX_MEMORY_SIZE to be no lower
than PING_BODY_LIMIT.

Fixes: #931
2023-12-22 12:05:16 +02:00
Pēteris Caune
c18d2ea1dd
Update logging configuration to write logs to database 2023-11-01 09:34:45 +02:00
Pēteris Caune
5afc2ea20c
Improve type hints 2023-10-26 08:35:06 +03:00
Pēteris Caune
8fb7d16864
Improve type hints, simplify pagination in Ping admin
Pagination, filtering, and result counting in Ping admin is tricky
as the pings table can contain millions of rows.

We previously used "select reltuples from pg_class" trick to
estimate the total number of rows. This only works on Postgres,
and does not handle WHERE filters.

This commit removes the search box, and changes the pagination
template to allow pagination between pages 1-9 and nothing more.
2023-10-04 16:00:41 +03:00
Pēteris Caune
c9bf3132fe
Replace usage of typing.List, typing.Optional etc. with modern syntax 2023-09-06 11:27:43 +03:00
Pēteris Caune
ef88aa3a85
Silence a ruff warning about local_settings import 2023-07-12 11:37:10 +03:00
Pēteris Caune
dec5d51e87
Configure logging to log exceptions to console even when DEBUG=False
Fixes: #835
2023-06-08 10:51:49 +03:00
Pēteris Caune
b9d016b799
Update settings.py to use pathlib 2023-06-07 16:16:18 +03:00
Pēteris Caune
eb7dfe5c63
Add Rocket.Chat integration
cc: #463
2023-05-30 12:30:29 +03:00
Pēteris Caune
8926fd5ac6
Add experimental support for setting custom MAIL FROM address
If settings.EMAIL_MAIL_FROM_TMPL is set, it will be used
as the MAIL FROM (envelope sender) address.

The EMAIL_MAIL_FROM_TMPL value should contain a "%s" placeholder.

This is intended for routing email bounce notifications to a specific
MX server. For example, if the site runs on example.com
but we want to receive bounce notifications at the mail server running
on bounces.example.com, we can set

    EMAIL_MAIL_FROM_TMPL = "%s@bounces.example.com"

Experimental, may change!
2023-05-23 15:38:39 +03:00
Pēteris Caune
c17a483be4
Add USE_GZIP_MIDDLEWARE env var which enables GZipMiddleware 2023-05-11 17:31:14 +03:00
Pēteris Caune
202e39d23b
Add COMPRESSOR_STORAGE=GzipCompressorFileStorage
(to generate .gz versions of static files)
2023-05-11 16:03:29 +03:00
Pēteris Caune
796b9540e7
Remove USE_L10N from settings (deprecated) 2023-05-04 11:13:00 +03:00
Pēteris Caune
db1b75e966
Add support for specifying MessagingServiceSid in Twilio API requests 2023-05-03 13:06:08 +03:00
Pēteris Caune
dc58910bb5
Switch from CssAbsoluteFilter to CssRelativeFilter
cc: #822

This should fix icon font loading when serving Healthchecks
from a subdirectory.
2023-04-12 11:37:14 +03:00
Pēteris Caune
7a06f01fca
Update links to Django docs 2023-04-07 12:50:09 +03:00
Pēteris Caune
e21ada67f1
Remove L10N markup from base.html, and associated translations 2023-03-29 19:19:03 +03:00
Pēteris Caune
c2f828df83
Add custom ExceptionReporterFilter which filters out TWILIO_AUTH 2023-02-20 09:43:03 +02:00
Pēteris Caune
ae53aaaa3a
Update settings.py to read the ADMINS setting from an env variable 2022-12-20 16:23:33 +02:00
Pēteris Caune
5969e940a5
Switch to using "from __future__ import annotations" 2022-10-17 16:29:48 +03:00
Pēteris Caune
218798b8d2
Fix mypy warnings 2022-08-17 14:21:00 +03:00
Pēteris Caune
64bb43f74f
Limit allowed protocols, add INTEGRATIONS_ALLOW_PRIVATE_IPS setting 2022-08-16 11:13:14 +03:00
Pēteris Caune
dd1c05a706
Update links to Django docs, render docs 2022-08-09 08:31:54 +03:00
Facorazza
6f1900cfa3
Add support for SMTP with implicit TLS 2022-08-09 08:25:07 +03:00
Pēteris Caune
5a94e6809e
Update links to Django docs (3.1 -> 4.0) 2022-07-26 10:40:50 +03:00
Pēteris Caune
c1ac2ffc9c
Fix s3.py to reuse Minio client and retry InternalError errors 2022-03-04 17:33:13 +02:00
Pēteris Caune
82663a2a52
Update Signal integration to use JSON RPC over UNIX socket 2022-01-13 18:12:33 +02:00
Pēteris Caune
e6427995b7
Add Whitenoise and improve README
Fixes: #548
2021-08-05 18:06:47 +03:00
Pēteris Caune
2382bf6722
Add SITE_LOGO_URL setting
Fixes: #323
2021-07-16 15:30:34 +03:00
Pēteris Caune
2d20f439dd
Remove PagerDuty Connect
PagerDuty Connect is deprecated and will be discontinued.
It is replaced by PagerDuty Simple Install Flow (see
README for setup instructions).
2021-06-21 10:44:21 +03:00
Pēteris Caune
fd7ab5e767
Implement PagerDuty Simple Install Flow 2021-06-16 14:18:32 +03:00
Pēteris Caune
78652b5659
Upgrade Django version to 3.2 2021-04-07 11:39:11 +03:00
Pēteris Caune
65ace8238a
Add the ZULIP_ENABLED setting 2021-02-03 09:11:32 +02:00
Pēteris Caune
e2c90c05b8
Add the VICTOROPS_ENABLED setting 2021-02-03 09:00:28 +02:00
Pēteris Caune
8811640d45
Add the SPIKE_ENABLED setting 2021-01-29 15:21:38 +02:00
Pēteris Caune
725be65bdd
Add the PROMETHEUS_ENABLED setting 2021-01-29 15:05:42 +02:00
Pēteris Caune
419d96da7a
Add the PAGERTREE_ENABLED setting 2021-01-29 14:21:02 +02:00
Pēteris Caune
28150e85fa
Add the PD_ENABLED setting 2021-01-29 14:06:40 +02:00
Pēteris Caune
8d5890d883
Add the OPSGENIE_ENABLED setting, rename OpsGenie -> Opsgenie 2021-01-29 13:47:13 +02:00