#!/usr/bin/env bash
# This tests installing the pgroonga extension
set -e
set -x

crudini --set /etc/zulip/zulip.conf machine pgroonga enabled
/home/zulip/deployments/current/scripts/zulip-puppet-apply -f
echo 'USING_PGROONGA = True' >>/etc/zulip/settings.py
su zulip -c '/home/zulip/deployments/current/manage.py migrate pgroonga'

su zulip -c /home/zulip/deployments/current/scripts/restart-server

echo 'Installation of pgroonga complete!'
exit 0
