| ... | ... |
@@ -84,9 +84,10 @@ DEST=${DEST:-/opt/stack}
|
| 84 | 84 |
# sudo privileges and runs as that user. |
| 85 | 85 |
|
| 86 | 86 |
if [[ $EUID -eq 0 ]]; then |
| 87 |
+ ROOTSLEEP=${ROOTSLEEP:-10}
|
|
| 87 | 88 |
echo "You are running this script as root." |
| 88 |
- echo "In 10 seconds, we will create a user 'stack' and run as that user" |
|
| 89 |
- sleep 10 |
|
| 89 |
+ echo "In $ROOTSLEEP seconds, we will create a user 'stack' and run as that user" |
|
| 90 |
+ sleep $ROOTSLEEP |
|
| 90 | 91 |
|
| 91 | 92 |
# since this script runs as a normal user, we need to give that user |
| 92 | 93 |
# ability to run sudo |
| ... | ... |
@@ -397,7 +398,7 @@ EOF |
| 397 | 397 |
# Install and start mysql-server |
| 398 | 398 |
apt_get install mysql-server |
| 399 | 399 |
# Update the DB to give user ‘$MYSQL_USER’@’%’ full control of the all databases: |
| 400 |
- sudo mysql -uroot -p$MYSQL_PASSWORD -e "GRANT ALL PRIVILEGES ON *.* TO '$MYSQL_USER'@'%' identified by '$MYSQL_PASSWORD';" |
|
| 400 |
+ sudo mysql -uroot -p$MYSQL_PASSWORD -h127.0.0.1 -e "GRANT ALL PRIVILEGES ON *.* TO '$MYSQL_USER'@'%' identified by '$MYSQL_PASSWORD';" |
|
| 401 | 401 |
|
| 402 | 402 |
# Edit /etc/mysql/my.cnf to change ‘bind-address’ from localhost (127.0.0.1) to any (0.0.0.0) and restart the mysql service: |
| 403 | 403 |
sudo sed -i 's/127.0.0.1/0.0.0.0/g' /etc/mysql/my.cnf |
| ... | ... |
@@ -654,28 +655,31 @@ fi |
| 654 | 654 |
# launch the glance api and wait for it to answer before continuing |
| 655 | 655 |
if [[ "$ENABLED_SERVICES" =~ "g-api" ]]; then |
| 656 | 656 |
screen_it g-api "cd $GLANCE_DIR; bin/glance-api --config-file=etc/glance-api.conf" |
| 657 |
- while ! wget -q -O- http://$GLANCE_HOSTPORT; do |
|
| 658 |
- echo "Waiting for g-api ($GLANCE_HOSTPORT) to start..." |
|
| 659 |
- sleep 1 |
|
| 660 |
- done |
|
| 657 |
+ echo "Waiting for g-api ($GLANCE_HOSTPORT) to start..." |
|
| 658 |
+ if ! timeout 60 sh -c "while ! wget -q -O- http://$GLANCE_HOSTPORT; do sleep 1; done"; then |
|
| 659 |
+ echo "g-api did not start" |
|
| 660 |
+ exit 1 |
|
| 661 |
+ fi |
|
| 661 | 662 |
fi |
| 662 | 663 |
|
| 663 | 664 |
# launch the keystone and wait for it to answer before continuing |
| 664 | 665 |
if [[ "$ENABLED_SERVICES" =~ "key" ]]; then |
| 665 | 666 |
screen_it key "cd $KEYSTONE_DIR && $KEYSTONE_DIR/bin/keystone --config-file $KEYSTONE_CONF -d" |
| 666 |
- while ! wget -q -O- http://127.0.0.1:5000; do |
|
| 667 |
- echo "Waiting for keystone to start..." |
|
| 668 |
- sleep 1 |
|
| 669 |
- done |
|
| 667 |
+ echo "Waiting for keystone to start..." |
|
| 668 |
+ if ! timeout 60 sh -c "while ! wget -q -O- http://127.0.0.1:5000; do sleep 1; done"; then |
|
| 669 |
+ echo "keystone did not start" |
|
| 670 |
+ exit 1 |
|
| 671 |
+ fi |
|
| 670 | 672 |
fi |
| 671 | 673 |
|
| 672 | 674 |
# launch the nova-api and wait for it to answer before continuing |
| 673 | 675 |
if [[ "$ENABLED_SERVICES" =~ "n-api" ]]; then |
| 674 | 676 |
screen_it n-api "cd $NOVA_DIR && $NOVA_DIR/bin/nova-api" |
| 675 |
- while ! wget -q -O- http://127.0.0.1:8774; do |
|
| 676 |
- echo "Waiting for nova-api to start..." |
|
| 677 |
- sleep 1 |
|
| 678 |
- done |
|
| 677 |
+ echo "Waiting for nova-api to start..." |
|
| 678 |
+ if ! timeout 60 sh -c "while ! wget -q -O- http://127.0.0.1:8774; do sleep 1; done"; then |
|
| 679 |
+ echo "nova-api did not start" |
|
| 680 |
+ exit 1 |
|
| 681 |
+ fi |
|
| 679 | 682 |
fi |
| 680 | 683 |
# Launching nova-compute should be as simple as running ``nova-compute`` but |
| 681 | 684 |
# have to do a little more than that in our script. Since we add the group |
| 682 | 685 |
new file mode 100755 |
| ... | ... |
@@ -0,0 +1,28 @@ |
| 0 |
+#!/usr/bin/env bash |
|
| 1 |
+# Build an OpenStack install on a bare metal machine. |
|
| 2 |
+set +x |
|
| 3 |
+ |
|
| 4 |
+# Source params |
|
| 5 |
+source ./stackrc |
|
| 6 |
+ |
|
| 7 |
+# Param string to pass to stack.sh. Like "EC2_DMZ_HOST=192.168.1.1 MYSQL_USER=nova" |
|
| 8 |
+STACKSH_PARAMS=${STACKSH_PARAMS:-}
|
|
| 9 |
+ |
|
| 10 |
+# Option to use the version of devstack on which we are currently working |
|
| 11 |
+USE_CURRENT_DEVSTACK=${USE_CURRENT_DEVSTACK:-1}
|
|
| 12 |
+ |
|
| 13 |
+# Configure the runner |
|
| 14 |
+RUN_SH=`mktemp` |
|
| 15 |
+cat > $RUN_SH <<EOF |
|
| 16 |
+#!/usr/bin/env bash |
|
| 17 |
+# Install and run stack.sh |
|
| 18 |
+cd devstack |
|
| 19 |
+$STACKSH_PARAMS ./stack.sh |
|
| 20 |
+EOF |
|
| 21 |
+ |
|
| 22 |
+# Make the run.sh executable |
|
| 23 |
+chmod 755 $RUN_SH |
|
| 24 |
+ |
|
| 25 |
+scp -r . root@$CONTAINER_IP:devstack |
|
| 26 |
+scp $RUN_SH root@$CONTAINER_IP:$RUN_SH |
|
| 27 |
+ssh root@$CONTAINER_IP $RUN_SH |
| 0 | 28 |
new file mode 100755 |
| ... | ... |
@@ -0,0 +1,37 @@ |
| 0 |
+#!/usr/bin/env bash |
|
| 1 |
+# Build an OpenStack install on several bare metal machines. |
|
| 2 |
+SHELL_AFTER_RUN=no |
|
| 3 |
+ |
|
| 4 |
+# Variables common amongst all hosts in the cluster |
|
| 5 |
+COMMON_VARS="MYSQL_HOST=$HEAD_HOST RABBIT_HOST=$HEAD_HOST GLANCE_HOSTPORT=$HEAD_HOST:9292 NET_MAN=FlatDHCPManager FLAT_INTERFACE=eth0 FLOATING_RANGE=$FLOATING_RANGE MULTI_HOST=1 SHELL_AFTER_RUN=$SHELL_AFTER_RUN" |
|
| 6 |
+ |
|
| 7 |
+# Helper to launch containers |
|
| 8 |
+function run_bm {
|
|
| 9 |
+ # For some reason container names with periods can cause issues :/ |
|
| 10 |
+ CONTAINER=$1 CONTAINER_IP=$2 CONTAINER_NETMASK=$NETMASK CONTAINER_GATEWAY=$GATEWAY NAMESERVER=$NAMESERVER TERMINATE=$TERMINATE STACKSH_PARAMS="$COMMON_VARS $3" ./tools/build_bm.sh |
|
| 11 |
+} |
|
| 12 |
+ |
|
| 13 |
+# Launch the head node - headnode uses a non-ip domain name, |
|
| 14 |
+# because rabbit won't launch with an ip addr hostname :( |
|
| 15 |
+run_bm STACKMASTER $HEAD_HOST "ENABLED_SERVICES=g-api,g-reg,key,n-api,n-sch,n-vnc,dash,mysql,rabbit" |
|
| 16 |
+ |
|
| 17 |
+# Wait till the head node is up |
|
| 18 |
+if [ ! "$TERMINATE" = "1" ]; then |
|
| 19 |
+ echo "Waiting for head node ($HEAD_HOST) to start..." |
|
| 20 |
+ if ! timeout 60 sh -c "while ! wget -q -O- http://$HEAD_HOST | grep -q username; do sleep 1; done"; then |
|
| 21 |
+ echo "Head node did not start" |
|
| 22 |
+ exit 1 |
|
| 23 |
+ fi |
|
| 24 |
+fi |
|
| 25 |
+ |
|
| 26 |
+PIDS="" |
|
| 27 |
+# Launch the compute hosts in parallel |
|
| 28 |
+for compute_host in ${COMPUTE_HOSTS//,/ }; do
|
|
| 29 |
+ run_bm $compute_host $compute_host "ENABLED_SERVICES=n-cpu,n-net,n-api" & |
|
| 30 |
+ PIDS="$PIDS $!" |
|
| 31 |
+done |
|
| 32 |
+ |
|
| 33 |
+for x in $PIDS; do |
|
| 34 |
+ wait $x |
|
| 35 |
+done |
|
| 36 |
+echo "build_bm_multi complete" |