Commit graph

3074 commits

Author SHA1 Message Date
Pēteris Caune
320a7c7733
Fix the Docker healthcheck script to supply correct Host header
Commit 8fed685f12 added a HEALTHCHECK
instruction in the Dockerfile. The healthcheck script calls http://localhost:8000/api/v3/status/, which fails if localhost is not in ALLOWED_HOSTS.

With this change, the healthcheck script is now a Django management
command. It reads Django's ALLOWED_HOSTS setting, grabs the first
element, and uses it in the "Host:" HTTP header when making a HTTP
request.

cc: #1051
2024-08-21 15:52:19 +03:00
Pēteris Caune
027fcc1097
Simplify and eliminate assert 2024-08-20 14:39:11 +03:00
Pēteris Caune
0a4f038987
Simplify and eliminate assert 2024-08-20 14:13:58 +03:00
Pēteris Caune
b27ffe07a6
Update email_form to use more precise type annotation 2024-08-20 13:58:52 +03:00
Pēteris Caune
6d15c45b21
Update CHANGELOG for v3.5.1 release 2024-08-20 13:46:09 +03:00
Pēteris Caune
6f11b9c0dd
Remove unneeded bits 2024-08-20 13:27:28 +03:00
Pēteris Caune
79b9aae660
Update Dockerfile to install recent rustc (needed to build cryptography)
* Healthchecks depends on python library "fido2"
* fido2 depends on python library "cryptography"
* building cryptography requires recent (1.65+) rustc
* cryptography has prebuilt binary wheels for most architectures
  but not for arm/v7
* Dockerfile uses bookworm as base, which ships rustc 1.63
* So we now install rust using rustup

This is all terrible.
2024-08-20 13:11:29 +03:00
Pēteris Caune
ca75c7e984
Update CHANGELOG for v3.5 release 2024-08-20 11:20:34 +03:00
Pēteris Caune
001ba8b69b
Fix type warnings 2024-08-20 11:06:55 +03:00
Pēteris Caune
5e051bfc30
Fix AJAX views to better handle user logging out
Rather than redirecting to login page, return HTTP 403 Forbidden
2024-08-20 10:57:36 +03:00
Pēteris Caune
15e1a988c8
Upgrade docker-compose.yml to use postgres 16, add upgrade instructions 2024-08-19 11:00:37 +03:00
Pēteris Caune
8fed685f12
Update Dockerfile to report container health in docker ps
This commit adds a HEALTHCHECK instruction in Dockerfile.
The HEALTHCHECK instruction calls /docker/fetchstatus.sh
which in turn makes a HTTP request to
http://localhost:8000/api/v3/status/
This endpoint makes a test database query and returns non-200
response if the query fails. So, in short, if the Healthchecks
container for any reason is unable to query database, `docker ps`
will now show the container as "unhealthy".

cc: #1045
2024-08-19 10:17:05 +03:00
Pēteris Caune
70b55a777b
Add migration which updates Channel.kind values
This is to go with 8054191be3,
and should have been in there :-)

cc: #1050
2024-08-17 12:12:47 +03:00
Pēteris Caune
d3ae4e7fac
Add support for $SLUG placeholder in webhook payloads
Fixes: #1049
2024-08-16 13:24:12 +03:00
Pēteris Caune
cda744d0c1
Implement search by slug in the checks list
cc: #1048
2024-08-15 14:17:28 +03:00
Pēteris Caune
56bac98816
Update the "Set Password" page to reject very weak passwords 2024-08-15 12:04:28 +03:00
Pēteris Caune
5d63057e78
Improve password quality meter for very weak passwords
Previously, if the user enters a weak password like "qwerty",
the score is 0, the password strength bar is empty (all gray).
It is easy to not notice the password strength bar at all.

Now, the lowest score for a non-empty password is 1, meaning
the user will see one red bar. This will hopefully draw more
attention to the password strength bar.

