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
This commit is contained in:
Martin André 2015-03-20 10:31:02 +09:00
parent 65683e5ed7
commit 888bb9cc8c
5 changed files with 33 additions and 23 deletions

7
.gitignore vendored
View File

@ -2,8 +2,13 @@
*~ *~
[._]*.s[a-w][a-z] [._]*.s[a-w][a-z]
# Any qcow images created from get-image script # Any disk images
*.qcow2 *.qcow2
*.img
.tox/ .tox/
.buildconf .buildconf
# Files generated by tools/genenv
openrc
openstack.env

View File

@ -2,12 +2,12 @@ Docker compose
============== ==============
These scripts and docker compose files can be used to stand up a simple 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 'openstack.env' suitable for running on a single host system as well as an
'openrc' to allow access to the installation. 'openrc' to allow access to the installation.
Once you have run that you can either manually start the containers using the 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 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 available. Once stood up you can issue the typical openstack commands to use
the installation: the installation:

View File

@ -7,18 +7,18 @@ compose directory.
To start, setup your environment variables. To start, setup your environment variables.
$ cd kolla $ 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 and an openrc file in your current directory. The openstack.env
file contains all of your initialized environment variables, which file contains all of your initialized environment variables, which
you can edit for a different setup. you can edit for a different setup.
Next, run the start script. 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 <osp-service-container> up -d`. using `docker-compose -f <osp-service-container> up -d`.
If you want to start a container set by hand use this template 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 <glance-api-container> $ sudo docker logs <glance-api-container>
$ docker-compose logs <glance-api-container> $ docker-compose logs <glance-api-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. 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 \ $ docker run --name glance-api -d \
--net=host --net=host

View File

@ -6,6 +6,10 @@
# #
# It also creates a suitable 'openrc' for use with the installed system. # 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}') | MY_IP=$(ip route get $(ip route | awk '$1 == "default" {print $3}') |
awk '$4 == "src" {print $5}') awk '$4 == "src" {print $5}')
@ -58,14 +62,14 @@ NOVA_PUBLIC_INTERFACE=$MY_DEV
NOVA_FLAT_INTERFACE=$MY_DEV NOVA_FLAT_INTERFACE=$MY_DEV
CONFIG_NETWORK=True CONFIG_NETWORK=True
cat > openrc <<EOF cat > ./openrc <<EOF
export OS_AUTH_URL="http://${KEYSTONE_PUBLIC_SERVICE_HOST}:5000/v2.0" export OS_AUTH_URL="http://${KEYSTONE_PUBLIC_SERVICE_HOST}:5000/v2.0"
export OS_USERNAME=$ADMIN_TENANT_NAME export OS_USERNAME=$ADMIN_TENANT_NAME
export OS_PASSWORD=$PASSWORD export OS_PASSWORD=$PASSWORD
export OS_TENANT_NAME=$ADMIN_TENANT_NAME export OS_TENANT_NAME=$ADMIN_TENANT_NAME
EOF EOF
cat > openstack.env <<EOF cat > ./compose/openstack.env <<EOF
ADMIN_TENANT_NAME=$ADMIN_TENANT_NAME ADMIN_TENANT_NAME=$ADMIN_TENANT_NAME
CONFIG_NETWORK=$CONFIG_NETWORK CONFIG_NETWORK=$CONFIG_NETWORK
DB_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD DB_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD

View File

@ -6,10 +6,9 @@
# services are up. You will also need these in order to interact with the # services are up. You will also need these in order to interact with the
# installation once started. # installation once started.
if [[ $EUID -ne 0 ]]; then # Move to top level directory
echo "You must execute this script as root." 1>&2 REAL_PATH=$(python -c "import os,sys;print os.path.realpath('$0')")
exit 1 cd "$(dirname "$REAL_PATH")/.."
fi
# Set SELinux to permissive # Set SELinux to permissive
setenforce permissive setenforce permissive
@ -27,30 +26,30 @@ MY_IP=$(ip route get $(ip route | awk '$1 == "default" {print $3}') |
awk '$4 == "src" {print $5}') awk '$4 == "src" {print $5}')
# Source openrc for commands # Source openrc for commands
source openrc source ./openrc
echo Starting rabbitmq. echo Starting rabbitmq.
docker-compose -f rabbitmq.yml up -d docker-compose -f ./compose/rabbitmq.yml up -d
echo Starting mariadb. echo Starting mariadb.
docker-compose -f mariadb.yml up -d docker-compose -f ./compose/mariadb.yml up -d
echo Starting keystone. echo Starting keystone.
docker-compose -f keystone.yml up -d docker-compose -f ./compose/keystone.yml up -d
echo Starting glance. echo Starting glance.
docker-compose -f glance-api-registry.yml up -d docker-compose -f ./compose/glance-api-registry.yml up -d
echo Starting nova. echo Starting nova.
docker-compose -f nova-api-conductor-scheduler.yml up -d docker-compose -f ./compose/nova-api-conductor-scheduler.yml up -d
echo Starting nova compute with nova networking. echo Starting nova compute with nova networking.
docker-compose -f nova-compute-network.yml up -d docker-compose -f ./compose/nova-compute-network.yml up -d
IMAGE_URL=http://download.cirros-cloud.net/0.3.3/ IMAGE_URL=http://download.cirros-cloud.net/0.3.3/
IMAGE=cirros-0.3.3-x86_64-disk.img IMAGE=cirros-0.3.3-x86_64-disk.img
if ! [ -f "$IMAGE" ]; then if ! [ -f "$IMAGE" ]; then
curl -o $IMAGE $IMAGE_URL/$IMAGE curl -o ./$IMAGE $IMAGE_URL/$IMAGE
fi fi
until keystone user-list | grep glance until keystone user-list | grep glance
@ -62,7 +61,7 @@ done
sleep 3 sleep 3
echo Creating glance image. echo Creating glance image.
glance image-create --name cirros --is-public false --disk-format qcow2 --container-format bare --file $IMAGE glance image-create --name cirros --is-public false --disk-format qcow2 --container-format bare --file ./$IMAGE
echo Example usage: echo Example usage:
echo echo