<commit_before>#!/bin/bash -x
#
# 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.

setenforce 0

# This should probably go into nova-networking or nova-compute containers.
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 and mariadb
docker-compose -f rabbitmq.yml up -d
docker-compose -f mariadb.yml up -d

until mysql -u root --password=<PASSWORD> --host=$MY_IP mysql -e "show tables;"
do
    echo waiting for mysql..
    sleep 3
done

echo Starting keystone
docker-compose -f keystone.yml up -d

until keystone user-list
do
    echo waiting for keystone..
    sleep 3
done

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

# I think we'll need this..
#
# until mysql -u root --password=<PASSWORD> --host=$MY_IP mysql -e "use nova;"
# do
#     echo waiting for nova db.
#     sleep 3
# done

echo "Waiting for nova-api to create keystone user.."
until keystone user-list | grep nova
do
    echo waiting for keystone nova user
    sleep 2
done

# This directory is shared with the host to allow qemu instance
# configs to remain accross restarts.
mkdir -p /etc/libvirt/qemu

echo Starting nova compute

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

echo "Creating glance image.."
glance image-create --name "puffy_clouds" --is-public true --disk-format qcow2 --container-format bare --file $IMAGE

# Example usage:
#
# nova secgroup-add-rule default tcp 22 22 0.0.0.0/0
# nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0
# nova network-create vmnet --fixed-range-v4=10.0.0.0/24 --bridge=br100 --multi-host=T
#
# nova keypair-add mykey > mykey.pem
# chmod 600 mykey.pem
# nova boot --flavor m1.medium --key_name mykey --image puffy_clouds newInstanceName<commit_msg>Update start.sh<commit_after>#!/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.

# 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
{'fraction_non_alphanumeric': 0.09895717772354116, 'fraction_numerical': 0.021965830929664965, 'mean_word_length': 3.5034965034965033, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1305101', 'n_tokens_mistral': 1593, 'n_tokens_neox': 1497, 'n_words': 584}