zulip / docker-zulip

Container configurations, images, and examples for Zulip.
https://zulip.com/
Apache License 2.0
550 stars 227 forks source link

Cannot execute `manage.py backup` due to PostgreSQL version mismatch between server and client #447

Open xentec opened 1 week ago

xentec commented 1 week ago

The official zulip-postgresql image is at v14, but the Postgres inside docker-zulip:8.4-0 jumped to v16 for some reason. Since the manage.py backup command uses the server version to find the pg_dump utility, it fails:

$ sudo podman exec -it chat /usr/bin/sudo -u zulip -- /home/zulip/deployments/current/manage.py backup
+ /usr/lib/postgresql/14/bin/pg_dump --format=directory --file=/tmp/zulip-backup-2024-06-27-22-44-59-s22gb7mi/zulip-backup/database --username=zulip --dbname=zulip --no-password --host=localhost --port=5432
Traceback (most recent call last):
  File "/home/zulip/deployments/current/manage.py", line 151, in <module>
    execute_from_command_line(sys.argv)
  File "/home/zulip/deployments/current/manage.py", line 116, in execute_from_command_line
    utility.execute()
  File "/srv/zulip-venv-cache/bbd84a06bc651effedfe39cab337a1bf300cee02/zulip-py3-venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/srv/zulip-venv-cache/bbd84a06bc651effedfe39cab337a1bf300cee02/zulip-py3-venv/lib/python3.8/site-packages/django/core/management/base.py", line 412, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/srv/zulip-venv-cache/bbd84a06bc651effedfe39cab337a1bf300cee02/zulip-py3-venv/lib/python3.8/site-packages/django/core/management/base.py", line 458, in execute
    output = self.handle(*args, **options)
  File "/home/zulip/deployments/2024-05-09-18-59-10/zerver/management/commands/backup.py", line 90, in handle
    run(
  File "/home/zulip/deployments/2024-05-09-18-59-10/scripts/lib/zulip_tools.py", line 256, in run
    subprocess.check_call(args, **kwargs)
  File "/usr/lib/python3.8/subprocess.py", line 359, in check_call
    retcode = call(*popenargs, **kwargs)
  File "/usr/lib/python3.8/subprocess.py", line 340, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/usr/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1704, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/lib/postgresql/14/bin/pg_dump'

Because the local version is higher than v14:

$ sudo podman exec -it chat /usr/bin/sudo -u zulip -- ls /usr/lib/postgresql
16

Here are all the Zulip OCI images I use:

$ sudo podman ps
CONTAINER ID  IMAGE                                   COMMAND               CREATED       STATUS                 PORTS                     NAMES
f95ea66d20c7  docker.io/zulip/zulip-postgresql:14     postgres              25 hours ago  Up 25 hours            0.0.0.0:8001->80/tcp      chat-db
9c40e226d21b  docker.io/library/redis:alpine          /etc/redis.conf       25 hours ago  Up 25 hours            0.0.0.0:8001->80/tcp      chat-cache
dfcbe4eecc1f  docker.io/library/rabbitmq:3.7.7        rabbitmq-server       25 hours ago  Up 25 hours            0.0.0.0:8001->80/tcp      chat-mqueue
791073df1bc9  docker.io/zulip/docker-zulip:8.4-0      /bin/sh -c /home/...  25 hours ago  Up 25 hours            0.0.0.0:8001->80/tcp      chat

How should we fix this?