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 # This could have been done with the Salt vagrant provisioner, but this script
14 # can be used in environments other than vagrant.
16 # If branch is set, the script will switch to it before running salt
17 BRANCH="refactor-config-add-service"
30 # In vagrant, we can use the shared dir
31 # P_DIR="/vagrant/salt_pillars"
34 sudo apt-get install -y curl git
36 dpkg -l |grep salt-minion
37 if [ ${?} -eq 0 ]; then
38 echo "Salt already installed"
40 curl -L https://bootstrap.saltstack.com -o /tmp/bootstrap_salt.sh
41 sudo sh /tmp/bootstrap_salt.sh -XUdfP -x python3
42 sudo /bin/systemctl disable salt-minion.service
45 # Set salt to masterless mode
46 cat > /etc/salt/minion << EOFSM
52 - ${F_DIR}/*/test/salt/states
63 cat > ${S_DIR}/top.sls << EOFTSLS
66 - example_add_snakeoil_certs
74 cat > ${P_DIR}/top.sls << EOFPSLS
79 - nginx_api_configuration
80 - nginx_controller_configuration
81 - nginx_keepproxy_configuration
82 - nginx_keepweb_configuration
84 - nginx_websocket_configuration
85 - nginx_webshell_configuration
86 - nginx_workbench2_configuration
87 - nginx_workbench_configuration
92 # Get the formula and dependencies
94 for f in postgres arvados nginx docker locale; do
95 git clone https://github.com/netmanagers/${f}-formula.git
98 if [ "x${BRANCH}" != "x" ]; then
99 cd ${F_DIR}/arvados-formula
100 git checkout -t origin/${BRANCH}
104 sed "s/example.net/${DOMAIN}/g; s/fixme/${CLUSTER}/g; s/release: development/release: ${RELEASE}/g" \
105 ${F_DIR}/arvados-formula/test/salt/pillar/arvados_dev.sls > ${P_DIR}/arvados.sls
107 # Replace cluster and domain name in the example pillars
108 for f in ${F_DIR}/arvados-formula/test/salt/pillar/examples/*; do
109 sed "s/example.net/${DOMAIN}/g; s/fixme/${CLUSTER}/g" \
110 ${f} > ${P_DIR}/$(basename ${f})
113 # # Copy arvados' pillar.example file to the pillars dir, so it's used
114 # sed "s/example.net/${DOMAIN}/g" ${F_DIR}/arvados-formula/pillar.example > ${P_DIR}/arvados.sls
116 # # Replace domain name in the example pillars
117 # for f in ${F_DIR}/arvados-formula/test/salt/pillar/examples/*; do
118 # sed "s/example.net/${DOMAIN}/g" ${f} > ${P_DIR}/$(basename ${f})
121 # Let's write a /etc/hosts file that points all the hosts to localhost
123 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
125 # FIXME! Test to see if arvados-api-server progresses without issues
126 cat > /root/.psqlrc << EOF
130 # Now run the install
131 salt-call --local state.apply -l debug