3 # Copyright (C) The Arvados Authors. All rights reserved.
5 # SPDX-License-Identifier: CC-BY-SA-3.0
7 # If you want to test arvados in a single host, you can run this script, which
8 # will install it using salt masterless
9 # This script is run by the Vagrant file when you run it with
13 ##########################################################
14 # The 5 letters name you want to give your cluster
18 # Which release of Arvados repo you want to use
20 # Which version of Arvados you want to install. Defaults to 'latest'
24 # This is a arvados-formula setting.
25 # If branch is set, the script will switch to it before running salt
26 # Usually not needed, only used for testing
29 ##########################################################
30 # Usually there's no need to modify things below this line
39 # In vagrant, we can use the shared dir
40 # P_DIR="/vagrant/salt_pillars"
43 sudo apt-get install -y curl git
45 dpkg -l |grep salt-minion
46 if [ ${?} -eq 0 ]; then
47 echo "Salt already installed"
49 curl -L https://bootstrap.saltstack.com -o /tmp/bootstrap_salt.sh
50 sudo sh /tmp/bootstrap_salt.sh -XUdfP -x python3
51 sudo /bin/systemctl disable salt-minion.service
54 # Set salt to masterless mode
55 cat > /etc/salt/minion << EOFSM
61 - ${F_DIR}/*/test/salt/states
73 cat > ${S_DIR}/top.sls << EOFTSLS
76 - example_add_snakeoil_certs
85 cat > ${P_DIR}/top.sls << EOFPSLS
90 - nginx_api_configuration
91 - nginx_controller_configuration
92 - nginx_keepproxy_configuration
93 - nginx_keepweb_configuration
95 - nginx_websocket_configuration
96 - nginx_webshell_configuration
97 - nginx_workbench2_configuration
98 - nginx_workbench_configuration
103 # Get the formula and dependencies
104 cd ${F_DIR} || exit 1
105 for f in postgres arvados nginx docker locale; do
106 git clone https://github.com/saltstack-formulas/${f}-formula.git
109 if [ "x${BRANCH}" != "x" ]; then
110 cd ${F_DIR}/arvados-formula
111 git checkout -t origin/${BRANCH}
115 sed "s/example.net/${DOMAIN}/g; s/fixme/${CLUSTER}/g; s/release: development/release: ${RELEASE}/g; s/# version: '2.0.4'/version: '${VERSION}'/g" \
116 ${F_DIR}/arvados-formula/test/salt/pillar/arvados_dev.sls > ${P_DIR}/arvados.sls
118 # Replace cluster and domain name in the example pillars
119 for f in ${F_DIR}/arvados-formula/test/salt/pillar/examples/*; do
120 sed "s/example.net/${DOMAIN}/g; s/fixme/${CLUSTER}/g" \
121 ${f} > ${P_DIR}/$(basename ${f})
124 # Let's write a /etc/hosts file that points all the hosts to localhost
126 echo "127.0.0.2 api keep keep0 collections download ws workbench workbench2 ${CLUSTER}.${DOMAIN} api.${CLUSTER}.${DOMAIN} keep.${CLUSTER}.${DOMAIN} keep0.${CLUSTER}.${DOMAIN} collections.${CLUSTER}.${DOMAIN} download.${CLUSTER}.${DOMAIN} ws.${CLUSTER}.${DOMAIN} workbench.${CLUSTER}.${DOMAIN} workbench2.${CLUSTER}.${DOMAIN}" >> /etc/hosts
128 # Now run the install
129 salt-call --local state.apply -l debug