3 # Copyright (C) The Arvados Authors. All rights reserved.
5 # SPDX-License-Identifier: CC-BY-SA-3.0
12 if [[ "$NODE" != localhost ]] ; then
13 if ! ssh $NODE test -d ${GITTARGET}.git ; then
14 ssh $NODE git init --bare ${GITTARGET}.git
15 if ! git remote add $NODE $DEPLOY_USER@$NODE:${GITTARGET}.git ; then
16 git remote set-url $NODE $DEPLOY_USER@$NODE:${GITTARGET}.git
18 git push $NODE $BRANCH
19 ssh $NODE git clone ${GITTARGET}.git ${GITTARGET}
22 git push $NODE $BRANCH
23 ssh $NODE git -C ${GITTARGET} checkout $BRANCH
24 ssh $NODE git -C ${GITTARGET} pull
29 if [[ -z "${NODES[$NODE]}" ]] ; then
30 echo "No roles declared for '$NODE' in local.params"
34 if [[ "$NODE" = localhost ]] ; then
35 sudo ./provision.sh --config local.params --roles ${NODES[$NODE]}
37 ssh $DEPLOY_USER@$NODE "cd ${GITTARGET} && sudo ./provision.sh --config local.params --roles ${NODES[$NODE]}"
42 CONFIG_FILE=local.params
43 CONFIG_DIR=local_config_dir
44 if [[ ! -s $CONFIG_FILE ]] ; then
45 echo "Must be run from initialized setup dir, maybe you need to 'initialize' first?"
48 GITTARGET=arvados-deploy-config-${CLUSTER}
52 if [[ -n "$subcmd" ]] ; then
57 if [[ ! -f provision.sh ]] ; then
58 echo "Must be run from arvados/tools/salt-install"
67 if [[ -z "$PARAMS" || ! -f local.params.example.$PARAMS ]] ; then
68 echo "Not found: local.params.example.$PARAMS"
69 echo "Expected one of multiple_hosts, single_host_multiple_hostnames, single_host_single_hostname"
73 if [[ -z "$SLS" || ! -d config_examples/$SLS ]] ; then
74 echo "Not found: config_examples/$SLS"
75 echo "Expected one of multi_host/aws, single_host/multiple_hostnames, single_host/single_hostname"
79 if [[ -z "$SETUPDIR" || -z "$PARAMS" || -z "$SLS" ]]; then
80 echo "installer.sh <setup dir to initialize> <params template> <config template>"
84 if [[ -n "$err" ]] ; then
88 echo "Initializing $SETUPDIR"
90 cp -r *.sh tests $SETUPDIR
92 cp local.params.example.$PARAMS $SETUPDIR/local.params
93 cp -r config_examples/$SLS $SETUPDIR/local_config_dir
96 git add *.sh local.params local_config_dir tests
97 git commit -m"initial commit"
99 echo "setup directory initialized, now go to $SETUPDIR, edit 'local.params' and 'local_config_dir' as needed, then run 'installer.sh deploy'"
106 if grep -rni 'fixme' ${CONFIG_FILE} ${CONFIG_DIR} ; then
108 echo "Some parameters still need to be updated. Please fix them and then re-run deploy."
112 BRANCH=$(git branch --show-current)
117 if ! git diff --cached --exit-code ; then
118 git commit -m"prepare for deploy"
121 if [[ -z "$NODE" ]]; then
122 for NODE in "${!NODES[@]}"
124 # Do 'database' role first,
125 if [[ "${NODES[$NODE]}" =~ database ]] ; then
132 for NODE in "${!NODES[@]}"
134 # then 'api' or 'controller' roles
135 if [[ "${NODES[$NODE]}" =~ (api|controller) ]] ; then
142 for NODE in "${!NODES[@]}"
157 if ! which arvados-client ; then
158 apt-get install arvados-client
161 export ARVADOS_API_HOST="${CLUSTER}.${DOMAIN}"
162 export ARVADOS_API_TOKEN="$SYSTEM_ROOT_TOKEN"
164 arvados-client diagnostics -internal-client
167 echo "Arvados installer"
169 echo "initialize initialize the setup directory for configuration"
170 echo "deploy deploy the configuration from the setup directory"
171 echo "diagnostics check your install using diagnostics"