Commit Graph

1503 Commits

Author SHA1 Message Date
Tim Abbott 0a756c652c push_notifications: Shard mobile push notifications. 2024-05-02 14:25:10 -07:00
Alex Vandiver 9dfaa83aa8 invites: Remove invites worker, make confirmation object in-process.
The "invites" worker exists to do two things -- make a Confirmation
object, and send the outgoing email.  Making the Confirmation object
in a background process from where the PreregistrationUser is created
temporarily leaves the PreregistrationUser in invalid state, and
results in 500's, and the user not immediately seeing the sent
invitation.  That the "invites" worker also wants to create the
Confirmation object means that "resending" an invite invalidates the
URL in the previous email, which can be confusing to the user.

Moving the Confirmation creation to the same transaction solves both
of these issues, and leaves the "invites" worker with nothing to do
but send the email; as such, we remove it entirely, and use the
existing "email_senders" worker to send the invites.  The volume of
invites is small enough that this will not affect other uses of that
worker.

Fixes: #21306
Fixes: #24275
2024-05-02 14:23:04 -07:00
Anders Kaseorg 0c7fd45c83 install-node: Upgrade Node.js from 20.12.0 to 20.12.2.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-04-25 16:46:03 -07:00
Alex Vandiver 7f4bc05f8e install: Check for a supported version of the OS in shell.
Testing for it in Python means that we have to worry about keeping the
`upgrade-zulip-stage-2` backwards-compatible with all versions of
Python which we could ever be upgrading from -- which is all of them.

Factor out the "supported operating systems" check, and share it
between upgrade and install codepaths.
2024-04-16 11:13:33 -07:00
Alex Vandiver a853b8849f install: Actually add --puppet-classes argument.
7187146422 only added it to the internal parsing and the help, not
the getopt invocation which would make the command accept the
argument.
2024-04-11 15:34:00 -07:00
Anders Kaseorg 36aa0177bd Revert "apt-repos: Disallow libmagic1 1:5.45-2 (Ubuntu 24.04) again."
This reverts commit 13e28fc3ac.
2024-04-10 16:07:25 -07:00
Alex Vandiver 7187146422 install: Move PUPPET_CLASSES env var to --puppet-classes argument.
`--no-init-db` is used to silence the need for `--hostname` and
`--email` arguments; it is a proxy for "this is not a frontend host."
We would ideally like to use `has_class` to know if the user's
provided puppet classes are include an `app_frontend`, and thus
`--hostname` and `--email` are required -- but doing that requires
several other steps, and we would like this feedback to be immediate.

We make the presence of `--puppet-classes` equivalent to
`--no-init-db`, since nearly every configuration with
`--puppet-classes` does not install both a database and a frontend,
which is what is required to initialize a database.
2024-04-04 16:49:43 -07:00
Alex Vandiver 89484fbbe6 install: Remove the hidden VIRTUALENV_NEEDED parameter.
We can do this behaviour better by using `has_roles`.
2024-04-04 16:49:42 -07:00
Alex Vandiver efdfaaf5a2 install: Only install node on frontend hosts. 2024-04-04 16:49:22 -07:00
Alex Vandiver acc94a5f32 create-database: Skip stop-server and flush-memcached on standalone Pg.
If running on a stand-alone PostgreSQL server, then supervisor does
exist -- but `stop-server` is useless, and in fact cannot run because
the Zulip directory may not be readable by the `zulip` user.

