mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
install-aws-server: Switch to getopt.
This commit is contained in:
@@ -2,33 +2,68 @@
|
|||||||
set -eu
|
set -eu
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
SERVER=${1:-}
|
usage() {
|
||||||
ROLES=${2:-}
|
cat <<EOF
|
||||||
BRANCH=${3:-}
|
USAGE: $0 [--roles=roles] [--branch=main] server
|
||||||
if [ -z "$SERVER" ] || [ -z "$ROLES" ]; then
|
|
||||||
echo "USAGE: $0 server roles [branch]"
|
Installs an empty Ubuntu server in AWS with a Zulip server role.
|
||||||
echo
|
|
||||||
echo "Installs an empty Ubuntu server in AWS with a Zulip server role."
|
* server is the local part of the hostname (e.g. postgres0)
|
||||||
echo
|
|
||||||
echo " * server is the local part of the hostname (e.g. postgres0)"
|
* roles is a comma-separated list of Puppet profile names; these
|
||||||
echo " * roles is a comma-separated list of Puppet profile names; these"
|
will get 'zulip_ops::profile::' prepended to them, and passed
|
||||||
echo " will get 'zulip_ops::profile::' prepended to them, and passed"
|
to scripts/lib/install -- e.g. 'postgresql'
|
||||||
echo " to scripts/lib/install -- e.g. 'postgresql'"
|
* branch is used to override the default branch to install from.
|
||||||
echo " * branch is used to override the default branch to install from."
|
|
||||||
echo
|
Reads configuration from $HOME/.zulip-install-server.conf, which should look like:
|
||||||
echo "Reads configuration from $HOME/.zulip-install-server.conf, which should look like:"
|
|
||||||
echo
|
[repo]
|
||||||
echo "[repo]"
|
repo_url=git@github.com:zulip/zulip.git
|
||||||
echo "repo_url=git@github.com:zulip/zulip.git"
|
[aws]
|
||||||
echo "default_branch=main"
|
zone_id=Z2U988IEXAMPLE
|
||||||
echo "[aws]"
|
security_groups=sg-01234567
|
||||||
echo "zone_id=Z2U988IEXAMPLE"
|
image_id=ami-0dc45e3d9be6ab7b5
|
||||||
echo "security_groups=sg-01234567"
|
instance_type=m4.large
|
||||||
echo "image_id=ami-0dc45e3d9be6ab7b5"
|
ssh_secret_id=prod/git/deploy
|
||||||
echo "instance_type=m4.large"
|
EOF
|
||||||
echo "ssh_secret_id=prod/git/deploy"
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
args="$(getopt -o '' --long help,branch:,roles: -n "$0" -- "$@")" || usage
|
||||||
|
eval "set -- $args"
|
||||||
|
|
||||||
|
BRANCH="main"
|
||||||
|
ROLES="base"
|
||||||
|
while true; do
|
||||||
|
case "$1" in
|
||||||
|
--help)
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
--roles)
|
||||||
|
shift
|
||||||
|
ROLES="$1"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--branch)
|
||||||
|
shift
|
||||||
|
BRANCH="$1"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--)
|
||||||
|
shift
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ $# -ne 1 ]; then
|
||||||
|
usage
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
SERVER="$1"
|
||||||
|
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
@@ -42,9 +77,6 @@ if [ ! -f "$zulip_install_config_file" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
REPO_URL=$(crudini --get "$zulip_install_config_file" repo repo_url)
|
REPO_URL=$(crudini --get "$zulip_install_config_file" repo repo_url)
|
||||||
if [ -z "$BRANCH" ]; then
|
|
||||||
BRANCH=$(crudini --get "$zulip_install_config_file" repo default_branch)
|
|
||||||
fi
|
|
||||||
|
|
||||||
for role in ${ROLES//,/ }; do
|
for role in ${ROLES//,/ }; do
|
||||||
if ! [ -f "../../puppet/zulip_ops/manifests/profile/$role.pp" ]; then
|
if ! [ -f "../../puppet/zulip_ops/manifests/profile/$role.pp" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user