3 # Copyright (C) The Arvados Authors. All rights reserved.
5 # SPDX-License-Identifier: CC-BY-SA-3.0
10 if test -n "$subcmd" ; then
15 if ! test -f provision.sh ; then
16 echo "Must be run from arvados/tools/salt-install"
25 if test -z "$PARAMS" -o ! -f local.params.example.$PARAMS ; then
26 echo "Not found: local.params.example.$PARAMS"
27 echo "Expected one of multiple_hosts, single_host_multiple_hostnames, single_host_single_hostname"
31 if test -z "$SLS" -o ! -d config_examples/$SLS ; then
32 echo "Not found: config_examples/$SLS"
33 echo "Expected one of multi_host/aws, single_host/multiple_hostnames, single_host/single_hostname"
37 if test -z "$SETUPDIR" -o -z "$PARAMS" -o -z "$SLS" ; then
38 echo "installer.sh <setup dir to initialize> <params template> <config template>"
42 if test -n "$err" ; then
46 echo "Initializing $SETUPDIR"
48 cp -r *.sh tests $SETUPDIR
50 cp local.params.example.$PARAMS $SETUPDIR/local.params
51 cp -r config_examples/$SLS $SETUPDIR/local_config_dir
54 git add *.sh local.params local_config_dir tests
55 git commit -m"initial commit"
57 echo "setup directory initialized, now go to $SETUPDIR, edit 'local.params' and 'local_config_dir' as needed, then run 'installer.sh deploy'"
60 CONFIG_FILE=local.params
61 if ! test -s $CONFIG_FILE ; then
62 echo "Must be run from arvados-setup, maybe you need to 'initialize' first?"
70 if ! git diff --cached --exit-code ; then
71 git commit -m"prepare for deploy"
73 for NODE in "${!NODES[@]}"
75 if test $NODE = localhost ; then
76 sudo ./provision.sh --config local.params --roles ${NODES[$NODE]}
78 if ! ssh $NODE test -d arvados-setup ; then
79 ssh $NODE git init --bare arvados-setup.git
80 if ! git remote add $NODE $DEPLOY_USER@$NODE:arvados-setup.git ; then
81 git remote set-url $NODE $DEPLOY_USER@$NODE:arvados-setup.git
84 ssh $NODE git clone arvados-setup.git arvados-setup
88 ssh $NODE git -C arvados-setup pull
90 ssh $DEPLOY_USER@$NODE "cd arvados-setup && sudo ./provision.sh --config local.params --roles ${NODES[$NODE]}"
95 echo "Arvados installer"
97 echo "initialize initialize the setup directory for configuration"
98 echo "deploy deploy the configuration from the setup directory"