Detect if this is an application front-end server by looking for
`/home/zulip/deployments`, and use the stop-server and flush-memcached
from there if it exists.  The `create-db.sql` and
`terminate-psql-sessions` files are still read from the local
directory, but those already have precautions from being from a
non-world-readable directory, and are more obviously important to keep
in sync with the `create-database` script.
2024-04-04 16:48:58 -07:00
Anders Kaseorg 0bae651e23 upgrade-zulip-stage-2: Add Ubuntu 20.04, Debian 11 to UNSUPPORTED_DISTROS.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-04-04 16:28:12 -07:00
Anders Kaseorg ad5abbe54f apt-repos: Remove Ubuntu 24.04 gnupg workaround.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-04-04 10:48:22 -07:00
Anders Kaseorg 13e28fc3ac apt-repos: Disallow libmagic1 1:5.45-2 (Ubuntu 24.04) again.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-04-03 11:28:49 -07:00
Anders Kaseorg 6e871e7731 ruff: Fix UP036 Version block is outdated for minimum Python version.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-04-01 18:32:52 -07:00
Anders Kaseorg 70914b0475 Remove support for Ubuntu 20.04 and Debian 11.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2024-04-01 13:27:39 -07:00
Anders Kaseorg 4ebc734632 apt-repos: Temporarily work around Ubuntu 24.04 non-installable gnupg.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-31 13:51:31 -07:00
Anders Kaseorg 5d6e616808 Revert "apt-repos: Disallow libmagic1 1:5.45-2 (Ubuntu 24.04)."
This reverts commit 44e38e8ea7.
2024-03-30 11:29:07 -07:00
Anders Kaseorg da984d0ab3 install-node: Upgrade Node.js from 20.11.1 to 20.12.0.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-29 09:37:38 -07:00
Anders Kaseorg 708c3e7182 node_cache: Invoke pnpm via corepack.
This avoids prompting the user that corepack is about to download
pnpm.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-29 09:37:38 -07:00
Anders Kaseorg 44e38e8ea7 apt-repos: Disallow libmagic1 1:5.45-2 (Ubuntu 24.04).
This package is replaced by libmagic1t64 1:5.45-3 for the Ubuntu
64-bit time_t transition, but hasn’t been deleted from the archive
yet.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-28 16:47:30 -07:00
Tim Abbott 8f0f41e236 pythonrc: Add various frequently handy imports. 2024-03-27 12:49:24 -07:00
Anders Kaseorg 9015cd7da3 apt-repos: Use Ubuntu 22.04 Teleport repo on Ubuntu 22.04.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2024-03-25 17:57:24 -04:00
Tim Abbott 2980d14cb4 scripts: Use Apache Arrow from Groonga repository.
This lets us avoid CI failures related to that repository's signing
key having expired. See https://github.com/apache/arrow/issues/40744.
2024-03-24 20:46:24 -07:00
Anders Kaseorg a1a341f0ae ruff: Fix UP032 Use f-string instead of `format` call.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-21 08:59:17 -07:00
Alex Vandiver c13e3dee24 katex: Replace subprocess call with minimal external service.
Replace a separate call to subprocess, starting `node` from scratch,
with an optional standalone node Express service which performs the
rendering.  In benchmarking, this reduces the overhead of a KaTeX call
from 120ms to 2.8ms.  This is notable because enough calls to KaTeX in
a single message would previously time out the whole message
rendering.

The service is optional because he majority of deployments do not use
enough LaTeX to merit the additional memory usage (60Mb).

Fixes: #17425.
2024-03-15 15:34:12 -07:00
Alex Vandiver 0f70ab7679 config: Use logic from zulip_tools, to support bools. 2024-03-15 15:34:12 -07:00
Alex Vandiver b36f389e9e zulip_tools: Make default default_value be None, not "". 2024-03-15 15:34:12 -07:00
Alex Vandiver f9f9392b93 zulip_tools: Unify get_config and get_config_bool using overloads. 2024-03-15 15:34:12 -07:00
Alex Vandiver 0ff1fb2e21 zulip_tools: Support non-lowercase true values.
This matches the ruby implementation.
2024-03-15 15:34:12 -07:00
Alex Vandiver 3905416a0e zulip_tools: Fix path to zulipconf.rb.
This was moved in 16aa7c0923.
2024-03-15 15:34:12 -07:00
Alex Vandiver e0cf82a526 email-mirror-postfix: Use get_config_bool, instead of checking "true". 2024-03-15 15:34:12 -07:00
Alex Vandiver 5123477d55 upgrade-zulip-from-git: Provide a flag to use a local branch.
While this could be done previously by calling
`upgrade-zulip-from-git --remote-url /srv/zulip.git`, the explicit
argument makes this more straightforward, and avoids churning the
`refs/remotes/origin/` namespace.
2024-03-08 12:15:25 -08:00
Alex Vandiver b0283c42f9 create-database: Treat "zulip" db without "zerver_messages" as empty.
A user who somehow got an empty `zulip` database, but without a
`zerver_messages` table in it, would get stuck in the installer at:

```
++ su postgres -c 'cd / && psql -v ON_ERROR_STOP=1 -Atc '\''SELECT COUNT(*) FROM zulip.zerver_message;'\'' zulip'
ERROR:  relation "zulip.zerver_message" does not exist
LINE 1: SELECT COUNT(*) FROM zulip.zerver_message;
                             ^
+ records=
```

