Commit Graph

1822 Commits

Author SHA1 Message Date
Alex Vandiver
ce34ebdfed kandra: Add a hook to notify of local schema drift from merge-base. 2025-02-19 12:43:00 -08:00
Alex Vandiver
af4fa75b66 puppet: Upgrade version of aws tool. 2025-01-28 17:43:08 -08:00
Alex Vandiver
3ec896ebda nginx: Add an option which defaults loadbalancer requests to https.
In some cases, it is not possible to configure the load-balancer to
add an X-Forwarded-Proto header.  If Zulip is serving its traffic over
HTTP, it will rightly error out, since it cannot guarantee that its
response will be served over an encrypted connection.

Add a new `loadbalancer.rejects_http_requests` settings which serves
as a way for the operator to swear that the load-balancer will *never*
serve responses from Zulip over an unencrypted connection.  In most
cases, this is because the load-balancer is configured to have port 80
always serve an HTTP 301 redirect to the same URL over HTTPS.

Properly configuring the proxy to send `X-Forwarded-Proto` is always a
better solution than using this configuration parameter, so use of
this should be viewed as a last resort.
2025-01-22 12:25:42 -08:00
Prakhar Pratyush
86cd8349f7 cron: Update 'update-channel-recently-active-status' to run weekly.
This commit updates the 'update-channel-recently-active-status'
cron job to run weekly instead of daily.
2025-01-02 16:37:34 -08:00
Anders Kaseorg
58822372d5 typos: Fix typos caught by typos and mwic.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-12-24 19:15:36 -08:00
Anders Kaseorg
19b8cde27f ruff: Fix PLC0206 Extracting value from dictionary without calling .items().
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-12-21 21:06:53 -08:00
Aman Agrawal
50256f4831 stream: Add field to track active status of stream. 2024-11-27 17:31:06 -08:00
Tim Abbott
11d6273990 Update puppet/zulip/manifests/app_frontend_base.pp
Co-authored-by: Anders Kaseorg <andersk@mit.edu>
2024-11-15 15:08:33 -08:00
Tim Abbott
9d68d89d01 puppet: Require libldap-common be installed.
Zulip instances without a database included, like the Docker image,
would not fail to use TLS properly, since `TLS_REQCERT` was not set in
`/etc/ldap/ldap.conf`. While there's a few other ways we could fix
this, just installing libldap-common on app frontend instances seems
like a good solution, and has no impact on other Zulip systems, and it
was already being installed through a "Recommends" tier apt dependency
indirectly from the PostgreSQL server package.

Fixes zulip/docker-zulip#454.
2024-11-15 15:08:33 -08:00
Anders Kaseorg
2bb87aebec install: Remove PostgreSQL 12 support.
PostgreSQL 12 reaches end of life on November 14, 2024.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-11-01 15:33:31 -07:00
Alex Vandiver
f325e15439 nagios: Switch staging hosts to not page, but send a zulip. 2024-10-08 16:55:07 -07:00
Alex Vandiver
1bd0ab506c nginx: Make uwsgi timeout shorter than nginx-to-uwsgi timeout.
The nginx-to-uwsig-timeout defaults to 60s, which is exactly the same
as the current "harakiri" timeout configured in uwsgi (which limits
the length a request can run before the worker is terminated).  This
causes a race, where if nginx hits its 60s before uwsgi, then we
return a 504; otherwise, we get a 502.

