Skip to content
Snippets Groups Projects
start 2.28 KiB
Newer Older
  • Learn to ignore specific revisions
  • Steven Dake's avatar
    Steven Dake committed
    #!/bin/bash
    
    Ian Main's avatar
    Ian Main committed
    #
    # This script can be used to start a minimal set of containers that allows
    # you to boot an instance.  Note that it requires that you have some openstack
    # clients available: keystone, glance, and nova, as well as mysql to ensure
    # services are up.  You will also need these in order to interact with the
    # installation once started.
    
    
    # Move to top level directory
    REAL_PATH=$(python -c "import os,sys;print os.path.realpath('$0')")
    cd "$(dirname "$REAL_PATH")/.."
    
    Steven Dake's avatar
    Steven Dake committed
    # Set SELinux to permissive
    setenforce permissive
    
    # This directory is shared with the host to allow qemu instance
    # configs to remain accross restarts.  This is needed in the event libvirt
    # is not installed in the system.
    mkdir -p /etc/libvirt/qemu
    
    Ian Main's avatar
    Ian Main committed
    
    # This should probably go into nova-networking or nova-compute containers.
    
    Steven Dake's avatar
    Steven Dake committed
    # but you can't modprobe from a container for some reason
    
    Ian Main's avatar
    Ian Main committed
    modprobe ebtables
    
    MY_IP=$(ip route get $(ip route | awk '$1 == "default" {print $3}') |
        awk '$4 == "src" {print $5}')
    
    # Source openrc for commands
    
    Steven Dake's avatar
    Steven Dake committed
    echo Starting rabbitmq.
    
    docker-compose -f ./compose/rabbitmq.yml up -d
    
    Steven Dake's avatar
    Steven Dake committed
    echo Starting mariadb.
    
    docker-compose -f ./compose/mariadb.yml up -d
    
    Steven Dake's avatar
    Steven Dake committed
    echo Starting keystone.
    
    docker-compose -f ./compose/keystone.yml up -d
    
    Steven Dake's avatar
    Steven Dake committed
    echo Starting glance.
    
    docker-compose -f ./compose/glance-api-registry.yml up -d
    
    Steven Dake's avatar
    Steven Dake committed
    echo Starting nova.
    
    docker-compose -f ./compose/nova-api-conductor-scheduler.yml up -d
    
    Steven Dake's avatar
    Steven Dake committed
    echo Starting nova compute with nova networking.
    
    docker-compose -f ./compose/nova-compute-network.yml up -d
    
    Ian Main's avatar
    Ian Main committed
    
    IMAGE_URL=http://download.cirros-cloud.net/0.3.3/
    IMAGE=cirros-0.3.3-x86_64-disk.img
    if ! [ -f "$IMAGE" ]; then
    
    Steven Dake's avatar
    Steven Dake committed
        curl -L -o ./$IMAGE $IMAGE_URL/$IMAGE
    
    Steven Dake's avatar
    Steven Dake committed
    until keystone user-list | grep glance
    do
        echo "Waiting for OpenStack services to become available"
        sleep 2
    done
    
    Steven Dake's avatar
    Steven Dake committed
    sleep 3
    
    echo Creating glance image.
    
    glance image-create --name cirros --is-public false --disk-format qcow2 --container-format bare --file ./$IMAGE
    
    Steven Dake's avatar
    Steven Dake committed
    
    echo Example usage:
    echo
    echo nova secgroup-add-rule default tcp 22 22 0.0.0.0/0
    echo nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0
    echo nova network-create vmnet --fixed-range-v4=10.0.0.0/24 --bridge=br100 --multi-host=T
    echo
    echo nova keypair-add mykey > mykey.pem
    echo chmod 600 mykey.pem
    echo nova boot --flavor m1.medium --key_name mykey --image cirros kolla_vm