Treat a failure to select from `zerver_messages` as having 0 messages,
and continue with the `DROP DATABASE IF EXISTS` / `CREATE DATABASE`
that `create-db.sql` usually does.

Fixes: #29110.
2024-03-08 10:10:19 -08:00
Anders Kaseorg 066ea3ebf9 install: Support Ubuntu 24.04.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-01 17:38:08 -08:00
Anders Kaseorg 55954c9819 build-pgroonga: Upgrade PGroonga from 3.1.0 to 3.1.8.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-01 17:38:08 -08:00
Alex Vandiver 3480d204de reload-clients: Log how many reload events were actually sent. 2024-03-01 09:31:20 -08:00
Alex Vandiver 2d59e07e58 reload-clients: Only sleep between batches.
This avoids an unnecessary sleep at the end of all of the Tornado
shards.
2024-03-01 09:31:20 -08:00
Anders Kaseorg 82a9fd927b ruff: Fix E226 Missing whitespace around arithmetic operator.
This is a preview rule, not yet enabled by default.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-01 09:30:04 -08:00
Anders Kaseorg 553f268b04 ruff: Fix RUF027 Possible f-string without an `f` prefix.
This is a preview rule, not yet enabled by default.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-01 09:30:04 -08:00
Anders Kaseorg 865febb307 ruff: Fix RUF021 Parenthesize when chaining `and` and `or` together.
This is a preview rule, not yet enabled by default.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-01 09:30:04 -08:00
Anders Kaseorg 570f3dd447 python: Reformat with Ruff formatter.
https://docs.astral.sh/ruff/formatter/

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-02-29 17:07:16 -08:00
Alex Vandiver 175e61486e log-search: Auto-limit to the correct logfile when searching datetimes. 2024-02-27 17:04:03 -08:00
Alex Vandiver 9eaaacba52 log-search: Return the filter terms, rather than changing them.
This leaves `args.filter_terms` as the raw values the user specified,
before they may have been transformed to the shape that we use for
substring matching.
2024-02-27 17:04:03 -08:00
Alex Vandiver 39a7c5d106 log-search: Add datetime prefix limit. 2024-02-27 17:04:03 -08:00
Alex Vandiver 281b74a264 log-search: Factor out nginx date conversion. 2024-02-27 17:04:03 -08:00
Alex Vandiver bdc210702c log-search: Document HTTP method limits. 2024-02-27 17:04:03 -08:00
Alex Vandiver 2122780d41 log-search: Fix attempts to limit to events requests in Django logs. 2024-02-26 08:19:57 -08:00
Alex Vandiver b7e42ca17a log-search: Support user-agent / client limit. 2024-02-26 08:19:57 -08:00
Alex Vandiver 9ca0cd9bbd log-search: Remove old /report/ endpoints. 2024-02-26 08:19:57 -08:00
Anders Kaseorg 94cf99bcf2 install-node: Upgrade Node.js from 20.9.0 to 20.11.1.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-02-22 12:46:40 -08:00
Alex Vandiver ec6f64f7b0 tornado: Perform rolling client restarts after servers are restarted.
Decouple the sending of client restart events from the restarting of
the servers.  Restarts use the new Tornado restart-clients endpoint to
inject "restart" events into queues of clients which were loaded from
the previous Tornado process.  The rate is controlled by the
`application_server.client_restart_rate`, in clients per minute, or a
flag to `restart-clients` which overrides it.  Note that a web client
will also spread its restart over 5 minutes, so artificially-slow
client restarts are generally not very necessary.

Restarts of clients are deferred to until after post-deploy hooks are
run, such that the pre- and post- deploy hooks are around the actual
server restarts, even if pushing restart events to clients takes
significant time.
2024-02-15 15:42:50 -08:00
Alex Vandiver 27d53ecbe1 restart-server: Remove --skip-tornado flag.
This flag was generally used not because we wanted to avoid
restarting Tornado, but because we wanted to avoid increasing load
the server when all of the clients were told to reload.

