Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

puppet: Apply basic PostgreSQL configuration before pg_upgradecluster.

Alex Vandiver0d7dbd1b07dc
diff --git a/docs/production/upgrade-or-modify.md b/docs/production/upgrade-or-modify.md
index a2a9972b268..575d50e52e1 100644
--- a/docs/production/upgrade-or-modify.md
+++ b/docs/production/upgrade-or-modify.md
@@ -378,12 +378,6 @@ To upgrade the version of PostgreSQL on the Zulip server:
/home/zulip/deployments/current/scripts/setup/upgrade-postgres
```
- During this step, it is normal to see output containing:
- ```
- ERROR: could not open stop-word file "/usr/share/postgresql/12/tsearch_data/zulip_english.stop": No such file or directory
- ERROR: text search dictionary "zulip.english_us_hunspell" does not exist
- ```
-
That last command will finish by restarting your Zulip server; you
should now be able to navigate to its URL and confirm everything is
working correctly.
diff --git a/scripts/setup/upgrade-postgres b/scripts/setup/upgrade-postgres
index 62450e00846..ab442ffd946 100755
--- a/scripts/setup/upgrade-postgres
+++ b/scripts/setup/upgrade-postgres
@@ -27,10 +27,25 @@ fi
# the pg_upgradecluster command fails if it is still running
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=759725
pg_ctlcluster "$UPGRADE_FROM" main stop
+
+(
+ # Two-stage application of puppet; we apply the bare-bones
+ # postgresql configuration first, so that FTS will be configured
+ # prior to the pg_upgradecluster.
+ TEMP_CONF_DIR=$(mktemp -d)
+ cp /etc/zulip/zulip.conf "$TEMP_CONF_DIR"
+ ZULIP_CONF="${TEMP_CONF_DIR}/zulip.conf"
+ crudini --set "$ZULIP_CONF" postgresql version "$UPGRADE_TO"
+ crudini --set "$ZULIP_CONF" machine puppet_classes zulip::base,zulip::postgres_appdb_base
+ touch "/usr/share/postgresql/$UPGRADE_TO/pgroonga_setup.sql.applied"
+
+ "$ZULIP_PATH"/scripts/zulip-puppet-apply -f --config "$ZULIP_CONF"
+ rm -rf "$TEMP_CONF_DIR"
+)
+
pg_upgradecluster "$UPGRADE_FROM" main
crudini --set /etc/zulip/zulip.conf postgresql version "$UPGRADE_TO"
-touch "/usr/share/postgresql/$UPGRADE_TO/pgroonga_setup.sql.applied"
"$ZULIP_PATH"/scripts/zulip-puppet-apply -f
service memcached restart