mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 23:13:25 +00:00
install: Clean up some shell style: use here-docs, and compact getopt.
This commit is contained in:
@@ -20,36 +20,14 @@ args="$(getopt -o '' --long help,self-signed-cert,certbot,hostname:,email:,expre
|
|||||||
eval "set -- $args"
|
eval "set -- $args"
|
||||||
while true; do
|
while true; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--help)
|
--help) show_help=1; shift;;
|
||||||
show_help=1
|
--self-signed-cert) SELF_SIGNED_CERT=1; shift;;
|
||||||
shift
|
--certbot) USE_CERTBOT=1; shift;;
|
||||||
;;
|
--hostname) EXTERNAL_HOST="$2"; shift; shift;;
|
||||||
--self-signed-cert)
|
--email) ZULIP_ADMINISTRATOR="$2"; shift; shift;;
|
||||||
SELF_SIGNED_CERT=1
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
--certbot)
|
|
||||||
USE_CERTBOT=1
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
--hostname)
|
|
||||||
EXTERNAL_HOST="$2"
|
|
||||||
shift
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
--email)
|
|
||||||
ZULIP_ADMINISTRATOR="$2"
|
|
||||||
shift
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
--express) # experimental, not documented
|
--express) # experimental, not documented
|
||||||
EXPRESS_SETUP=1
|
EXPRESS_SETUP=1; shift;;
|
||||||
shift
|
--) shift; break;;
|
||||||
;;
|
|
||||||
--)
|
|
||||||
shift
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -125,11 +103,14 @@ if [ "$PUPPET_CLASSES" = "zulip::voyager" ] && [ -z "$USE_CERTBOT""$SELF_SIGNED_
|
|||||||
for f in "/etc/ssl/private/zulip.key" "/etc/ssl/certs/zulip.combined-chain.crt"; do
|
for f in "/etc/ssl/private/zulip.key" "/etc/ssl/certs/zulip.combined-chain.crt"; do
|
||||||
[ -e "$f" ] || echo " - $f is missing!"
|
[ -e "$f" ] || echo " - $f is missing!"
|
||||||
done
|
done
|
||||||
echo "See https://zulip.readthedocs.io/en/latest/production/ssl-certificates.html for help."
|
cat <<EOF
|
||||||
echo "For non-production testing, try the --self-signed-cert option."
|
|
||||||
echo
|
See https://zulip.readthedocs.io/en/latest/production/ssl-certificates.html for help.
|
||||||
echo "Once fixed, just rerun scripts/setup/install; it'll pick up from here!"
|
For non-production testing, try the --self-signed-cert option.
|
||||||
echo
|
|
||||||
|
Once fixed, just rerun scripts/setup/install; it'll pick up from here!
|
||||||
|
|
||||||
|
EOF
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -158,7 +139,11 @@ fi
|
|||||||
# puppet apply
|
# puppet apply
|
||||||
mkdir -p /etc/zulip
|
mkdir -p /etc/zulip
|
||||||
(
|
(
|
||||||
echo -e "[machine]\npuppet_classes = $PUPPET_CLASSES\ndeploy_type = $DEPLOYMENT_TYPE";
|
cat <<EOF
|
||||||
|
[machine]
|
||||||
|
puppet_classes = $PUPPET_CLASSES
|
||||||
|
deploy_type = $DEPLOYMENT_TYPE
|
||||||
|
EOF
|
||||||
|
|
||||||
# Note: there are four dpkg-query outputs to consider:
|
# Note: there are four dpkg-query outputs to consider:
|
||||||
#
|
#
|
||||||
@@ -176,11 +161,19 @@ mkdir -p /etc/zulip
|
|||||||
# (There are more possibilities in the case of dpkg errors.) Here
|
# (There are more possibilities in the case of dpkg errors.) Here
|
||||||
# we are checking for either empty or not-installed.
|
# we are checking for either empty or not-installed.
|
||||||
if [ -n "$TRAVIS" ] || ! dpkg-query --showformat '${Status}\n' -W rabbitmq-server 2>/dev/null | grep -vq ' not-installed$'; then
|
if [ -n "$TRAVIS" ] || ! dpkg-query --showformat '${Status}\n' -W rabbitmq-server 2>/dev/null | grep -vq ' not-installed$'; then
|
||||||
echo -e "\n[rabbitmq]\nnodename = zulip@localhost"
|
cat <<EOF
|
||||||
|
|
||||||
|
[rabbitmq]
|
||||||
|
nodename = zulip@localhost
|
||||||
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$USE_CERTBOT" ]; then
|
if [ -n "$USE_CERTBOT" ]; then
|
||||||
echo -e "\n[certbot]\nauto_renew = yes"
|
cat <<EOF
|
||||||
|
|
||||||
|
[certbot]
|
||||||
|
auto_renew = yes
|
||||||
|
EOF
|
||||||
fi
|
fi
|
||||||
) > /etc/zulip/zulip.conf
|
) > /etc/zulip/zulip.conf
|
||||||
"$ZULIP_PATH"/scripts/zulip-puppet-apply -f
|
"$ZULIP_PATH"/scripts/zulip-puppet-apply -f
|
||||||
@@ -211,14 +204,16 @@ if [ "$has_nginx" = 0 ]; then
|
|||||||
# Most common failure mode is certs not having been installed.
|
# Most common failure mode is certs not having been installed.
|
||||||
nginx -t || (
|
nginx -t || (
|
||||||
set +x
|
set +x
|
||||||
echo
|
cat <<EOF
|
||||||
echo "Verifying the Zulip nginx configuration failed!"
|
|
||||||
echo
|
Verifying the Zulip nginx configuration failed!
|
||||||
echo "This is almost always a problem with your SSL certificates."
|
|
||||||
echo "See https://zulip.readthedocs.io/en/latest/production/ssl-certificates.html for help"
|
This is almost always a problem with your SSL certificates. See:
|
||||||
echo
|
https://zulip.readthedocs.io/en/latest/production/ssl-certificates.html
|
||||||
echo "Once fixed, just rerun scripts/setup/install; it'll pick up from here!"
|
|
||||||
echo
|
Once fixed, just rerun scripts/setup/install; it'll pick up from here!
|
||||||
|
|
||||||
|
EOF
|
||||||
exit 1
|
exit 1
|
||||||
)
|
)
|
||||||
service nginx restart
|
service nginx restart
|
||||||
@@ -248,12 +243,14 @@ fi
|
|||||||
if [ "$has_rabbit" = 0 ]; then
|
if [ "$has_rabbit" = 0 ]; then
|
||||||
if ! rabbitmqctl status >/dev/null; then
|
if ! rabbitmqctl status >/dev/null; then
|
||||||
set +x
|
set +x
|
||||||
echo; echo "RabbitMQ seems to not have started properly after the installation process."
|
cat <<EOF
|
||||||
echo "Often, this can be caused by misconfigured /etc/hosts in virtualized environments"
|
|
||||||
echo "See https://github.com/zulip/zulip/issues/53#issuecomment-143805121"
|
RabbitMQ seems to not have started properly after the installation process.
|
||||||
echo "for more information"
|
Often this is caused by misconfigured /etc/hosts in virtualized environments.
|
||||||
echo
|
For more information, see:
|
||||||
set -x
|
https://github.com/zulip/zulip/issues/53#issuecomment-143805121
|
||||||
|
|
||||||
|
EOF
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
"$ZULIP_PATH"/scripts/setup/configure-rabbitmq
|
"$ZULIP_PATH"/scripts/setup/configure-rabbitmq
|
||||||
|
|||||||
Reference in New Issue
Block a user