Since we have laid the groundwork for separately telling Tornado to
tell clients to restart, we remove the --skip-tornado flag; the next
commit will add the ability to skip client restarts.
2024-02-15 15:42:50 -08:00
Alex Vandiver e6fa1f5436 email_mirror_message: Move endpoint under /api/internal/.
This also has the side effect that it saves the endpint from being
improperly redirected by the HostDomainMiddleware's canonicalization
code.
2024-02-15 15:42:50 -08:00
Alex Vandiver 0115fa9c60 start-server/restart-server: Drop privileges if necessary.
Rather than tell the user to re-run the command as `zulip` instead of
`root`, do the privilege-dropping ourselves.
2024-02-07 12:33:00 -08:00
Alex Vandiver 24d3832926 teleport: Upgrade to Teleport 14. 2024-01-31 16:41:04 -08:00
Anders Kaseorg 93198a19ed requirements: Upgrade Python requirements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-01-29 10:41:54 -08:00
Alex Vandiver 5786a38cec log-search: Match against path without query parameters.
The nginx logs have query parameters; display them, but do not use
them for URL matching.
2024-01-26 09:02:00 -08:00
Alex Vandiver 1ba2f39854 install: Support PostgreSQL 16. 2023-12-23 14:57:12 -08:00
Anders Kaseorg a13e42f18a docs: Add missing spaces around code spans.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-12-14 00:05:44 -08:00
Anders Kaseorg 223b626256 python: Use urlsplit instead of urlparse.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-12-05 13:03:07 -08:00
Anders Kaseorg 8a7916f21a python: Consistently use from…import for datetime.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-12-05 12:01:18 -08:00
Alex Vandiver 7c8eacfa12 queue: Increase paging thresholds for deferred_work queue.
This queue is used to things which definitionally may take longer than
a request, so paging after 60s is rather aggressive.  This is
especially true because this queue has a very long tail of very slow
tasks -- p99 of task time in this queue is 8.5s, while p99.9 is 197s.

Raise the paging threshold to 15 minutes.  While there are
semi-user-facing tasks which use this queue (primarily marking
messages as read), those being delayed for minutes is already a real
possibility if they are stuck behind a large realm export -- and this
is not a situation which should necessarily page, since it is not
solvable by the administrator.
2023-11-09 13:51:00 -08:00
Anders Kaseorg dcdbb39c31 install-node: Upgrade Node.js from 18.18.0 to 20.9.0.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-11-08 16:11:15 -08:00
Alex Vandiver fb80ecd9c3 upgrade-zulip: Defer cache-filling to just outside the critical period.
Filling caches needs to happen close to when the server is restarted,
as the gap opens us up to race conditions with user modifications.  If
there are migrations, however, it must happen within the critical
period after the migrations are applied.

Move the call to fill the caches to within the `shutdown_server`
function, so that we push it as close to the server shutdown as
possible.
2023-11-08 11:00:00 -08:00
Anders Kaseorg a50eb2e809 mypy: Enable new error explicit-override.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-12 12:28:41 -07:00
Anders Kaseorg d257002ad8 scripts: Use setup_path in restart-server, stop-server.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-12 12:28:41 -07:00
Anders Kaseorg cc07b8c79c install-node: Upgrade Node.js from 18.17.1 to 18.18.0.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-09 14:16:23 -07:00
Anders Kaseorg 835ee69c80 docs: Fix grammar errors found by mwic.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-10-09 13:24:09 -07:00
Alex Vandiver 2057057be4 pgroonga: Do not attempt to configure pgroonga without a database.
This can happen if `machine.pgroonga` is set during initial
installation.  We cannot run `CREATE EXTENSION PGROONGA` because the
database that we need to run that statement in does not exist yet;
make the command a silent no-op that does not create the
`pgroonga_setup.sql.applied` flag file, such that a later
`zulip-puppet-apply` once the database exists can pick up and install
the extension.
2023-09-22 11:45:00 -07:00
Anders Kaseorg 2665a3ce2b python: Elide unnecessary list wrappers.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-09-13 12:41:23 -07:00
evykassirer eff0a73925 emoji: Add unified_reactions.json to the sha1sum. 2023-09-13 12:40:59 -07:00
Anders Kaseorg 81bd63cb46 ruff: Fix PIE808 Unnecessary `start` argument in `range`.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-09-01 14:57:01 -07:00
Anders Kaseorg ead7b9177a check-database-compatibility: Ignore twofactor typo.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-08-23 22:14:26 -07:00
shu.chen 321776ac49
provision: Add provision support for Fedora 38.
Tweaked provision script to run successfully in Fedora 38 and
included a script to build the groonga libs from source because
the packages in Fedora repos are outdated.