Users are still allowed to choose weak passwords.
2024-08-15 11:10:14 +03:00
Pēteris Caune
81515e3ed2
Fix selectize optgroup separator in dark mode 2024-08-13 14:54:08 +03:00
Pēteris Caune
3fbba0c2f0
Update timezone dropdowns to show frequently used timezones at the top 2024-08-13 13:57:52 +03:00
Pēteris Caune
b859a71920
Rename "sign in" to "log in"
I like "sign in" better, but users from time
to time confuse "sign in" and "sign up" forms. To reduce
confusion potential, I'm renaming "sign in" to "log in".
2024-08-12 15:09:58 +03:00
Pēteris Caune
56862a1c49
Update NotificationsAdmin to use __ lookup in list_display 2024-08-07 17:39:17 +03:00
Pēteris Caune
f7876f67d7
Remove unused code 2024-08-07 17:38:43 +03:00
Pēteris Caune
bd5582872a
Upgrade to Django 5.1 2024-08-07 17:24:27 +03:00
Pēteris Caune
a3bc9f3b37
Upgrade to Django 5.0.8 2024-08-07 17:20:17 +03:00
Joel Pérez
28168a5651
Fix django version in self hosted documentation (#1034)
* Update self_hosted.md

* Update self_hosted.html-fragment
2024-07-30 19:24:31 +03:00
Pēteris Caune
aa2bd8cf66
Fix a testcase not correctly using sample values 2024-07-29 10:36:29 +03:00
Pēteris Caune
26ed70eccd
Bump package versions 2024-07-29 10:31:06 +03:00
Pēteris Caune
ba8a58a8a7
Fix type annotation 2024-07-29 09:57:28 +03:00
Pēteris Caune
42b733540d
Fix type annotation
It used the wrong model name and neither me nor mypy noticed
until upgrade to django-stubs 5.0.4
2024-07-29 09:50:56 +03:00
Pēteris Caune
7346994ae8
Fix field name in TypedDict used for type checking 2024-07-18 18:19:01 +03:00
Pēteris Caune
bdb6f18a3d
Add "uuid" field in API responses when read/write key is used
The API responses already contain ping_url, update_url, resume_url,
pause_url fields where the UUID can be extracted from, so we are
not exposing new information. The extraction can be finicky in,
say, shell-scripting scenarios. So for API user convenience we will
now also provide the check's code (UUID) as a separate field.

Fixes: #1007
2024-07-18 18:15:52 +03:00
Pēteris Caune
8054191be3
Remove HipChat, Pagerteam, Zendesk channel kinds
HipChat and Pagerteam products have long been shut down,
the Zendesk integration was never fully implemented.
2024-07-18 16:21:45 +03:00
Pēteris Caune
61bdd975e8
Add "(stops working Oct 2024)" note to the old MS Teams integration 2024-07-18 10:27:51 +03:00
Pēteris Caune
9ebab5d317
Rename illustrations to bust cached versions 2024-07-18 10:27:49 +03:00
Pēteris Caune
9660bc293c
Update hc.lib.s3 to retry failed requests *one time* 2024-07-17 17:26:49 +03:00
Pēteris Caune
ce5d9bcf56
Re-enable S3 retries 2024-07-17 17:04:33 +03:00
Pēteris Caune
e83f60cc0b
Implement Implement MS Teams Workflows integration
We already have a MS Teams integration but MS Teams is discontinuing
the incoming webhook feature used by this integration:

https://devblogs.microsoft.com/microsoft365dev/retirement-of-office-365-connectors-within-microsoft-teams/

MS Teams now recommends to use Workflows to post messages
via webhook. MS Teams does not provide backwards compatibility or
an upgrade path for existing integrations.

This commit adds a new "msteamsw" integration which uses MS Teams
Workflows to post notifications. It also updates the instructions
and illustrations in the "Add MS Teams Integration" page.

cc: #1024
2024-07-17 13:35:17 +03:00
Pēteris Caune
1877a8324f
Disable S3 API request retries
urrlib3's default number of retries is 3.
If requests to the S3 API are timing out, the retries usually
don't help, but a 10-second timeout turns into 10*3=30 seconds
of python code being blocked.
2024-07-12 03:09:21 +03:00
Pēteris Caune
70c5be5c4b
Fix type warning 2024-07-11 17:45:51 +03:00
Pēteris Caune
1b695c6970
Improve performance of loading ping body previews
Defer loading body_raw, instead load its first 150 bytes
as "body_raw_preview". This reduces both network I/O to database,
and disk I/O on the database host if the database contains large
request bodies.

cc: #1023
2024-07-11 17:38:25 +03:00
Pēteris Caune
3e5080d9eb
Remove Ping.body field 2024-07-11 16:34:18 +03:00
Pēteris Caune
997154e3b0
Remove usages of Ping.body 2024-07-11 16:17:21 +03:00
Pēteris Caune
daaee30c88
Add data migration to move Check.body -> Check.body_raw
We used "body" to store request body as text.
In 2022 we added "body_raw" and started to use it to store request
body as bytes.

In python code we currently need to inspect both fields,
because the data could be in "body" (for old pings) or in
"body_raw" (for newer pings). My plan is to eventually get rid
of the "body" field, and have "body_raw" only. This data migration
is a step towards that: for any Ping objects that have non-empty
"body" field, it moves the data to the "body_raw" field. After
applying this migration, the "body" field should be empty (empty
string or null) for all Ping objects.
2024-07-11 14:38:36 +03:00
Pēteris Caune
bc8fb90fed
Update Check.ping() to use select_for_update()
Without it, on MariaDB, concurrent pings can lead to a deadlock.
This results in OperationalError and HTTP 500 response to the client.

cc: #1023
2024-07-10 19:50:39 +03:00
Pēteris Caune
cc51d2bd79
Bump Django to 5.0.7 2024-07-10 14:13:07 +03:00
Pēteris Caune
3da7cf6027
Bump package versions 2024-07-08 19:59:52 +03:00
Pēteris Caune
b3de36d15c
Reorder system checks in hc.api.apps 2024-07-04 11:32:28 +03:00
Pēteris Caune
23f3256abc
Rename and clean up the apprise system check 2024-07-04 11:28:58 +03:00
Pēteris Caune
cf619bc68b
Fix hc.api.transports to not alter settings.APPRISE_ENABLED setting.
Instead, make it set a local `have_apprise` variable, and use
it in the hc.api.transports.Apprise class.

If hc.api.transports sets APPRISE_ENABLED to False,
then the apprise system check in hc.api.apps will not see the
original value and therefore will not run.
2024-07-04 11:28:16 +03:00
Rajesh Kumar
57459b0375
Show warning if apprise is enabled but apprise package is not installed (#1021)
* fix: show warning if apprise is enabled and not installed in environment

* renamed appraise check register

* revert back changes in transport for apprise
2024-07-04 11:12:05 +03:00