Make the nginx-to-uwsgi timeout explicit, and shorten the "harakiri"
timeout to be explicitly less than that.  Document the 60s timeout,
which all outer reverse proxies must be set to _longer than_ in order
to have proper "onion" timeouts.
2024-10-07 15:41:08 -07:00
Alex Vandiver
7ddcf3774b puppet: Add tusd daily logrotation. 2024-10-04 14:22:37 -07:00
Alex Vandiver
2571196899 puppet: Remove unnecessary "create" directive.
It is irrelevant, since copytruncate is used.
2024-10-04 14:22:37 -07:00
Alex Vandiver
e6c64e78e6 puppet: Switch logrotate to be in charge of tornado logs. 2024-10-04 14:22:37 -07:00
Alex Vandiver
34308efb94 puppet: Upgrade sentry-cli.
This version causes `sentry-cli monitors run` to not fail if Sentry is
down (getsentry/sentry-cli#2169).
2024-09-30 11:24:36 -07:00
Alex Vandiver
87ee167726 puppet: Allow tusd to be exposed on non-localhost.
This allows its /metrics endpoint to be monitored.
2024-09-27 15:06:47 -07:00
Alex Vandiver
0c7d83f7da kandra: Use vector to plumb SES logs into S3. 2024-09-26 11:19:45 -07:00
Alex Vandiver
60759ab5fb kandra: Use generic "vector" process, not dedicated "akamai" process.
This makes the Vector configuration extensible, to allow it to be used
not just for ingesting Akamai logs.
2024-09-26 11:19:45 -07:00
Alex Vandiver
b0ca32c955 nginx: Fix missing word in comment. 2024-09-25 11:15:03 -07:00
Alex Vandiver
77a121082b kandra: Add localhost access to internal APIs on port 80.
This parallels 02d3fb7666.
2024-09-25 10:08:27 -07:00
Alex Vandiver
24d110f063 settings: Increase default max file upload size to 100MB.
This also _lowers_ the default nginx client_max_body_size, since that
no longer caps the upload file size.
2024-09-19 11:37:29 -07:00
Alex Vandiver
818c30372f upload: Use tusd for resumable, larger uploads.
Currently, it handles two hook types: 'pre-create' (to verify that the
user is authenticated and the file size is within the limit) and
'pre-finish' (which creates an attachment row).

No secret is shared between Django and tusd for authentication of the
hooks endpoints, because none is necessary -- tusd forwards the
end-user's credentials, and the hook checks them like it would any
end-user request.  An end-user gaining access to the endpoint would be
able to do no more harm than via tusd or the normal file upload API.

Regardless, the previous commit has restricted access to the endpoint
at the nginx layer.

Co-authored-by: Brijmohan Siyag <brijsiyag@gmail.com>
2024-09-19 11:37:29 -07:00
Alex Vandiver
02d3fb7666 nginx: Allow HTTP access to internal endpoints from localhost. 2024-09-19 11:37:29 -07:00
Alex Vandiver
c34913b4d7 nginx: Limit access to internal endpoints, to localhost. 2024-09-17 12:51:30 -07:00
Alex Vandiver
64a16dd9b4 kandra: We do not serve staging from staging.zulip.com:80.
It is not configured in the ALB's rules, nor does the ALB ever forward
to port 80.
2024-09-09 15:17:19 -07:00
Alex Vandiver
9497f23307 puppet: Make restart-server cron use standard day-of-week.
Using 7 makes this fail when run under the Sentry cron wrapper.
2024-08-30 13:13:05 -07:00
Alex Vandiver
6cc480e2b5 kandra: Ensure that we do not error out creating standby.signal.
Force us to have restored the `/var/lib/postgresql/14/main` directory
before we try to create `standby.signal` in it.
2024-08-20 14:03:51 -07:00
Alex Vandiver
49e5722a9f kandra: Match the logic in zulip::profile::postgresql. 2024-08-20 14:03:51 -07:00
Alex Vandiver
9e58780d46 puppet: Fix indentation. 2024-08-20 14:03:51 -07:00
Alex Vandiver
47ebef057e puppet: Switch to an included limits.d file. 2024-08-20 10:04:40 -07:00
Alex Vandiver
c0237e3d58 kandra: Correct group ownership and permissions to match package's.
This reverts b000328ba5 and re-applies
a759d26a32.  It is likely that the
upstream packages are simply inconsistent.
2024-08-20 10:04:40 -07:00
Alex Vandiver
fe0a7b3b77 kandra: Drop support for 20.04 hosts. 2024-08-20 10:03:59 -07:00
Alex Vandiver
dd5b03ea12 wal-g: Support setting the compression method. 2024-08-16 13:57:58 -07:00
Alex Vandiver
2840e68548 static: Pre-compress with zopfli, for better compression.
Zopfli[^1] performs very good, but time-intensive, zlib compression.
It is hence only suitable for pre-compressing objects, not on-the-fly
compression.

Use a webpack plugin to write pre-compressed versions of JS and CSS
assets using Zopfli, and configure nginx to serve those assets when
`Accept-Encoding: gzip` is provided.

This reduces the size of the JS and CSS assets on initial pageload
from 1422872 bytes to 1108267 bytes, or about a 22% savings.

[^1]: https://github.com/google/zopfli
2024-08-13 09:01:06 -07:00
Alex Vandiver
97afd713e0 nagios: Clean up after ourselves.
This prevents building up a large number of messages in the database.
2024-08-12 12:02:04 -07:00
Alex Vandiver
163863c0d1 nginx: Adjust default gzip level.
The default compression level is 1; increasing this to 3 takes a small
amount more CPU time (single-digit ms on multi-MB transfers), but
results in a small but noticeable (4-7%) percentage better
compression in JSON content.

Assuming a 25 megabit connection (the current average data rate for
cell phones in the U.S.), a 2MB file which is shrunk an additional 4%
saves approximately 25 milliseconds of transfer time; thus the
additional few milliseconds of CPU-time is well worth the cost.  For
faster connections (e.g. 100 megabit), the tradeoff is more or less a
wash.
2024-08-01 09:54:41 -07:00
Mateusz Mandera
aaca394813 presence: Remove the queue worker. 2024-07-31 16:46:42 -07:00
Alex Vandiver
59cf3379c7 puppet: Factor out nagios plugins installation. 2024-07-30 09:46:24 -07:00
Alex Vandiver
bf807eabd7 nagios: Make zephyr mirroring not page.
It is often flaky for reasons we cannot affect, and this is no longer
an important part of the Zulip Cloud service.
2024-07-26 14:24:50 -07:00
Alex Vandiver
d88f98c46b puppet: Upgrade dependencies. 2024-07-24 13:02:04 -07:00
Tim Abbott
54c2c02011 thumbnail: Add support for multiple queue workers.
There's no need for sharding, but this allows one to spend a bit of
extra memory to reduce image-processing latency when bursts of images
are uploaded at once.
2024-07-21 19:15:43 -07:00
Anders Kaseorg
f3c67103cf memcached_exporter: Explicitly close memcached connection.
Fixes warnings like “ResourceWarning: unclosed <socket.socket fd=5,
family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0,
laddr=('127.0.0.1', 39702), raddr=('127.0.0.1', 11211)>” with warnings
enabled.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-07-16 14:50:09 -07:00
Alex Vandiver
2e38f426f4 upload: Generate thumbnails when images are uploaded.
A new table is created to track which path_id attachments are images,
and for those their metadata, and which thumbnails have been created.
Using path_id as the effective primary key lets us ignore if the
attachment is archived or not, saving some foreign key messes.

A new worker is added to observe events when rows are added to this
table, and to generate and store thumbnails for those images in
differing sizes and formats.
2024-07-16 13:22:15 -07:00
Alex Vandiver
bf9539386a katex: Default the server on.
The memory costs are low (~60MB), and likely worth the stability.
2024-07-15 13:16:31 -07:00
Anders Kaseorg
a73b8a34d9 supervisor: Fix katex_server.js path for tarball deployments.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-07-15 13:16:31 -07:00
Anders Kaseorg
0fa5e7f629 ruff: Fix UP035 Import from collections.abc, typing instead.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-07-13 22:28:22 -07:00
Anders Kaseorg
531b34cb4c ruff: Fix UP007 Use X | Y for type annotations.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-07-13 22:28:22 -07:00
Anders Kaseorg
e08a24e47f ruff: Fix UP006 Use list instead of List for type annotation.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-07-13 22:28:22 -07:00
Lauryn Menard
80b86c7b16 documentation: Fix "you you" typos in docs/comments/logs. 2024-07-02 11:57:44 -07:00