blob: 50be4f574f45d0fc13e43b322b5721e6b289eff6 [file] [log] [blame]
Anthony Young036c9f82011-09-15 20:37:29 -07001#!/usr/bin/env bash
2# Head node host, which runs glance, api, keystone
3HEAD_HOST=${HEAD_HOST:-192.168.1.52}
4COMPUTE_HOSTS=${COMPUTE_HOSTS:-192.168.1.53,192.168.1.54}
5
6# Networking params
Anthony Young23761c32011-09-16 14:54:20 -07007NAMESERVER=${NAMESERVER:-192.168.1.1}
Anthony Young036c9f82011-09-15 20:37:29 -07008GATEWAY=${GATEWAY:-192.168.1.1}
Anthony Young23761c32011-09-16 14:54:20 -07009NETMASK=${NETMASK:-255.255.255.0}
10FLOATING_RANGE=${FLOATING_RANGE:-192.168.1.196/30}
11
12# Setting this to 1 shuts down and destroys our containers without relaunching.
13TERMINATE=${TERMINATE:-0}
Anthony Young036c9f82011-09-15 20:37:29 -070014
Anthony Young036c9f82011-09-15 20:37:29 -070015# Variables common amongst all hosts in the cluster
Anthony Young23761c32011-09-16 14:54:20 -070016COMMON_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"
Anthony Young036c9f82011-09-15 20:37:29 -070017
Anthony Youngfde5a1c2011-09-15 23:49:02 -070018# Helper to launch containers
19function run_lxc {
20 # For some reason container names with periods can cause issues :/
Anthony Young23761c32011-09-16 14:54:20 -070021 CONTAINER=$1 CONTAINER_IP=$2 CONTAINER_NETMASK=$NETMASK CONTAINER_GATEWAY=$GATEWAY NAMESERVER=$NAMESERVER TERMINATE=$TERMINATE STACKSH_PARAMS="$COMMON_VARS $3" ./build_lxc.sh
Anthony Youngfde5a1c2011-09-15 23:49:02 -070022}
23
24# Launch the head node - headnode uses a non-ip domain name,
25# because rabbit won't launch with an ip addr hostname :(
26run_lxc STACKMASTER $HEAD_HOST "ENABLED_SERVICES=g-api,g-reg,key,n-api,n-sch,n-vnc,dash,mysql,rabbit"
Anthony Youngcbbf7182011-09-16 00:28:23 -070027
28# Wait till the head node is up
Anthony Young23761c32011-09-16 14:54:20 -070029if [ ! "$TERMINATE" = "1" ]; then
30 while ! wget -q -O- http://$HEAD_HOST | grep -q username; do
31 echo "Waiting for head node ($HEAD_HOST) to start..."
32 sleep 5
33 done
34fi
Anthony Youngcbbf7182011-09-16 00:28:23 -070035
Anthony Young57bca7e2011-09-16 00:37:26 -070036# Launch the compute hosts
Anthony Young036c9f82011-09-15 20:37:29 -070037for compute_host in ${COMPUTE_HOSTS//,/ }; do
Anthony Youngfde5a1c2011-09-15 23:49:02 -070038 run_lxc $compute_host $compute_host "ENABLED_SERVICES=n-cpu,n-net,n-api"
Anthony Young036c9f82011-09-15 20:37:29 -070039done