diff --git a/README b/README index 299bd6c..2047456 100644 --- a/README +++ b/README @@ -1,11 +1,10 @@ -Tool to build (nfs export) openstack dev environments +Tool to quickly deploy openstack dev environments # Todo * Add python-novaclient cli support * move keystone/glance/dash to mysql * syslog -* munin * check openstack-puppet recipes to see if anything else is missing * allow rabbit connection to be specified via environment variables with sensible defaults * Add volume support @@ -18,7 +17,8 @@ Tool to build (nfs export) openstack dev environments * sqlconn can be set via env * move back to using sudo * move nova to mysql -* create images via vmbuilder and upload images via glance +* munin +* image upload with a script that supports generating images via debootstrap (ubuntu-vm-builder) # Future diff --git a/files/keystone_data.sh b/files/keystone_data.sh index dfcafb2..b028557 100755 --- a/files/keystone_data.sh +++ b/files/keystone_data.sh @@ -14,11 +14,11 @@ $BIN_DIR/keystone-manage $* role add Member $BIN_DIR/keystone-manage $* role grant Admin admin #endpointTemplates -# $BIN_DIR/keystone-manage $* endpointTemplates add RegionOne swift http://localhost:8080/v1/AUTH_%tenant_id% http://localhost:8080/ http://localhost:8080/v1/AUTH_%tenant_id% 1 1 -$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne nova_compat http://localhost:8774/v1.0/ http://localhost:8774/v1.0 http://localhost:8774/v1.0 1 1 -$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne nova http://localhost:8774/v1.1/%tenant_id% http://localhost:8774/v1.1/%tenant_id% http://localhost:8774/v1.1/%tenant_id% 1 1 -$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne glance http://localhost:9292/v1.1/%tenant_id% http://localhost:9292/v1.1/%tenant_id% http://localhost:9292/v1.1/%tenant_id% 1 1 -$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne identity http://localhost:5000/v2.0 http://localhost:5001/v2.0 http://localhost:5000/v2.0 1 1 +# $BIN_DIR/keystone-manage $* endpointTemplates add RegionOne swift http://%HOST_IP%:8080/v1/AUTH_%tenant_id% http://%HOST_IP%:8080/ http://%HOST_IP%:8080/v1/AUTH_%tenant_id% 1 1 +$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne nova_compat http://%HOST_IP%:8774/v1.0/ http://%HOST_IP%:8774/v1.0 http://%HOST_IP%:8774/v1.0 1 1 +$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne nova http://%HOST_IP%:8774/v1.1/%tenant_id% http://%HOST_IP%:8774/v1.1/%tenant_id% http://%HOST_IP%:8774/v1.1/%tenant_id% 1 1 +$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne glance http://%HOST_IP%:9292/v1.1/%tenant_id% http://%HOST_IP%:9292/v1.1/%tenant_id% http://%HOST_IP%:9292/v1.1/%tenant_id% 1 1 +$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne identity http://%HOST_IP%:5000/v2.0 http://%HOST_IP%:5001/v2.0 http://%HOST_IP%:5000/v2.0 1 1 # Tokens $BIN_DIR/keystone-manage $* token add 999888777666 admin admin 2015-02-05T00:00 diff --git a/stack.sh b/stack.sh index e9218b8..418f37b 100755 --- a/stack.sh +++ b/stack.sh @@ -1,12 +1,14 @@ #!/usr/bin/env bash -# **stack.sh** is rackspace cloudbuilder's opinionated openstack dev installation. +# **stack.sh** is an opinionated openstack dev installation. # To keep this script simple we assume you are running on an **Ubuntu 11.04 # Natty** machine. It should work in a VM or physical server. Additionally we # put the list of *apt* and *pip* dependencies and other configuration files in # this repo. So start by grabbing this script and the dependencies. +# You can grab the most recent version of this script and files from Rackspace +# Cloud Builders at https://github.com/cloudbuilders/devstack # Sanity Check # ============ @@ -87,8 +89,9 @@ EC2_DMZ_HOST=${EC2_DMZ_HOST:-$HOST_IP} # ip or you risk breaking things. # FLAT_INTERFACE=eth0 -# Nova hypervisor configuration -LIBVIRT_TYPE=${LIBVIRT_TYPE:-qemu} +# Nova hypervisor configuration. We default to **kvm** but will drop back to +# **qemu** if we are unable to load the kvm module. +LIBVIRT_TYPE=${LIBVIRT_TYPE:-kvm} # Mysql connection info MYSQL_USER=${MYSQL_USER:-root} @@ -156,6 +159,7 @@ git_clone https://github.com/cloudbuilders/openstack-munin.git $MUNIN_DIR # Initialization # ============== + # setup our checkouts so they are installed into python path # allowing ``import nova`` or ``import glance.client`` cd $NOVA_DIR; sudo python setup.py develop @@ -237,7 +241,7 @@ fi if [[ "$ENABLED_SERVICES" =~ "munin" ]]; then # allow connections from other hosts - sudo sed -i -e '/Allow from localhost/s/localhost.*$/all/' /etc/munin/apache.conf + sudo sed -i -e 's/Allow from localhost/Allow from all/g' /etc/munin/apache.conf cat >/tmp/nova <> $NOVA_DIR/bin/nova.conf } @@ -312,45 +353,6 @@ if [ -n "$MULTI_HOST" ]; then add_nova_flag "--multi_host=$MULTI_HOST" fi -# create a new named screen to store things in -screen -d -m -S nova -t nova -sleep 1 - -if [[ "$ENABLED_SERVICES" =~ "n-cpu" ]]; then - - # attempt to load modules: kvm (hardware virt) and nbd (network block - # device - used to manage qcow images) - sudo modprobe nbd || true - sudo modprobe kvm || true - # User needs to be member of libvirtd group for nova-compute to use libvirt. - sudo usermod -a -G libvirtd `whoami` - # if kvm wasn't running before we need to restart libvirt to enable it - sudo /etc/init.d/libvirt-bin restart - - ## FIXME(ja): should LIBVIRT_TYPE be kvm if kvm module is loaded? - - # setup nova instance directory - mkdir -p $NOVA_DIR/instances - - # if there is a partition labeled nova-instances use it (ext filesystems - # can be labeled via e2label) - ## FIXME: if already mounted this blows up... - if [ -L /dev/disk/by-label/nova-instances ]; then - sudo mount -L nova-instances $NOVA_DIR/instances - sudo chown -R `whoami` $NOVA_DIR/instances - fi - - # Clean out the instances directory - rm -rf $NOVA_DIR/instances/* -fi - -if [[ "$ENABLED_SERVICES" =~ "n-net" ]]; then - # delete traces of nova networks from prior runs - killall dnsmasq || true - rm -rf $NOVA_DIR/networks - mkdir -p $NOVA_DIR/networks -fi - if [[ "$ENABLED_SERVICES" =~ "mysql" ]]; then # (re)create nova database mysql -u$MYSQL_USER -p$MYSQL_PASS -e 'DROP DATABASE nova;' || true @@ -364,6 +366,7 @@ if [[ "$ENABLED_SERVICES" =~ "mysql" ]]; then $NOVA_DIR/bin/nova-manage floating create $FLOATING_RANGE fi + # Keystone # -------- @@ -377,8 +380,11 @@ if [[ "$ENABLED_SERVICES" =~ "key" ]]; then cp $FILES/keystone.conf $KEYSTONE_CONF sudo sed -e "s,%SQL_CONN%,$BASE_SQL_CONN/keystone,g" -i $KEYSTONE_CONF + KEYSTONE_DATA=$KEYSTONE_DIR/bin/keystone_data.sh + cp $FILES/keystone_data.sh $KEYSTONE_DATA + sudo sed -e "s,%HOST_IP%,$HOST_IP,g" -i $KEYSTONE_DATA # initialize keystone with default users/endpoints - BIN_DIR=$KEYSTONE_DIR/bin bash $FILES/keystone_data.sh + BIN_DIR=$KEYSTONE_DIR/bin bash $KEYSTONE_DATA fi @@ -398,6 +404,10 @@ function screen_it { fi } +# create a new named screen to run processes in +screen -d -m -S nova -t nova +sleep 1 + screen_it g-api "cd $GLANCE_DIR; bin/glance-api --config-file=etc/glance-api.conf" screen_it g-reg "cd $GLANCE_DIR; bin/glance-registry --config-file=etc/glance-registry.conf" screen_it key "$KEYSTONE_DIR/bin/keystone --config-file $KEYSTONE_CONF"