Commit graph

3129 commits

Author SHA1 Message Date
Pēteris Caune
bbd45f2737
Update changelog for v3.7 release 2024-10-21 12:59:47 +03:00
Pēteris Caune
d723e14284
Switch to an older version of the base image
Related: #1076

This is temporary until we find out if libexpat will be
reinstated in the base image or not.
2024-10-21 12:08:15 +03:00
Pēteris Caune
c91213179f
Fix API to gracefully handle too long slugs 2024-10-16 12:35:30 +03:00
Pēteris Caune
f40ad2be72
Pin mypy version to 1.11.2
Mypy Django plugin is apparently not compatible with mypy 1.12 yet
2024-10-15 15:14:16 +03:00
Pēteris Caune
b42ca36b8c
Fix triple-click selection of ping URLs
When user double-clicks on text, browser selects a single word.
When user triple-clicks, browser selects a line or a paragraph
of text.

We have JS code that enables user to click on ping URL to copy
it to the clipboard. After copying it shows a small non-native
tooltip saying "Copied!" above the ping URL. This was interfering
with triple-click selection, the word "Copied!" would get selected
as well.

The fix is to use document body as the container of the tooltip,
not the ping URL span (which is the default).
2024-10-15 15:00:11 +03:00
Pēteris Caune
8c210e151f
Update the Signal integration to retry on network errors 2024-10-14 11:19:37 +03:00
Pēteris Caune
b886c93cb7
Make slider labels clickable in the "Update Period & Grace" dialog
Fixes: #1039
2024-10-11 13:37:29 +03:00
Pēteris Caune
d574fa65fc
Update _refresh_last_active_date to also refresh user session
Fixes: #1063
2024-10-10 15:41:00 +03:00
Pēteris Caune
e1ccf5f86a
Add Elestio to the 3rd party resources page
Fixes: #1062
2024-10-10 13:19:40 +03:00
Pēteris Caune
7dc13d897f
Add a hint in ntfy form
Fixes: #1059
2024-10-10 10:23:48 +03:00
Pēteris Caune
4f9b0b11b9
Update Signal transport to log unexpected signal-cli replies
When signal-cli returns an error that we are not handling yet,
log the precise JSON message that signal-cli returns. This
is for debug & development: We can look at the logged messages
and see what additional special error handling may be needed.
2024-10-10 10:21:08 +03:00
Pēteris Caune
e49b5f8fbd
Remove LINE Notify onboarding form
LINE Notify is shutting down on Apr 1, 2025:
https://notify-bot.line.me/closing-announce

I'm removing the onboarding form so people don't set up new
integrations that will stop working in 5 months.

The code for sending LINE Notify notifications still exists,
and the existing integrations will continue to work (until LINE
Notify stops working).
2024-10-08 09:13:03 +03:00
Pēteris Caune
fd96cc794b
Remove unused bits 2024-10-04 17:34:30 +03:00
Pēteris Caune
a51420744c
Add RiskCheck: disable in SMS transport
This is to reduce the chance of hitting Twilio error 30453,
"Message couldn't be delivered".

https://www.twilio.com/docs/api/errors/30453
2024-10-02 17:01:23 +03:00
Pēteris Caune
5a43e8f197
Fix formatting 2024-10-02 09:44:03 +03:00
Pēteris Caune
508094ff17
Improve wording 2024-10-02 09:36:32 +03:00
Pēteris Caune
20fb599ad9
Add note about local_settings in SECURE_PROXY_SSL_HEADER docs 2024-10-02 09:36:20 +03:00
Pēteris Caune
de4c4897e3
Remove prunenotifications management command
Notifications are now cleaned up automatically during pinging.
2024-10-02 09:24:01 +03: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
342423ee93
Update the "Accessing Administration Panel" section 2024-10-01 16:30:57 +03:00
Pēteris Caune
94b588f584
Update "Configuration" and "External Authentication" sections 2024-10-01 16:15:56 +03:00
Pēteris Caune
6ed9de4d01
Fix whitespace 2024-10-01 16:15:39 +03:00
Pēteris Caune
69a6588121
Update "Database Cleanup" in docs 2024-10-01 15:57:23 +03:00
Pēteris Caune
e73d7a1ece
Remove pruneflips management command
Flips are now cleaned up automatically during pinging.
2024-10-01 15:33:56 +03:00
Pēteris Caune
d77b96a40f
Update the uuid/slug switching links to not lose currently selected tags 2024-09-30 10:29:30 +03:00
Pēteris Caune
0b7b77c8d7
Add a note about setting REMOTE_USER_HEADER in local_settings.py
cc: #1061
2024-09-24 12:13:33 +03:00
Pēteris Caune
12cccaf7d1
Fix Project.num_checks naming collision
The Project model has (well, had) a num_checks() method.
In the project admin we are also annotating project queryset
with a "num_checks" property. Using the same name for two different
things causes type confusion for mypy and can also lead to
coding accidents.

