blob: 5a3784552673e4e4690e3d81897dedeac3f99985 [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
7NAMESERVER=${NAMESERVER:-192.168.2.1}
8GATEWAY=${GATEWAY:-192.168.1.1}
9
Anthony Young036c9f82011-09-15 20:37:29 -070010# Variables common amongst all hosts in the cluster
11COMMON_VARS="MYSQL_HOST=$HEAD_HOST RABBIT_HOST=$HEAD_HOST GLANCE_HOSTPORT=$HEAD_HOST:9292 NET_MAN=FlatDHCPManager FLAT_INTERFACE=eth0"
12
Anthony Youngfde5a1c2011-09-15 23:49:02 -070013# Helper to launch containers
14function run_lxc {
15 # For some reason container names with periods can cause issues :/
16 CONTAINER=$1 CONTAINER_IP=$2 CONTAINER_GATEWAY=$GATEWAY NAMESERVER=$NAMESERVER STACKSH_PARAMS="$COMMON_VARS $3" ./build_lxc.sh
17}
18
19# Launch the head node - headnode uses a non-ip domain name,
20# because rabbit won't launch with an ip addr hostname :(
21run_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 -070022
23# Wait till the head node is up
24while ! wget -O - http://$HEAD_HOST | grep -q username; do
25 echo "Waiting for head node ($HEAD_HOST) to start..."
26 sleep 5
27done
28
Anthony Young036c9f82011-09-15 20:37:29 -070029for compute_host in ${COMPUTE_HOSTS//,/ }; do
30 # Launch the compute hosts
Anthony Youngfde5a1c2011-09-15 23:49:02 -070031 run_lxc $compute_host $compute_host "ENABLED_SERVICES=n-cpu,n-net,n-api"
Anthony Young036c9f82011-09-15 20:37:29 -070032done