mirror of https://github.com/zulip/zulip.git
installer: Write PostgreSQL version based on puppet classes.
Using `/etc/init.d/postgresql` as the detection of if Postgres is on the server is incorrect, because this line runs _before_ puppet and any packages are installed. Thus, it cannot tell the difference between a new Ubuntu one-host first-time-install without PostgreSQL yet, and one which is merely a front-end and will never have PostgreSQL. This leads to failures in first-time installs: ``` Error: Evaluation Error: Error while evaluating a Function Call, Could not find template 'zulip/postgresql//postgresql.conf.template.erb' ``` The only way to detect if PostgreSQL will be present in the _end_ state of the install is to examine the puppet classes that are applied. To do this, we must inspect `PUPPET_CLASSES`. Unfortunately, this can be fragile to subclassing (e.g. `zulip_ops::postgres_appdb`). We might desire to use `puppet apply --write-catalog-summary` to deduce the _applied_ classes, which would unroll the inheritance; however, this causes a chicken-and-egg problem, because `zulip.conf` must be already written out (including a value for `postgresql.version`, if necessary!) before such a puppet run could successfully complete. Switch to predicating the `postgresql.version` key on the puppet classes that are known to install postgres.
This commit is contained in:
parent
253246185f
commit
ca9d27175b
|
@ -329,15 +329,17 @@ auto_renew = yes
|
|||
EOF
|
||||
fi
|
||||
|
||||
if [ -e "/etc/init.d/postgresql" ]; then
|
||||
if [ "$package_system" = apt ]; then
|
||||
cat <<EOF
|
||||
case ",$PUPPET_CLASSES," in
|
||||
*,zulip::voyager,* | *,zulip::postgres_appdb_tuned,*)
|
||||
if [ "$package_system" = apt ]; then
|
||||
cat <<EOF
|
||||
|
||||
[postgresql]
|
||||
version = 12
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
) > /etc/zulip/zulip.conf
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in New Issue