This commit removes the Project.num_checks() method. This was easier
to do than changing admin, as the method is very simple and was used
in only two places.
2024-09-24 10:18:22 +03:00
Pēteris Caune
71f92d19fa
Improve the "TLS Termination" section in docs
cc: #1065
2024-09-23 10:29:55 +03:00
Bilal Kamran
14a08e2778
Add a minimal uWSGI example in README (#1056)
Co-authored-by: Pēteris Caune <cuu508@monkeyseemonkeydo.lv>
2024-09-12 11:53:16 +03:00
Pēteris Caune
2cb47d3742
Make the sorting of null values in Flip.select_channels() explicit 2024-09-12 10:52:06 +03:00
Pēteris Caune
f241d070e1
Update Flip.select_channels() to sort channels by last_notify_duration
If a check has multiple associated channels, some are slow and
some are quick, handle the quick ones first.
2024-09-12 10:44:56 +03:00
Pēteris Caune
f60af9a156
Update ntfy integration to give up db connection before network IO 2024-09-12 10:30:58 +03:00
Pēteris Caune
28af3720f4
Increase outgoing webhook timeout from 10 to 30 seconds
Also simplify the retry logic: each retry attempt is now
allowed to use the full 30 seconds. This means, a single
webhook delivery can take up to 3*30=90 seconds.
2024-09-11 12:37:40 +03:00
Pēteris Caune
13217af304
Add --pool parameter in manage.py sendalerts
If sendalerts receives this parameter, it reconfigures
settings.DATABASES to enable db connection pooling
(using psycopg_pool with default parameters).

This lets us use many concurrent worker threads but not
run out of database connections. For example, with
`--num-workers 100 --pool`, up to 100 worker threads can run
concurrently, but only 3 threads can get a database connection
from the pool, the rest have to wait. When a worker thread
gives up a connection (by calling `close_old_connections`),
another thread can continue.

A worker thread can give up a db connection before it is fully
finished if it anticipates a long network IO operation ahead.
The Webhook transport does this before making a curl call.

psycopg_pool's default pool size is 4 connections. One
connection is used up by the main thread, so 3 connections
are available for the worker threads.
2024-09-10 14:58:24 +03:00
Pēteris Caune
8eecece0bb
Add db migration for the updated msteams name 2024-09-10 14:45:48 +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
6bf588d984
Remove unused import 2024-09-04 10:49:09 +03:00
Pēteris Caune
5a19f9658a
Update changelog for v3.6 release 2024-09-04 10:18:56 +03:00
Pēteris Caune
4097cdee61
Bump Django to 5.1.1 2024-09-04 09:27:51 +03:00
Pēteris Caune
a72f3adc45
Update requirements to require only pure-python psycopg
... and install psycopg-c using instuctions in Dockerfile.

This way, getting a development environment or CI environment ready
is quick and easy, but Docker images still get the C optimizations.
2024-09-03 16:10:53 +03:00
Pēteris Caune
fea767723c
Upgrade to psycopg 3 2024-09-03 11:30:43 +03:00
Pēteris Caune
9d4fc031aa
Fix sendalerts to check the self.shutdown flag more often 2024-09-03 10:30:18 +03:00
Pēteris Caune
3275e0ffaa
Update notify() to return logs instead of printing them 2024-09-03 10:23:15 +03:00
Pēteris Caune
8c56ca6dde
Update sendalerts to mark flip as processed on thread
Previously this was done in process_one_flip (so on the main thread).
The advantage of doing this way is the flip gets marked as processed
only when the thread has started and has acquired a db connection.
There is now a smaller pause between a sendalerts process claiming a
flip, and actually starting work on it.
2024-09-01 15:28:48 +03:00
Pēteris Caune
fd75049e0c
Fix type warnings 2024-08-31 19:23:10 +03:00
Pēteris Caune
a463daa775
Update Webhook transport to close db connection before network IO
Webhook requests can take 20+ seconds. During that time we hold
on to a database connection. With this commit, the Webhook transport
closes its DB connection before making a curl call.

With psycopg2 this does not have much effect. But with
psycopg 3 & connection pooling we will be able to use more
sendalerts workers than we have database connections. While one
worker is busy making a slow curl call, another worker can
grab its freed up connection and do some work.

Django's test runner is not happy with connections closed
mid-test, so I patched out close_old_connections() in affected tests.
2024-08-31 19:18:17 +03:00
Pēteris Caune
9803d77a1d
Set explicit max_workers value for ThreadPoolExecutor
This is a tricky one: the default value for max_workers is
None. But it doesn't mean "unlimited", in Python 3.8+ it
means "min(32, os.cpu_count() + 4)"

For example on 8-core CPU the effective value would be 8 + 4 = 12,
and passing anything above 12 to `--max-workers` would have no effect.
2024-08-31 19:11:39 +03:00
Pēteris Caune
4cd677536d
Remove sent notification counter
The counter was slightly wrong (it counted lost races as sent
notifications). Rather than complicating code to make it correct,
let's rather just remove it :-)
2024-08-31 19:07:25 +03:00
Pēteris Caune
faa1a2c99f
Add logging for exceptions thrown inside notify() 2024-08-31 19:04:41 +03:00
Pēteris Caune
7641f2a9a1
Switch to using close_old_connections() instead of connection.close() 2024-08-31 19:02:11 +03:00