There is a major version jump from the last supported version (F34)
which is EOL so references and support for older versions were
removed.

Fixes: #20635
2023-08-22 11:26:29 -07:00
Anders Kaseorg 344bfbf539 install-node: Upgrade Node.js from 18.17.0 to 18.17.1.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-08-17 18:16:47 -07:00
Anders Kaseorg c43629a222 ruff: Fix PLW1510 `subprocess.run` without explicit `check` argument.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-08-17 17:05:34 -07:00
David Rosa d205850d54 docs: Update .html links pointing to "Upgrade Zulip" or "Modify Zulip".
Follow-up to #24089.
2023-08-11 16:49:32 -07:00
Anders Kaseorg e932e2ce52 ruff: Fix UP032 Use f-string instead of `format` call.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-08-02 15:58:55 -07:00
Anders Kaseorg 5ccb408f19 build-pgroonga: Upgrade PGroonga from 3.0.3 to 3.1.0.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-07-25 17:33:42 -07:00
n0099 2b1d250154 nginx: Switch from `$host` to `$http_host` for HTTP/3 compatibility.
nginx sets the value of the `$http_host` variable to the empty string
when using http/3, as there is technically no `Host:` header sent:
https://github.com/nginx-quic/nginx-quic/issues/3

Users with a browser that support http/3 will send their first request
to nginx with http/2, and get an expected HTTP 200 -- but any
subsequent requests will fail with am HTTP 400, since the browser will
have upgraded to http/3, which has an empty `Host` header, which Zulip
rejects.

Switch to the `$host` variable, which works for all HTTP versions.

Co-authored-by: Alex Vandiver <alexmv@zulip.com>
2023-07-25 18:20:34 -04:00
Anders Kaseorg 2ae285af7c ruff: Fix PLR1714 Consider merging multiple comparisons.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-07-23 15:21:33 -07:00
Anders Kaseorg e890033f76 install-node: Upgrade Node.js from 18.16.0 to 18.17.0.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-07-21 15:58:42 -07:00
Anders Kaseorg b285813beb error_notify: Remove custom email error reporting handler.
Restore the default django.utils.log.AdminEmailHandler when
ERROR_REPORTING is enabled.  Those with more sophisticated needs can
turn it off and use Sentry or a Sentry-compatible system.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-07-20 11:00:09 -07:00
Alex Vandiver 1accc6929e upgrade: Check PostgreSQL versions after venv setup.
The claim in the comment from c8ec3dfcf6, that we can and should use
the current deploy's venv, misses one key case -- when upgrading the
operating system, the current deploy's venv is unworkable, since it
was configured for a previous version of Python.  As such, any attempt
to load Django to verify the version of PostgreSQL it is talking to
must happen after the venv is configured.

Move the database version check into
`scripts/lib/check-database-compatibility`, which also moves it after
the new venv is configured.

Because we no longer reliably know, at `apt-get upgrade` time, what
version of PostgreSQL is installed, we hold all versions of the
pgroonga packages.
2023-07-19 14:19:28 -07:00
Alex Vandiver 3bf83e8830 log-search: Prevent BrokenPipeError exceptions when run with `head`.
See https://docs.python.org/3/library/signal.html#note-on-sigpipe
2023-07-13 11:53:42 -07:00
Alex Vandiver 695295421a puppet: Upgrade Teleport to the 13.x series. 2023-07-13 11:46:51 -07:00
Alex Vandiver f5540303ba pgroonga: Remove 'GRANT USAGE' statement again.
dc2726c814 removed these statements, but c8ec3dfcf6 accidentally
brought one back.  Remove it.
2023-06-26 10:47:17 -04:00
Alex Vandiver ec4bfd7c78 install: Use the initially-cloned repo as the base /srv/zulip.git.
This ensures that the next `upgrade-zulip-from-git` has access to the
commit history of the initial install, if it was from a forked
repository.  `/home/zulip/deployments/current` and `/srv/zulip.git`
are not quite organized into the steady-state that they will have
after one `upgrade-zulip-from-git`:
 - `/home/zulip/deployments/current` is its own clone, not a worktree
 - `/srv/zulip.git` has an origin of `/home/zulip/deployments/current`
 - `remote.origin.mirror` is set on `/srv/zulip.git`
 - `remote.origin.fetch` is `+refs/*:refs/*`

