From 888bb9cc8c68bf61fddc0ca08a69f764a4012121 Mon Sep 17 00:00:00 2001 From: Martin André Date: Fri, 20 Mar 2015 10:31:02 +0900 Subject: Move genenv.sh and start.sh to tools directory Rename them `genenv` and `start`. Have `genenv` create the openrc file in the top-level directory. Add openrc and compose/openstack.env to gitignore, as well as *.img. Change-Id: I5d8006e97efd77cf364215f55d5e585139ae273e --- .gitignore | 7 +++- compose/README.md | 4 +- compose/genenv.sh | 106 ------------------------------------------------ compose/start.sh | 75 ---------------------------------- docs/developer-env.md | 12 +++--- tools/genenv | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++ tools/start | 74 +++++++++++++++++++++++++++++++++ 7 files changed, 199 insertions(+), 189 deletions(-) delete mode 100755 compose/genenv.sh delete mode 100755 compose/start.sh create mode 100755 tools/genenv create mode 100755 tools/start diff --git a/.gitignore b/.gitignore index 8dcc4f5b7..08d55d211 100644 --- a/.gitignore +++ b/.gitignore @@ -2,8 +2,13 @@ *~ [._]*.s[a-w][a-z] -# Any qcow images created from get-image script +# Any disk images *.qcow2 +*.img .tox/ .buildconf + +# Files generated by tools/genenv +openrc +openstack.env diff --git a/compose/README.md b/compose/README.md index ba0ce74e5..a513f78a0 100644 --- a/compose/README.md +++ b/compose/README.md @@ -2,12 +2,12 @@ Docker compose ============== These scripts and docker compose files can be used to stand up a simple -installation of openstack. Running the 'genenv.sh' script creates an +installation of openstack. Running the 'tools/genenv' script creates an 'openstack.env' suitable for running on a single host system as well as an 'openrc' to allow access to the installation. Once you have run that you can either manually start the containers using the -'docker-compose' command or try the 'start.sh' script which tries to start them +'docker-compose' command or try the 'tools/start' script which tries to start them all in a reasonable order, waiting at key points for services to become available. Once stood up you can issue the typical openstack commands to use the installation: diff --git a/compose/genenv.sh b/compose/genenv.sh deleted file mode 100755 index dc1e52f80..000000000 --- a/compose/genenv.sh +++ /dev/null @@ -1,106 +0,0 @@ -#!/bin/bash -# -# This script generates a minimal set of environment variables to allow -# the openstack containers to operate. It is creating a configuration -# suitable for an all-in-one installation of openstack. -# -# It also creates a suitable 'openrc' for use with the installed system. - -MY_IP=$(ip route get $(ip route | awk '$1 == "default" {print $3}') | - awk '$4 == "src" {print $5}') - -MY_DEV=$(ip route get $(ip route | awk '$1 == "default" {print $3}') | - awk '$4 == "src" {print $3}') - -echo MY_IP=$MY_IP -echo MY_DEV=$MY_DEV - -# Database -HOST_IP=$MY_IP -MYSQL_ROOT_PASSWORD=kolla -PASSWORD=12345 - -# Host -ADMIN_TENANT_NAME=admin -PUBLIC_IP=$HOST_IP - -# RabbitMQ -RABBITMQ_SERVICE_HOST=$HOST_IP -RABBIT_USER=guest -RABBIT_PASSWORD=guest - -# Keystone -KEYSTONE_ADMIN_TOKEN=$PASSWORD -KEYSTONE_DB_PASSWORD=kolla -KEYSTONE_ADMIN_PASSWORD=$PASSWORD -KEYSTONE_PUBLIC_SERVICE_HOST=$HOST_IP -KEYSTONE_ADMIN_SERVICE_HOST=$HOST_IP -KEYSTONE_AUTH_PROTOCOL=http - -# Glance -GLANCE_DB_NAME=glance -GLANCE_DB_USER=glance -GLANCE_DB_PASSWORD=kolla -GLANCE_KEYSTONE_USER=glance -GLANCE_KEYSTONE_PASSWORD=glance -GLANCE_API_SERVICE_HOST=$HOST_IP -GLANCE_REGISTRY_SERVICE_HOST=$HOST_IP - -# Nova -NOVA_DB_PASSWORD=nova -NOVA_DB_NAME=nova -NOVA_DB_USER=nova -NOVA_KEYSTONE_USER=nova -NOVA_KEYSTONE_PASSWORD=nova -NOVA_API_SERVICE_HOST=$HOST_IP -NOVA_EC2_SERVICE_HOST=$HOST_IP -NOVA_PUBLIC_INTERFACE=$MY_DEV -NOVA_FLAT_INTERFACE=$MY_DEV -CONFIG_NETWORK=True - -cat > openrc < openstack.env <&2 - exit 1 -fi - -# 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 - -# This should probably go into nova-networking or nova-compute containers. -# but you can't modprobe from a container for some reason -modprobe ebtables - -MY_IP=$(ip route get $(ip route | awk '$1 == "default" {print $3}') | - awk '$4 == "src" {print $5}') - -# Source openrc for commands -source openrc - -echo Starting rabbitmq. -docker-compose -f rabbitmq.yml up -d - -echo Starting mariadb. -docker-compose -f mariadb.yml up -d - -echo Starting keystone. -docker-compose -f keystone.yml up -d - -echo Starting glance. -docker-compose -f glance-api-registry.yml up -d - -echo Starting nova. -docker-compose -f nova-api-conductor-scheduler.yml up -d - -echo Starting nova compute with nova networking. -docker-compose -f nova-compute-network.yml up -d - -IMAGE_URL=http://download.cirros-cloud.net/0.3.3/ -IMAGE=cirros-0.3.3-x86_64-disk.img -if ! [ -f "$IMAGE" ]; then - curl -o $IMAGE $IMAGE_URL/$IMAGE -fi - -until keystone user-list | grep glance -do - echo "Waiting for OpenStack services to become available" - sleep 2 -done - -sleep 3 - -echo Creating glance image. -glance image-create --name cirros --is-public false --disk-format qcow2 --container-format bare --file $IMAGE - -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 diff --git a/docs/developer-env.md b/docs/developer-env.md index fe1916bb6..3d31aa530 100644 --- a/docs/developer-env.md +++ b/docs/developer-env.md @@ -7,18 +7,18 @@ compose directory. To start, setup your environment variables. $ cd kolla - $ ./tools/genenv.sh + $ ./tools/genenv -The `genenv.sh` script will create an openstack.env file +The `genenv` script will create a compose/openstack.env file and an openrc file in your current directory. The openstack.env file contains all of your initialized environment variables, which you can edit for a different setup. Next, run the start script. - $ ./start.sh + $ ./tools/start -The `start.sh` script is responsible for starting the containers +The `start` script is responsible for starting the containers using `docker-compose -f up -d`. If you want to start a container set by hand use this template @@ -36,7 +36,9 @@ If any of the containers exited you can check the logs by doing $ sudo docker logs $ docker-compose logs -If you want to start a individual service like `glance-api` by hand, then use this template. This is a good method to test and troubleshoot an individual container. +If you want to start a individual service like `glance-api` by hand, then use +this template. This is a good method to test and troubleshoot an individual +container. $ docker run --name glance-api -d \ --net=host diff --git a/tools/genenv b/tools/genenv new file mode 100755 index 000000000..91ac42cc4 --- /dev/null +++ b/tools/genenv @@ -0,0 +1,110 @@ +#!/bin/bash +# +# This script generates a minimal set of environment variables to allow +# the openstack containers to operate. It is creating a configuration +# suitable for an all-in-one installation of openstack. +# +# It also creates a suitable 'openrc' for use with the installed system. + +# Move to top level directory +REAL_PATH=$(python -c "import os,sys;print os.path.realpath('$0')") +cd "$(dirname "$REAL_PATH")/.." + +MY_IP=$(ip route get $(ip route | awk '$1 == "default" {print $3}') | + awk '$4 == "src" {print $5}') + +MY_DEV=$(ip route get $(ip route | awk '$1 == "default" {print $3}') | + awk '$4 == "src" {print $3}') + +echo MY_IP=$MY_IP +echo MY_DEV=$MY_DEV + +# Database +HOST_IP=$MY_IP +MYSQL_ROOT_PASSWORD=kolla +PASSWORD=12345 + +# Host +ADMIN_TENANT_NAME=admin +PUBLIC_IP=$HOST_IP + +# RabbitMQ +RABBITMQ_SERVICE_HOST=$HOST_IP +RABBIT_USER=guest +RABBIT_PASSWORD=guest + +# Keystone +KEYSTONE_ADMIN_TOKEN=$PASSWORD +KEYSTONE_DB_PASSWORD=kolla +KEYSTONE_ADMIN_PASSWORD=$PASSWORD +KEYSTONE_PUBLIC_SERVICE_HOST=$HOST_IP +KEYSTONE_ADMIN_SERVICE_HOST=$HOST_IP +KEYSTONE_AUTH_PROTOCOL=http + +# Glance +GLANCE_DB_NAME=glance +GLANCE_DB_USER=glance +GLANCE_DB_PASSWORD=kolla +GLANCE_KEYSTONE_USER=glance +GLANCE_KEYSTONE_PASSWORD=glance +GLANCE_API_SERVICE_HOST=$HOST_IP +GLANCE_REGISTRY_SERVICE_HOST=$HOST_IP + +# Nova +NOVA_DB_PASSWORD=nova +NOVA_DB_NAME=nova +NOVA_DB_USER=nova +NOVA_KEYSTONE_USER=nova +NOVA_KEYSTONE_PASSWORD=nova +NOVA_API_SERVICE_HOST=$HOST_IP +NOVA_EC2_SERVICE_HOST=$HOST_IP +NOVA_PUBLIC_INTERFACE=$MY_DEV +NOVA_FLAT_INTERFACE=$MY_DEV +CONFIG_NETWORK=True + +cat > ./openrc < ./compose/openstack.env < mykey.pem +echo chmod 600 mykey.pem +echo nova boot --flavor m1.medium --key_name mykey --image cirros kolla_vm -- cgit v1.2.3