diff --git a/compose/README.md b/compose/README.md index a513f78a09557d7185ea187dfc806c10f4360993..a60e3b883ab8b79e49efc18fcf52f6e862c684c3 100644 --- a/compose/README.md +++ b/compose/README.md @@ -7,10 +7,10 @@ installation of openstack. Running the 'tools/genenv' script creates 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 '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: +'docker-compose' command or try the 'tools/kolla 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: ``` # source openrc diff --git a/devenv/README.md b/devenv/README.md index 1f6d149f8a6e48a78756fd4164f6d04514abbc0f..ab9f10cbc5505e9738bf3a90b3e2f0d360feace4 100644 --- a/devenv/README.md +++ b/devenv/README.md @@ -127,7 +127,7 @@ you can edit for a different setup. Next, run the start script. - $ ./tools/start + $ ./tools/kolla start The `start` script is responsible for starting the containers using `docker-compose -f <osp-service-container> up -d`. diff --git a/docs/developer-env.md b/docs/developer-env.md index 165d37bade44fc61668fcdc3ca39e4fd56e7f73e..c582c36aa7950a4af1df70ff2c3fba7745f8b210 100644 --- a/docs/developer-env.md +++ b/docs/developer-env.md @@ -61,7 +61,7 @@ you can edit for a different setup. Next, run the start script. - $ ./tools/start + $ ./tools/kolla start The `start` script is responsible for starting the containers using `docker-compose -f <osp-service-container> up -d`. diff --git a/tools/kolla b/tools/kolla new file mode 100755 index 0000000000000000000000000000000000000000..d8ebf508ecf942a5931a1f32a8df701892dd9b70 --- /dev/null +++ b/tools/kolla @@ -0,0 +1,140 @@ +#!/bin/bash +# +# This script can be used to interact with kolla. + +if [[ $EUID -ne 0 ]]; then + echo "You must execute this script as root." 1>&2 + exit 1 +fi + +# Move to top level directory +REAL_PATH=$(python -c "import os,sys;print os.path.realpath('$0')") +cd "$(dirname "$REAL_PATH")/.." + +NETWORK_MANAGER=$(grep -sri NETWORK_MANAGER ./compose/openstack.env | cut -f2 -d'=') +if [[ -z "$NETWORK_MANAGER" ]]; then + echo 'No network manager defined in ./compose/openstack.env, defaulting to "neutron".' + NETWORK_MANAGER="neutron" +fi + +function process { + local service=$1 + echo "$ACTION $service" + docker-compose -f ./compose/${service}.yml $COMPOSE_CMD +} + +function process_all { + process rabbit + process mariadb + process keystone + process glance-api-registry + process nova-api-conductor-scheduler + if [[ "${NETWORK_MANAGER}" == "nova" ]] ; then + process nova-compute-network + else + # Defaulting to neutron + process nova-compute + process neutron-server + process neutron-agents + fi + process heat-api-engine + process horizon +} + +function check_selinux { + # Check for SELinux in Enforcing mode and exit if found + if [[ -x /usr/sbin/getenforce ]]; then + if [[ $(/usr/sbin/getenforce) == "Enforcing" ]]; then + echo "You must execute this script without SELinux enforcing mode." + echo "Turn off SELinux enforcing mode by running:" + echo "$ sudo setenforce permissive" + exit 1 + fi + fi +} + +function pre_start { + check_selinux + + if [[ -r ./openrc ]]; then + # Source openrc for commands + source ./openrc + else + echo 'Could not find ./openrc; bootstrap your environment with "./tools/genenv".' + exit 1 + fi +} + +function post_start { + IMAGE_URL=http://download.cirros-cloud.net/0.3.3/ + IMAGE=cirros-0.3.3-x86_64-disk.img + if ! [ -f "$IMAGE" ]; then + curl -L -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 +} + +function usage { + cat <<EOF +Usage: $0 COMMAND + +Commands: + pull Pull all of the Docker images + start Start all kolla containers + status List running kolla containers + stop Stop all kolla containers +EOF +} + +case "$1" in + +(pull) + ACTION="Pulling" + COMPOSE_CMD="pull" + process_all + ;; + +(start) + ACTION="Starting" + COMPOSE_CMD="up -d" + pre_start + process_all + post_start + ;; + +(status) + ACTION="Status of" + COMPOSE_CMD="ps" + process_all + ;; + +(stop) + ACTION="Stopping" + COMPOSE_CMD="stop" + process_all + ;; + +(*) usage + exit 0 + ;; +esac diff --git a/tools/pull b/tools/pull deleted file mode 100755 index a07e829eeec509dd78d4a1d656b54c3bbb2710b9..0000000000000000000000000000000000000000 --- a/tools/pull +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/bash -# -# This script can be used to pull all of the docker images for the -# containers that compose Kolla. This is primarily used to update -# containers after a rebuild. Run with the option docker or compose -# to select the pull tool. - -if [[ $EUID -ne 0 ]]; then - echo "You must execute this script as root." 1>&2 - exit 1 -fi - -usage () { - cat <<EOF -Usage: $0 [mode] - -Options: - ---docker, -d - Pull with docker client ---compose, -c - Pull with docker-compose client -EOF -} - -case "$1" in - -(''|--help|-h) usage - exit 0 - ;; - -(--docker|-d) - shift - PULL_TOOL=docker - ;; - -(--compose|-c) - shift - PULL_TOOL=compose - ;; -esac - -# Move to top level directory -REAL_PATH=$(python -c "import os,sys;print os.path.realpath('$0')") -cd "$(dirname "$REAL_PATH")/.." - -if [[ "${PULL_TOOL}" == 'compose' ]]; then - - echo Pulling with docker-compose. - echo Pulling rabbitmq. - docker-compose -f ./compose/rabbitmq.yml pull - - echo Pulling mariadb. - docker-compose -f ./compose/mariadb.yml pull - - echo Pulling keystone. - docker-compose -f ./compose/keystone.yml pull - - echo Pulling glance. - docker-compose -f ./compose/glance-api-registry.yml pull - - echo Pulling nova controller. - docker-compose -f ./compose/nova-api-conductor-scheduler.yml pull - - echo Pulling nova compute with nova networking. - docker-compose -f ./compose/nova-compute-network.yml pull - - echo Pulling heat. - docker-compose -f ./compose/heat-api-engine.yml pull - - echo Pulling Horizon. - docker-compose -f ./compose/horizon.yml pull -fi - -if [[ "${PULL_TOOL}" == 'docker' ]]; then - echo Pulling mariadb. - docker pull kollaglue/centos-rdo-mariadb-data - docker pull kollaglue/centos-rdo-mariadb-app - - echo Pulling keystone. - docker pull kollaglue/centos-rdo-keystone - - echo Pulling glance. - docker pull kollaglue/centos-rdo-glance-api - docker pull kollaglue/centos-rdo-glance-registry - - echo Pulling nova controller. - docker pull kollaglue/centos-rdo-nova-conductor - docker pull kollaglue/centos-rdo-nova-api - docker pull kollaglue/centos-rdo-nova-scheduler - - echo Pulling nova compute with nova networking. - docker pull kollaglue/centos-rdo-nova-compute-data - docker pull kollaglue/centos-rdo-nova-libvirt - docker pull kollaglue/centos-rdo-nova-network - docker pull kollaglue/centos-rdo-nova-compute - - echo Pulling heat. - docker pull kollaglue/centos-rdo-heat-api - docker pull kollaglue/centos-rdo-heat-engine - - echo Pulling horizon. - docker pull kollaglue/centos-rdo-horizon -fi diff --git a/tools/start b/tools/start deleted file mode 100755 index f5f8af8e34dc1944024f3935d5977fb04ca64143..0000000000000000000000000000000000000000 --- a/tools/start +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/bash -# -# 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. - -if [[ $EUID -ne 0 ]]; then - echo "You must execute this script as root." 1>&2 - exit 1 -fi - -# Move to top level directory -REAL_PATH=$(python -c "import os,sys;print os.path.realpath('$0')") -cd "$(dirname "$REAL_PATH")/.." - -# Check for SELinux in Enforcing mode and exit if found -if [[ -x /usr/sbin/getenforce ]]; then - if [[ $(/usr/sbin/getenforce) == "Enforcing" ]]; then - echo "You must execute this script without SELinux enforcing mode." - echo "Turn off SELinux enforcing mode by running:" - echo "$ sudo setenforce permissive" - exit 1 - fi -fi - -MY_IP=$(ip route get $(ip route | awk '$1 == "default" {print $3}') | - awk '$4 == "src" {print $5}') - -NETWORK_MANAGER=$(grep -ri NETWORK_MANAGER compose/openstack.env | cut -f2 -d'=') - -# Source openrc for commands -source ./openrc - -echo Starting rabbitmq. -docker-compose -f ./compose/rabbitmq.yml up -d - -echo Starting mariadb. -docker-compose -f ./compose/mariadb.yml up -d - -echo Starting keystone. -docker-compose -f ./compose/keystone.yml up -d - -echo Starting glance. -docker-compose -f ./compose/glance-api-registry.yml up -d - -echo Starting nova. -docker-compose -f ./compose/nova-api-conductor-scheduler.yml up -d - -if [[ "${NETWORK_MANAGER}" == "nova" ]] ; then - echo Starting nova compute with nova networking. - docker-compose -f ./compose/nova-compute-network.yml up -d -elif [[ "${NETWORK_MANAGER}" == "neutron" ]] ; then - echo Starting nova compute with neutron networking. - docker-compose -f ./compose/nova-compute.yml up -d - docker-compose -f ./compose/neutron-server.yml up -d - docker-compose -f ./compose/neutron-agents.yml up -d -fi - -echo Starting heat. -docker-compose -f ./compose/heat-api-engine.yml up -d - -echo Starting Horizon. -docker-compose -f ./compose/horizon.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 -L -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/tools/status b/tools/status deleted file mode 100755 index 8a1a18f7cefad63353702acde8b6f4c42432d8cd..0000000000000000000000000000000000000000 --- a/tools/status +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash -# -# This script can be used to check the Kolla containers deployed -# from the start script. - -if [[ $EUID -ne 0 ]]; then - echo "You must execute this script as root." 1>&2 - exit 1 -fi - -# Move to top level directory -REAL_PATH=$(python -c "import os,sys;print os.path.realpath('$0')") -cd "$(dirname "$REAL_PATH")/.." - -# Check what network manager is set in the ENV file. -NETWORK_MANAGER=$(grep -ri NETWORK_MANAGER compose/openstack.env | cut -f2 -d'=') - -echo Checking rabbitmq. -docker-compose -f ./compose/rabbitmq.yml ps - -echo Checking mariadb. -docker-compose -f ./compose/mariadb.yml ps - -echo Checking keystone. -docker-compose -f ./compose/keystone.yml ps - -echo Checking glance. -docker-compose -f ./compose/glance-api-registry.yml ps - -echo Checking nova. -docker-compose -f ./compose/nova-api-conductor-scheduler.yml ps - -if [[ "${NETWORK_MANAGER}" == "nova" ]] ; then - echo Checking nova compute with nova networking. - docker-compose -f ./compose/nova-compute-network.yml ps -elif [[ "${NETWORK_MANAGER}" == "neutron" ]] ; then - echo Checking nova compute with neutron networking. - docker-compose -f ./compose/nova-compute.yml ps - docker-compose -f ./compose/neutron-server.yml ps - docker-compose -f ./compose/neutron-agents.yml ps -fi - -echo Checking heat. -docker-compose -f ./compose/heat-api-engine.yml ps - -echo Checking Horizon. -docker-compose -f ./compose/horizon.yml ps diff --git a/tools/stop b/tools/stop deleted file mode 100755 index 3a3db3d51610e63d23e631cc0625bed2a2e1bc50..0000000000000000000000000000000000000000 --- a/tools/stop +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -# -# 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")/.." - -NETWORK_MANAGER=$(grep -ri NETWORK_MANAGER compose/openstack.env | cut -f2 -d'=') - -echo Stopping rabbitmq. -docker-compose -f ./compose/rabbitmq.yml stop - -echo Stopping mariadb. -docker-compose -f ./compose/mariadb.yml stop - -echo Stopping keystone. -docker-compose -f ./compose/keystone.yml stop - -echo Stopping glance. -docker-compose -f ./compose/glance-api-registry.yml stop - -echo Stopping nova. -docker-compose -f ./compose/nova-api-conductor-scheduler.yml stop - -if [[ "${NETWORK_MANAGER}" == "nova" ]] ; then - echo Stopping nova compute with nova networking. - docker-compose -f ./compose/nova-compute-network.yml stop -elif [[ "${NETWORK_MANAGER}" == "neutron" ]] ; then - echo Stopping nova compute with neutron networking. - docker-compose -f ./compose/nova-compute.yml stop - docker-compose -f ./compose/neutron-server.yml up -d - docker-compose -f ./compose/neutron-agents.yml stop -fi - -echo Stopping heat. -docker-compose -f ./compose/heat-api-engine.yml stop - -echo Stopping Horizon. -docker-compose -f ./compose/horizon.yml stop