All but the first are automatically cleaned up by
`upgrade-zulip-from-git` when it is next run, using the code added in
30457ecd02.  The additional complexity of making an existing
independent clone into a worktree seem not worth solving the first
point.
2023-06-24 07:43:04 -07:00
Alex Vandiver 1276653ec8 upgrade-zulip: The "git rev-parse" command can parse "git describe" output directly. 2023-06-24 07:43:04 -07:00
Alex Vandiver c8ec3dfcf6 pgroonga: Run upgrade SQL when pgroonga package is updated.
Updating the pgroonga package is not sufficient to upgrade the
extension in PostgreSQL -- an `ALTER EXTENSION pgroonga UPDATE` must
explicitly be run[^1].  Failure to do so can lead to unexpected behavior,
including crashes of PostgreSQL.

Expand on the existing `pgroonga_setup.sql.applied` file, to track
which version of the PostgreSQL extension has been configured.  If the
file exists but is empty, we run `ALTER EXTENSION pgroonga UPDATE`
regardless -- if it is a no-op, it still succeeds with a `NOTICE`:

```
zulip=# ALTER EXTENSION pgroonga UPDATE;
NOTICE:  version "3.0.8" of extension "pgroonga" is already installed
ALTER EXTENSION
```

The simple `ALTER EXTENSION` is sufficient for the
backwards-compatible case[^1] -- which, for our usage, is every
upgrade since 0.9 -> 1.0.  Since version 1.0 was released in 2015,
before pgroonga support was added to Zulip in 2016, we can assume for
the moment that all pgroonga upgrades are backwards-compatible, and
not bother regenerating indexes.

Fixes: #25989.

[^1]: https://pgroonga.github.io/upgrade/
2023-06-23 14:40:27 -07:00
Alex Vandiver dc2726c814 pgroonga: Remove now-unnecessary 'GRANT USAGE' statement.
This was only necessary for PGroonga 1.x, and the `pgroonga` schema
will most likely be removed at some point inthe future, which will
make this statement error out.

Drop the unnecessary statement.
2023-06-23 14:40:27 -07:00
Alex Vandiver 875502b2e1 upgrade-postgresql: Only upgrade to a supported version. 2023-06-12 16:37:55 -07:00
Alex Vandiver a472667ca1 upgrade-zulip: Verify postgresql.version against where data is stored.
This prevents installing a PostgreSQL server which matches
/etc/zulip/zulip.conf but which has no data and is not used by Django.
2023-06-07 14:59:54 -07:00
Alex Vandiver b9210e3ed9 upgrade-zulip: Set postgresql.version from running version, not a guess. 2023-06-07 14:59:54 -07:00
Alex Vandiver 6dc8f748ae upgrade-zulip: Simplify PostgreSQL version check.
This is much simpler now that we do not support PostgreSQL 9.x.
2023-06-07 14:59:54 -07:00
Alex Vandiver 1f68726cb8 upgrade-postgresql: Prevent upgrades if /etc/zulip/zulip.conf is wrong.
If the `postgresql.version` in `/etc/zulip/zulip.conf` is out of date
or wrong, upgrading to the actual current version would drop your
production database without prompting.  While we do document taking a
Zulip backup (which includes a database backup) before running
`upgrade-postgresql`[^1], not everyone does so, with possibly
catastrophic consequences.

Do a true end-to-end check of the version in `/etc/zulip/zulip.conf`
by asking Django to query the database for its version, checking that
against the configured value, and aborting if there is any
disagreement.

[^1]: https://zulip.readthedocs.io/en/latest/production/upgrade.html#upgrading-postgresql
2023-06-07 14:59:54 -07:00
Alex Vandiver 32e1384ca0 upgrade-postgresql: Prevent PostgreSQL downgrades. 2023-06-07 14:59:54 -07:00
Alex Vandiver 501d38b781 upgrade-postgresql: Check for undefined variables. 2023-06-07 14:59:54 -07:00
Anders Kaseorg f3684e842a install: Check CPU and OS architecture.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-06-01 17:09:48 -07:00
Anders Kaseorg 37040ac49d install: Add system_requirements_failure helper.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-06-01 17:09:48 -07:00