mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	puppet: Apply basic PostgreSQL configuration before pg_upgradecluster.
Running `pg-upgradecluster` runs the `CREATE TEXT SEARCH DICTIONARY` and `CREATE TEXT SEARCH CONFIGURATION` from `zerver/migrations/0001_initial.py` on the new PostgreSQL cluster; this requires that the stopwords file and dictionary exist _prior_ to `pg_upgradecluster` being run. This causes a minor dependency conflict -- we do not wish to duplicate the functionality from `zulip::postgres_appdb_base` which configures those files, but installing all of `zulip::postgres_appdb_tuned` will attempt to restart PostgreSQL -- which has not configured the cluster for the new version yet. In order to split out configuration of the prerequisites for the application database, and the steps required to run it, we need to be able to apply only part of the puppet configuration. Use the newly-added `--config` argument to provide a more limited `zulip.conf` which only applies `zulip::postgres_appdb_base` to the new version of Postgres, creating the required tsearch data files. This also preserves the property that a failure at any point prior to the `pg_upgradecluster` is easily recoverable, by re-running `zulip-puppet-apply`.
This commit is contained in:
		
				
					committed by
					
						
						Alex Vandiver
					
				
			
			
				
	
			
			
			
						parent
						
							17002f2a0e
						
					
				
				
					commit
					0d7dbd1b07
				
			@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user