# This will be populated by loadconfig()
declare GITTARGET
+checktools() {
+ local MISSING=''
+ for a in git ip ; do
+ if ! which $a ; then
+ MISSING="$MISSING $a"
+ fi
+ done
+ if [[ -n "$MISSING" ]] ; then
+ echo "Some tools are missing, please make sure you have the 'git' and 'iproute2' packages installed"
+ exit 1
+ fi
+}
+
sync() {
local NODE=$1
local BRANCH=$2
# the appropriate roles.
if [[ -z "$ROLES" ]] ; then
- echo "No roles declared for '$NODE' in ${CONFIG_FILE}"
- exit 1
+ echo "No roles specified for $NODE, will deploy all roles"
+ else
+ ROLES="--roles ${ROLES}"
fi
+ logfile=deploy-${NODE}-$(date -Iseconds).log
+
if [[ "$NODE" = localhost ]] ; then
- sudo ./provision.sh --config ${CONFIG_FILE} --roles ${ROLES}
+ SUDO=''
+ if [[ $(whoami) != 'root' ]] ; then
+ SUDO=sudo
+ fi
+ $SUDO ./provision.sh --config ${CONFIG_FILE} ${ROLES} 2>&1 | tee $logfile
else
- ssh $DEPLOY_USER@$NODE "cd ${GITTARGET} && sudo ./provision.sh --config ${CONFIG_FILE} --roles ${ROLES}"
+ ssh $DEPLOY_USER@$NODE "cd ${GITTARGET} && sudo ./provision.sh --config ${CONFIG_FILE} ${ROLES}" 2>&1 | tee $logfile
fi
}
GITTARGET=arvados-deploy-config-${CLUSTER}
}
+set +u
subcmd="$1"
+set -u
+
if [[ -n "$subcmd" ]] ; then
shift
fi
exit
fi
+ checktools
+
set +u
SETUPDIR=$1
PARAMS=$2
cp -r config_examples/$SLS $SETUPDIR/${CONFIG_DIR}
cd $SETUPDIR
- git add *.sh ${CONFIG_FILE} ${CONFIG_DIR} tests
+ echo '*.log' > .gitignore
+
+ git add *.sh ${CONFIG_FILE} ${CONFIG_DIR} tests .gitignore
git commit -m"initial commit"
echo "setup directory initialized, now go to $SETUPDIR, edit '${CONFIG_FILE}' and '${CONFIG_DIR}' as needed, then run 'installer.sh deploy'"
NODE=$1
set -u
+ checktools
+
loadconfig
if grep -rni 'fixme' ${CONFIG_FILE} ${CONFIG_DIR} ; then
do
# Do 'database' role first,
if [[ "${NODES[$NODE]}" =~ database ]] ; then
- deploynode $NODE ${NODES[$NODE]}
+ deploynode $NODE "${NODES[$NODE]}"
unset NODES[$NODE]
fi
done
do
# then 'api' or 'controller' roles
if [[ "${NODES[$NODE]}" =~ (api|controller) ]] ; then
- deploynode $NODE ${NODES[$NODE]}
+ deploynode $NODE "${NODES[$NODE]}"
unset NODES[$NODE]
fi
done
do
# Everything else (we removed the nodes that we
# already deployed from the list)
- deploynode $NODE ${NODES[$NODE]}
+ deploynode $NODE "${NODES[$NODE]}"
done
else
# Just deploy the node that was supplied on the command line.
sync $NODE $BRANCH
- deploynode $NODE
+ deploynode $NODE ""
fi
+ set +x
echo
echo "Completed deploy, run 'installer.sh diagnostics' to verify the install"
exit 1
fi
- export ARVADOS_API_HOST="${CLUSTER}.${DOMAIN}"
+ export ARVADOS_API_HOST="${CLUSTER}.${DOMAIN}:${CONTROLLER_EXT_SSL_PORT}"
export ARVADOS_API_TOKEN="$SYSTEM_ROOT_TOKEN"
arvados-client diagnostics $LOCATION