diff --git a/puppet/kandra/files/hooks/post-deploy.d/restart_mirror_to_czo.hook b/puppet/kandra/files/hooks/post-deploy.d/restart_mirror_to_czo.hook new file mode 100644 index 0000000000..e77825e1bf --- /dev/null +++ b/puppet/kandra/files/hooks/post-deploy.d/restart_mirror_to_czo.hook @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -e +set -u + +# This script uses `uv run`, and thus uses the production venv. This +# means that we need to make sure that we restart into the new venv, +# so we don't start to error when the old venv gets garbage collected. +supervisorctl restart mirror_to_czo:* diff --git a/puppet/kandra/files/mirror_to_czo b/puppet/kandra/files/mirror_to_czo index 8705daadee..ac6db5bf41 100755 --- a/puppet/kandra/files/mirror_to_czo +++ b/puppet/kandra/files/mirror_to_czo @@ -6,6 +6,8 @@ import time from contextlib import suppress from typing import Any +# This import (and its dependencies) come from the production venv, +# because we use `uv run` to execute this script. import zulip config_file = configparser.RawConfigParser() diff --git a/puppet/kandra/manifests/mirror_to_czo.pp b/puppet/kandra/manifests/mirror_to_czo.pp index d0af207e3c..94d7076a2e 100644 --- a/puppet/kandra/manifests/mirror_to_czo.pp +++ b/puppet/kandra/manifests/mirror_to_czo.pp @@ -1,4 +1,5 @@ class kandra::mirror_to_czo { + include zulip::hooks::base include zulip::supervisor # We embed the hash of the contents into the name of the process, so @@ -28,4 +29,6 @@ class kandra::mirror_to_czo { content => template('kandra/supervisor/conf.d/mirror_to_czo.conf.template.erb'), notify => Service[supervisor], } + + kandra::hooks::file { 'post-deploy.d/restart_mirror_to_czo.hook': } }