diff options
| author | Sam Yaple <sam@yaple.net> | 2015-05-13 06:46:24 -0500 |
|---|---|---|
| committer | Sam Yaple <sam@yaple.net> | 2015-05-15 01:32:22 -0500 |
| commit | 13062e23e86b5d86020949754540460cb5b0b4fe (patch) | |
| tree | e0b3c8411418949a3d8df221da7c8cb2831b6d5d /docker/centos/binary | |
| parent | 354ba01c8f5c7e1695cbea3bfc07aee5b75e76d9 (diff) | |
| download | kolla-13062e23e86b5d86020949754540460cb5b0b4fe.tar.gz kolla-13062e23e86b5d86020949754540460cb5b0b4fe.zip | |
Restructure builds to allow more flexibility
As a restructure, nothing is changed from the original behaviour and
naming despite the file structure changing. The symlinks to build had
to be updated generating lots of "deleted" and "new_file".
The new structure is:
docker/${base_distro}/${type}/${container}
base_distro == centos, ubuntu, fedora, etc
type == source, binary, rdo
type rdo is a symlink to binary for backwards compatibility
Two new flags are added to the build-all script to support the ability
to support different base distros and a flag to support binary or source
containers.
There are several added folders that are empty to hold the directory
structure for future containers of these types.
To use a prefix other than centos-rdo- you can set PREFIX in the toplevel
directory .buildconf file
Change-Id: Ifc7bac0d827470f506c8b5c004a833da9ce13b90
Diffstat (limited to 'docker/centos/binary')
173 files changed, 3724 insertions, 0 deletions
diff --git a/docker/centos/binary/barbican/Dockerfile b/docker/centos/binary/barbican/Dockerfile new file mode 100644 index 000000000..0a124dc38 --- /dev/null +++ b/docker/centos/binary/barbican/Dockerfile @@ -0,0 +1,40 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +ADD ./start.sh /start.sh + +# Install required packages +# NOTE: these packages (tar especially) can be pruned once converted to +# installation via RPM: https://bugs.launchpad.net/kolla/+bug/1453926 +RUN yum install -y gcc Cython sqlite-devel mysql-devel libffi-devel tar && yum clean all + +# use the Barbican Juno version +# setting this as environment variable also keeps pbr version checking happy +# TODO: when the Barbican rpm from cloudkeep.io is usable, +# switch to using that instead +ENV PBR_VERSION 2014.2 + +# Get and extract the Barbican tar ball +RUN curl -o /barbican-$PBR_VERSION.tar.gz https://github.com/openstack/barbican/archive/$PBR_VERSION.tar.gz -L +RUN tar -xzf barbican-$PBR_VERSION.tar.gz + +# Install Barbican requirements +RUN pip install -r barbican-$PBR_VERSION/requirements.txt +RUN pip install MySQL-python + +# Install Barbican +RUN cd barbican-$PBR_VERSION && python setup.py install + +# Configure Barbican +RUN mkdir -p /etc/barbican +RUN mkdir -p /var/log/barbican +RUN cp -r /barbican-$PBR_VERSION/etc/barbican/* /etc/barbican + +# Instal uwsgi as that is what we will use to run Barbican +RUN pip install uwsgi + +# Cleanup files not required anymore +RUN rm -rf /barbican-$PBR_VERSION +RUN rm -rf /barbican-$PBR_VERSION.tar.gz + +CMD ["/start.sh"] diff --git a/docker/centos/binary/barbican/build b/docker/centos/binary/barbican/build new file mode 120000 index 000000000..8d652f7ee --- /dev/null +++ b/docker/centos/binary/barbican/build @@ -0,0 +1 @@ +../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/barbican/start.sh b/docker/centos/binary/barbican/start.sh new file mode 100755 index 000000000..673aa4339 --- /dev/null +++ b/docker/centos/binary/barbican/start.sh @@ -0,0 +1,81 @@ +#!/bin/bash + +set -e + +: ${BARBICAN_DB_USER:=barbican} +: ${BARBICAN_DB_NAME:=barbican} +: ${KEYSTONE_AUTH_PROTOCOL:=http} +: ${BARBICAN_KEYSTONE_USER:=barbican} +: ${ADMIN_TENANT_NAME:=admin} + +if ! [ "$BARBICAN_DB_PASSWORD" ]; then + BARBICAN_DB_PASSWORD=$(openssl rand -hex 15) + export BARBICAN_DB_PASSWORD +fi + +check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \ + KEYSTONE_ADMIN_SERVICE_PORT BARBICAN_ADMIN_PASSWORD +fail_unless_db +fail_unless_os_service_running keystone + +mysql -h ${MARIADB_SERVICE_HOST} -u root -p"${DB_ROOT_PASSWORD}" mysql <<EOF +CREATE DATABASE IF NOT EXISTS ${BARBICAN_DB_NAME}; +GRANT ALL PRIVILEGES ON barbican.* TO + '${BARBICAN_DB_USER}'@'%' IDENTIFIED BY '${BARBICAN_DB_PASSWORD}' +EOF + +# config file setup +crudini --set /etc/barbican/barbican-api.conf \ + DEFAULT \ + sql_connection \ + "mysql://${BARBICAN_DB_USER}:${BARBICAN_DB_PASSWORD}@${MARIADB_SERVICE_HOST}/${BARBICAN_DB_NAME}" +crudini --set /etc/barbican/barbican-api.conf \ + DEFAULT \ + log_dir \ + "/var/log/barbican/" +crudini --set /etc/barbican/barbican-api.conf \ + DEFAULT \ + log_file \ + "/var/log/barbican/barbican.log" +crudini --set /etc/barbican/barbican-api-paste.ini \ + pipeline:barbican_api \ + pipeline \ + "keystone_authtoken context apiapp" +crudini --set /etc/barbican/barbican-api-paste.ini \ + filter:keystone_authtoken \ + auth_host \ + ${KEYSTONE_ADMIN_SERVICE_HOST} +crudini --set /etc/barbican/barbican-api-paste.ini \ + filter:keystone_authtoken \ + auth_port \ + ${KEYSTONE_ADMIN_SERVICE_PORT} +crudini --set /etc/barbican/barbican-api-paste.ini \ + filter:keystone_authtoken \ + auth_protocol \ + ${KEYSTONE_AUTH_PROTOCOL} +crudini --set /etc/barbican/barbican-api-paste.ini \ + filter:keystone_authtoken \ + admin_tenant_name \ + ${ADMIN_TENANT_NAME} +crudini --set /etc/barbican/barbican-api-paste.ini \ + filter:keystone_authtoken \ + admin_user \ + ${BARBICAN_KEYSTONE_USER} +crudini --set /etc/barbican/barbican-api-paste.ini \ + filter:keystone_authtoken \ + admin_password \ + ${BARBICAN_KEYSTONE_USER} + +# create the required keystone entities for barbican +export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}" +export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:${KEYSTONE_ADMIN_SERVICE_PORT}/v2.0" + +keystone user-get ${BARBICAN_KEYSTONE_USER} > /dev/null 2>&1 || /bin/keystone user-create --name ${BARBICAN_KEYSTONE_USER} --pass ${BARBICAN_ADMIN_PASSWORD} + +keystone role-get observer > /dev/null 2>&1 || /bin/keystone role-create --name observer +keystone role-get creator > /dev/null 2>&1 || /bin/keystone role-create --name creator + +keystone user-get ${BARBICAN_KEYSTONE_USER} > /dev/null 2>&1 || /bin/keystone user-role-add --user ${BARBICAN_KEYSTONE_USER} --role admin --tenant ${ADMIN_TENANT_NAME} + +# launch Barbican using uwsgi +exec uwsgi --master --emperor /etc/barbican/vassals diff --git a/docker/centos/binary/base/kolla-common.sh b/docker/centos/binary/base/kolla-common.sh new file mode 100644 index 000000000..8c2ef5ec1 --- /dev/null +++ b/docker/centos/binary/base/kolla-common.sh @@ -0,0 +1,170 @@ +#!/bin/bash + +. /opt/kolla/service_hosts.sh + +# Set some generally useful defaults. +MY_IP=$(ip route get $(ip route | awk '$1 == "default" {print $3}') | + awk '$4 == "src" {print $5}') + +: ${PUBLIC_IP:=${MY_IP}} + +# Iterate over a list of variable names and exit if one is +# undefined. +check_required_vars() { + for var in $*; do + if [ -z "${!var}" ]; then + echo "ERROR: missing $var" >&2 + exit 1 + fi + done +} + +# The usage of the wait_for function looks like the following +# wait_for LOOPS_NUMBER SLEEP_TIME ARGS +# +# The ARGS are read and concatenated together into a single command and the +# command is executed in a loop until it succeeds or reaches the max number of +# attempts (LOOPS_NUMBER). +# +# Optional variables SUCCESSFUL_MATCH_OUTPUT and FAIL_MATCH_OUTPUT variable may +# also be set to control if the loop exits early if the commands stdout/stderr +# matches the supplied regex string. Consider using the `wait_for_output` and +# `wait_for_output_unless` functions in case there is a need to check for the +# command output. +# +# The script exits on failure, either when output contains string identified as +# failure, or when it reaches a timeout. +# +# Examples: +# wait_for 30 10 ping -c 1 192.0.2.2 +# wait_for 10 1 ls file_we_are_waiting_for +# wait_for 10 3 date \| grep 8 +wait_for() { + local loops=${1:-""} + local sleeptime=${2:-""} + FAIL_MATCH_OUTPUT=${FAIL_MATCH_OUTPUT:-""} + SUCCESSFUL_MATCH_OUTPUT=${SUCCESSFUL_MATCH_OUTPUT:-""} + shift 2 || true + local command="$@" + + if [ -z "$loops" -o -z "$sleeptime" -o -z "$command" ]; then + echo "wait_for is missing a required parameter" + exit 1 + fi + + local i=0 + while [ $i -lt $loops ]; do + i=$((i + 1)) + local status=0 + local output=$(eval $command 2>&1) || status=$? + if [[ -n "$SUCCESSFUL_MATCH_OUTPUT" ]] \ + && [[ $output =~ $SUCCESSFUL_MATCH_OUTPUT ]]; then + return 0 + elif [[ -n "$FAIL_MATCH_OUTPUT" ]] \ + && [[ $output =~ $FAIL_MATCH_OUTPUT ]]; then + echo "Command output matched '$FAIL_MATCH_OUTPUT'." + exit 1 + elif [[ -z "$SUCCESSFUL_MATCH_OUTPUT" ]] && [[ $status -eq 0 ]]; then + return 0 + fi + sleep $sleeptime + done + local seconds=$((loops * sleeptime)) + printf 'Timing out after %d seconds:\ncommand=%s\nOUTPUT=%s\n' \ + "$seconds" "$command" "$output" + exit 1 +} + +# Helper function to `wait_for` that only succeeds when the given regex is +# matching the command's output. Exit early with a failure when the second +# supplied regexp is matching the output. +# +# Example: +# wait_for_output_unless CREATE_COMPLETE CREATE_FAIL 30 10 heat stack-show undercloud +wait_for_output_unless() { + SUCCESSFUL_MATCH_OUTPUT=$1 + FAIL_MATCH_OUTPUT=$2 + shift 2 + wait_for $@ + local status=$? + unset SUCCESSFUL_MATCH_OUTPUT + unset FAIL_MATCH_OUTPUT + return $status +} + +# Helper function to `wait_for` that only succeeds when the given regex is +# matching the command's output. +# +# Example: +# wait_for_output CREATE_COMPLETE 30 10 heat stack-show undercloud +wait_for_output() { + local expected_output=$1 + shift + wait_for_output_unless $expected_output '' $@ +} + +# Check if we receive a successful response from corresponding OpenStack +# service endpoint. +check_for_os_service_endpoint() { + local name=$1 + local host_var=$2 + local port_var=$3 + local api_version=$4 + + check_required_vars $host_var $port_var + + local endpoint="http://${!host_var}:${!port_var}/$api_version" + + curl -sf -o /dev/null "$endpoint" || { + echo "ERROR: $name is not available @ $endpoint" >&2 + return 1 + } + + echo "$name is active @ $endpoint" +} + +check_for_os_service_running() { + local service=$1 + local args= + case $service in + ("glance") args="GLANCE_API_SERVICE_HOST GLANCE_API_SERVICE_PORT" ;; + ("keystone") args="KEYSTONE_PUBLIC_SERVICE_HOST KEYSTONE_PUBLIC_SERVICE_PORT v2.0" ;; + ("neutron") args="NEUTRON_SERVER_SERVICE_HOST NEUTRON_SERVER_SERVICE_PORT" ;; + ("nova") args="NOVA_API_SERVICE_HOST NOVA_API_SERVICE_PORT" ;; + (*) + echo "Unknown service $service" + return 1 ;; + esac + check_for_os_service_endpoint $service $args +} + +fail_unless_os_service_running() { + check_for_os_service_running $@ || exit $? +} + +# Check if we receive a successful response from the database server. +# Optionally takes a database name to check for. Defaults to 'mysql'. +check_for_db() { + local database=${1:-mysql} + check_required_vars MARIADB_SERVICE_HOST DB_ROOT_PASSWORD + + mysql -h ${MARIADB_SERVICE_HOST} -u root -p"${DB_ROOT_PASSWORD}" \ + -e "select 1" $database > /dev/null 2>&1 || { + echo "ERROR: database $database is not available @ $MARIADB_SERVICE_HOST" >&2 + return 1 + } + + echo "database is active @ ${MARIADB_SERVICE_HOST}" +} + +fail_unless_db() { + check_for_db $@ || exit $? +} + +# Dump shell environment to a file +dump_vars() { + set -o posix + set > /pid_$$_vars.sh + set +o posix +} + diff --git a/docker/centos/binary/base/service_hosts.sh b/docker/centos/binary/base/service_hosts.sh new file mode 100755 index 000000000..c3006f720 --- /dev/null +++ b/docker/centos/binary/base/service_hosts.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +# Kubernetes currently creates FOO_SERVICE_HOST and FOO_SERVICE_PORT env vars +# as part of starting the containers. However this is not done when starting +# them with plain docker. Defaulting variables to their common version if +# they're not already set allows the usage of --link in plain 'docker run' to +# wire together containers. + +: ${BARBICAN_ADMIN_SERVICE_HOST:=$BARBICAN_ADMIN_PORT_9312_TCP_ADDR} +: ${BARBICAN_ADMIN_SERVICE_PORT:=9312} +: ${BARBICAN_PUBLIC_SERVICE_HOST:=$BARBICAN_PUBLIC_PORT_9311_TCP_ADDR} +: ${BARBICAN_PUBLIC_SERVICE_PORT:=9311} +: ${CEILOMETER_API_SERVICE_HOST:=$CEILOMETER_API_PORT_8777_TCP_ADDR} +: ${CEILOMETER_API_SERVICE_PORT:=8777} +: ${GLANCE_API_SERVICE_HOST:=$GLANCE_API_PORT_9292_TCP_ADDR} +: ${GLANCE_API_SERVICE_PORT:=9292} +: ${GLANCE_REGISTRY_SERVICE_HOST:=$GLANCE_REGISTRY_PORT_9191_TCP_ADDR} +: ${GLANCE_REGISTRY_SERVICE_PORT:=9191} +: ${HEAT_API_SERVICE_HOST:=$HEAT_API_PORT_8004_TCP_ADDR} +: ${HEAT_API_SERVICE_PORT:=8004} +: ${HORIZON_SERVICE_HOST:=$HORIZON_PORT_80_TCP_ADDR} +: ${HORIZON_SERVICE_PORT:=80} +: ${KEYSTONE_ADMIN_SERVICE_HOST:=$KEYSTONE_PORT_35357_TCP_ADDR} +: ${KEYSTONE_ADMIN_SERVICE_PORT:=35357} +: ${KEYSTONE_PUBLIC_SERVICE_HOST:=$KEYSTONE_PORT_5000_TCP_ADDR} +: ${KEYSTONE_PUBLIC_SERVICE_PORT:=5000} +: ${MARIADB_SERVICE_HOST:=$MARIADB_PORT_3306_TCP_ADDR} +: ${MARIADB_SERVICE_PORT:=3306} +: ${MONGODB_SERVICE_HOST:=$MONGODB_PORT_27017_TCP_ADDR} +: ${MONGODB_SERVICE_PORT:=27017} +: ${NEUTRON_SERVER_SERVICE_HOST:=$NEUTRON_SERVER_PORT_9696_TCP_ADDR} +: ${NEUTRON_SERVER_SERVICE_PORT:=9696} +: ${NOVA_API_SERVICE_HOST:=$NOVA_API_PORT_8774_TCP_ADDR} +: ${NOVA_API_SERVICE_PORT:=8774} +: ${NOVA_EC2_API_SERVICE_HOST:=$NOVA_EC2_API_PORT_8773_TCP_ADDR} +: ${NOVA_EC2_API_SERVICE_PORT:=8773} +: ${NOVA_LIBVIRT_SERVICE_HOST:=$NOVA_LIBVIRT_PORT_16509_TCP_ADDR} +: ${NOVA_LIBVIRT_SERVICE_PORT:=16509} +: ${NOVA_METADATA_API_SERVICE_HOST:=$NOVA_METADATA_API_PORT_8775_TCP_ADDR} +: ${NOVA_METADATA_API_SERVICE_PORT:=8775} +: ${RABBITMQ_SERVICE_HOST:=$RABBITMQ_PORT_5672_TCP_ADDR} +: ${RABBITMQ_SERVICE_PORT:=5672} +: ${ZAQAR_SERVER_SERVICE_HOST:=$ZAQAR_SERVER_PORT_8888_TCP_ADDR} +: ${ZAQAR_SERVER_SERVICE_PORT:=8888} + diff --git a/docker/centos/binary/ceilometer/ceilometer-alarm/Dockerfile b/docker/centos/binary/ceilometer/ceilometer-alarm/Dockerfile new file mode 100644 index 000000000..fe6c44fc2 --- /dev/null +++ b/docker/centos/binary/ceilometer/ceilometer-alarm/Dockerfile @@ -0,0 +1,7 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%ceilometer-base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +RUN yum install -y openstack-ceilometer-alarm && yum clean all + +ADD ./start.sh /start.sh +CMD ["/start.sh"] diff --git a/docker/centos/binary/ceilometer/ceilometer-alarm/build b/docker/centos/binary/ceilometer/ceilometer-alarm/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/ceilometer/ceilometer-alarm/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/ceilometer/ceilometer-alarm/start.sh b/docker/centos/binary/ceilometer/ceilometer-alarm/start.sh new file mode 100644 index 000000000..7470ae608 --- /dev/null +++ b/docker/centos/binary/ceilometer/ceilometer-alarm/start.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +set -e + +. /opt/kolla/kolla-common.sh +. /opt/kolla/config-ceilometer.sh + + +exec /usr/bin/ceilometer-alarm-evaluator & +exec /usr/bin/ceilometer-alarm-notifier diff --git a/docker/centos/binary/ceilometer/ceilometer-api/Dockerfile b/docker/centos/binary/ceilometer/ceilometer-api/Dockerfile new file mode 100644 index 000000000..7a1337c7b --- /dev/null +++ b/docker/centos/binary/ceilometer/ceilometer-api/Dockerfile @@ -0,0 +1,7 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%ceilometer-base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +RUN yum install -y openstack-ceilometer-api && yum clean all + +ADD ./start.sh /start.sh +CMD ["/start.sh"] diff --git a/docker/centos/binary/ceilometer/ceilometer-api/build b/docker/centos/binary/ceilometer/ceilometer-api/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/ceilometer/ceilometer-api/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/ceilometer/ceilometer-api/start.sh b/docker/centos/binary/ceilometer/ceilometer-api/start.sh new file mode 100644 index 000000000..f081c9f84 --- /dev/null +++ b/docker/centos/binary/ceilometer/ceilometer-api/start.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +set -e + +. /opt/kolla/kolla-common.sh +. /opt/kolla/config-ceilometer.sh + +check_required_vars CEILOMETER_DB_USER CEILOMETER_DB_NAME \ + CEILOMETER_DB_PASSWORD KEYSTONE_ADMIN_TOKEN \ + KEYSTONE_AUTH_PROTOCOL KEYSTONE_ADMIN_SERVICE_HOST \ + KEYSTONE_ADMIN_SERVICE_PORT ADMIN_TENANT_NAME \ + CEILOMETER_KEYSTONE_USER CEILOMETER_ADMIN_PASSWORD \ + CEILOMETER_API_SERVICE_HOST PUBLIC_IP + +fail_unless_os_service_running keystone +fail_unless_db + +#TODO(pkilambi): Add mongodb support + +mysql -h ${MARIADB_SERVICE_HOST} -u root -p${DB_ROOT_PASSWORD} mysql <<EOF +CREATE DATABASE IF NOT EXISTS ${CEILOMETER_DB_NAME} DEFAULT CHARACTER SET utf8; +GRANT ALL PRIVILEGES ON ${CEILOMETER_DB_NAME}.* TO + '${CEILOMETER_DB_USER}'@'%' IDENTIFIED BY '${CEILOMETER_DB_PASSWORD}' + +EOF + + +export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}" +export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:${KEYSTONE_ADMIN_SERVICE_PORT}/v2.0" + + +crux user-create -n ${CEILOMETER_KEYSTONE_USER} \ + -p ${CEILOMETER_ADMIN_PASSWORD} \ + -t ${ADMIN_TENANT_NAME} \ + -r admin + +crux service-create -n ${CEILOMETER_KEYSTONE_USER} -t metering \ + -d "Ceilometer Telemetry Service" + +crux endpoint-create i--remove-all -n ${CEILOMETER_KEYSTONE_USER} -t metering \ + -I "${KEYSTONE_AUTH_PROTOCOL}://${CEILOMETER_API_SERVICE_HOST}:8777" \ + -P "${KEYSTONE_AUTH_PROTOCOL}://${PUBLIC_IP}:8777" \ + -A "${KEYSTONE_AUTH_PROTOCOL}://${CEILOMETER_API_SERVICE_HOST}:8777" + +cfg=/etc/ceilometer/ceilometer.conf +crudini --set $cfg \ + DEFAULT connection + "mysql://${CEILOMETER_DB_USER}:${CEILOMETER_DB_PASSWORD}@${MARIADB_SERVICE_HOST}/${CEILOMETER_DB_NAME}" + + +exec /usr/bin/ceilometer-api diff --git a/docker/centos/binary/ceilometer/ceilometer-base/Dockerfile b/docker/centos/binary/ceilometer/ceilometer-base/Dockerfile new file mode 100644 index 000000000..6aaf77ab2 --- /dev/null +++ b/docker/centos/binary/ceilometer/ceilometer-base/Dockerfile @@ -0,0 +1,5 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +RUN mkdir -p /opt/kolla +COPY config-ceilometer.sh /opt/kolla/config-ceilometer.sh diff --git a/docker/centos/binary/ceilometer/ceilometer-base/build b/docker/centos/binary/ceilometer/ceilometer-base/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/ceilometer/ceilometer-base/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/ceilometer/ceilometer-base/config-ceilometer.sh b/docker/centos/binary/ceilometer/ceilometer-base/config-ceilometer.sh new file mode 100644 index 000000000..a2316dcd1 --- /dev/null +++ b/docker/centos/binary/ceilometer/ceilometer-base/config-ceilometer.sh @@ -0,0 +1,71 @@ +#!/bin/bash + +set -e +. /opt/kolla/kolla-common.sh + +: ${CEILOMETER_DB_USER:=ceilometer} +: ${CEILOMETER_DB_NAME:=ceilometer} +: ${KEYSTONE_AUTH_PROTOCOL:=http} +: ${CEILOMETER_KEYSTONE_USER:=admin} +: ${CEILOMETER_ADMIN_PASSWORD:=kolla} +: ${ADMIN_TENANT_NAME:=admin} +: ${METERING_SECRET:=ceilometer} +: ${RABBIT_PASSWORD:=guest} + +check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \ + KEYSTONE_ADMIN_SERVICE_PORT KEYSTONE_PUBLIC_SERVICE_HOST \ +dump_vars + +cat > /openrc <<EOF +export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}" +export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:${KEYSTONE_ADMIN_SERVICE_PORT}/v2.0" +EOF + + +cfg=/etc/ceilometer/ceilometer.conf + +crudini --set $cfg \ + DEFAULT rpc_backend rabbit +crudini --set $cfg \ + DEFAULT rabbit_host ${RABBITMQ_SERVICE_HOST} +crudini --set $cfg \ + DEFAULT rabbit_password ${RABBIT_PASSWORD} + +crudini --set $cfg \ + keystone_authtoken \ + auth_uri \ + "http://${KEYSTONE_PUBLIC_SERVICE_HOST}:5000/" +crudini --set $cfg \ + keystone_authtoken \ + admin_tenant_name \ + "${ADMIN_TENANT_NAME}" +crudini --set $cfg \ + keystone_authtoken \ + admin_user \ + "${CEILOMETER_KEYSTONE_USER}" +crudini --set $cfg \ + keystone_authtoken \ + admin_password \ + ${CEILOMETER_ADMIN_PASSWORD} + +crudini --set $cfg \ + service_credentials \ + os_auth_url \ + ${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_PUBLIC_SERVICE_HOST}:5000/ +crudini --set $cfg \ + service_credentials \ + os_username \ + ceilometer +crudini --set $cfg \ + service_credentials \ + os_tenant_name \ + service +crudini --set $cfg \ + service_credentials \ + os_password \ + ${CEILOMETER_ADMIN_PASSWORD} + +crudini --set $cfg \ + publisher + metering_secret + ${METERING_SECRET} diff --git a/docker/centos/binary/ceilometer/ceilometer-central/Dockerfile b/docker/centos/binary/ceilometer/ceilometer-central/Dockerfile new file mode 100644 index 000000000..bd5137306 --- /dev/null +++ b/docker/centos/binary/ceilometer/ceilometer-central/Dockerfile @@ -0,0 +1,7 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%ceilometer-base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +RUN yum install -y openstack-ceilometer-central && yum clean all + +ADD ./start.sh /start.sh +CMD ["/start.sh"] diff --git a/docker/centos/binary/ceilometer/ceilometer-central/build b/docker/centos/binary/ceilometer/ceilometer-central/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/ceilometer/ceilometer-central/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/ceilometer/ceilometer-central/start.sh b/docker/centos/binary/ceilometer/ceilometer-central/start.sh new file mode 100644 index 000000000..76f9a1fc2 --- /dev/null +++ b/docker/centos/binary/ceilometer/ceilometer-central/start.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +. /opt/kolla/kolla-common.sh +. /opt/kolla/config-ceilometer.sh + +check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_AUTH_PROTOCOL \ + KEYSTONE_ADMIN_SERVICE_HOST KEYSTONE_ADMIN_SERVICE_PORT + +fail_unless_os_service_running keystone + +export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}" +export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:${KEYSTONE_ADMIN_SERVICE_PORT}/v2.0" + +exec /usr/bin/ceilometer-agent-central diff --git a/docker/centos/binary/ceilometer/ceilometer-collector/Dockerfile b/docker/centos/binary/ceilometer/ceilometer-collector/Dockerfile new file mode 100644 index 000000000..6c54dce4a --- /dev/null +++ b/docker/centos/binary/ceilometer/ceilometer-collector/Dockerfile @@ -0,0 +1,7 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%ceilometer-base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +RUN yum install -y openstack-ceilometer-collector && yum clean all + +ADD ./start.sh /start.sh +CMD ["/start.sh"] diff --git a/docker/centos/binary/ceilometer/ceilometer-collector/build b/docker/centos/binary/ceilometer/ceilometer-collector/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/ceilometer/ceilometer-collector/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/ceilometer/ceilometer-collector/start.sh b/docker/centos/binary/ceilometer/ceilometer-collector/start.sh new file mode 100644 index 000000000..1ed4c9e7d --- /dev/null +++ b/docker/centos/binary/ceilometer/ceilometer-collector/start.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +set -e + +. /opt/kolla/kolla-common.sh +. /opt/kolla/config-ceilometer.sh + + +exec /usr/bin/ceilometer-collector diff --git a/docker/centos/binary/ceilometer/ceilometer-compute/Dockerfile b/docker/centos/binary/ceilometer/ceilometer-compute/Dockerfile new file mode 100644 index 000000000..9f2a701d8 --- /dev/null +++ b/docker/centos/binary/ceilometer/ceilometer-compute/Dockerfile @@ -0,0 +1,8 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%ceilometer-base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +RUN yum install -y openstack-ceilometer-compute python-ceilometerclient python-pecan \ + && yum clean all + +ADD ./start.sh /start.sh +CMD ["/start.sh"] diff --git a/docker/centos/binary/ceilometer/ceilometer-compute/build b/docker/centos/binary/ceilometer/ceilometer-compute/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/ceilometer/ceilometer-compute/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/ceilometer/ceilometer-compute/start.sh b/docker/centos/binary/ceilometer/ceilometer-compute/start.sh new file mode 100644 index 000000000..f4fc30bae --- /dev/null +++ b/docker/centos/binary/ceilometer/ceilometer-compute/start.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +. /opt/kolla/kolla-common.sh +. /opt/kolla/config-ceilometer.sh + + +check_required_vars KEYSTONE_ADMIN_TOKEN RABBITMQ_SERVICE_HOST RABBIT_PASSWORD + +fail_unless_os_service_running keystone + +# Nova conf settings +crudini --set /etc/nova/nova.conf DEFAULT instance_usage_audit True +crudini --set /etc/nova/nova.conf DEFAULT instance_usage_audit_period hour +crudini --set /etc/nova/nova.conf DEFAULT notify_on_state_change vm_and_task_state +crudini --set /etc/nova/nova.conf DEFAULT notification_driver nova.openstack.common.notifier.rpc_notifier +crudini --set /etc/nova/nova.conf DEFAULT notification_driver ceilometer.compute.nova_notifier + +#ceilometer settings +cfg=/etc/ceilometer/ceilometer.conf +crudini --set $cfg publisher_rpc metering_secret ${KEYSTONE_ADMIN_TOKEN} +crudini --set $cfg rabbit_host ${RABBITMQ_SERVICE_HOST} +crudini --set $cfg rabbit_password ${RABBIT_PASSWORD} + + +exec /usr/bin/ceilometer-agent-compute diff --git a/docker/centos/binary/ceilometer/ceilometer-notification/Dockerfile b/docker/centos/binary/ceilometer/ceilometer-notification/Dockerfile new file mode 100644 index 000000000..72d291bcb --- /dev/null +++ b/docker/centos/binary/ceilometer/ceilometer-notification/Dockerfile @@ -0,0 +1,7 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%ceilometer-base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +RUN yum install -y openstack-ceilometer-notification && yum clean all + +ADD ./start.sh /start.sh +CMD ["/start.sh"] diff --git a/docker/centos/binary/ceilometer/ceilometer-notification/build b/docker/centos/binary/ceilometer/ceilometer-notification/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/ceilometer/ceilometer-notification/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/ceilometer/ceilometer-notification/start.sh b/docker/centos/binary/ceilometer/ceilometer-notification/start.sh new file mode 100644 index 000000000..939734549 --- /dev/null +++ b/docker/centos/binary/ceilometer/ceilometer-notification/start.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +set -e + +. /opt/kolla/kolla-common.sh +. /opt/kolla/config-ceilometer.sh + + +exec /usr/bin/ceilometer-agent-notification diff --git a/docker/centos/binary/centos-binary-base/.buildconf b/docker/centos/binary/centos-binary-base/.buildconf new file mode 100644 index 000000000..d552b0d1b --- /dev/null +++ b/docker/centos/binary/centos-binary-base/.buildconf @@ -0,0 +1 @@ +PREFIX= diff --git a/docker/centos/binary/centos-binary-base/Dockerfile b/docker/centos/binary/centos-binary-base/Dockerfile new file mode 100644 index 000000000..d045ba3f5 --- /dev/null +++ b/docker/centos/binary/centos-binary-base/Dockerfile @@ -0,0 +1,113 @@ +FROM centos +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +# Set up repositories +RUN yum install -y https://rdoproject.org/repos/openstack-kilo/rdo-release-kilo.rpm +RUN curl https://repos.fedorapeople.org/repos/openstack/openstack-trunk/epel-7/rc2/delorean-kilo.repo -o /etc/yum.repos.d/delorean-kilo.repo +RUN curl https://copr.fedoraproject.org/coprs/larsks/crux/repo/epel-7/larsks-crux-epel-7.repo -o /etc/yum.repos.d/larsks-crux-epel-7.repo +RUN curl https://copr.fedoraproject.org/coprs/sdake/pam.noaudit/repo/epel-7/sdake-pam.noaudit-epel-7.repo -o /etc/yum.repos.d/sdake-pam.noaudit-epel-7.repo + +# CentOS 7.1 workaround for conflicting packages with libvirt +RUN rpm -e --nodeps systemd-container systemd-container-libs +RUN rpm -e --nodeps yum-plugin-fastestmirror +RUN yum -d 10 -y install systemd systemd-libs systemd-devel && yum clean all + +RUN yum install -y epel-release && yum clean all + +# Update packages +RUN yum update -y && yum clean all + +# Install base packages +RUN yum install -y \ + crux \ + mariadb \ + mariadb-libs \ + openssl \ + openstack-utils \ + pyparsing \ + python-alembic \ + python-amqp \ + python-amqplib \ + python-anyjson \ + python-boto \ + python-cheetah \ + python-cliff \ + python-cmd2 \ + python-croniter \ + python-crypto \ + python-d2to1 \ + python-docutils \ + python-dogpile-cache \ + python-dogpile-core \ + python-empy \ + python-eventlet \ + python-flask \ + python-futures \ + python-greenlet \ + python-httplib2 \ + python-iso8601 \ + python-itsdangerous \ + python-jinja2 \ + python-jsonpatch \ + python-jsonpath-rw \ + python-jsonpointer \ + python-jsonschema \ + python-keyring \ + python-kombu \ + python-ldap \ + python-lesscpy \ + python-lockfile \ + python-lxml \ + python-markdown \ + python-memcached \ + python-migrate \ + python-msgpack \ + python-netifaces \ + python-networkx \ + python-oauthlib \ + python-oslo-config \ + python-oslo-messaging \ + python-oslo-rootwrap \ + python-paramiko \ + python-passlib \ + python-paste-deploy \ + python-pbr \ + python-pecan \ + python-ply \ + python-prettytable \ + python-psutil \ + python-pycadf \ + python-pygments \ + python-pymongo \ + python-qpid \ + python-repoze-lru \ + python-requests \ + python-routes \ + python-simplegeneric \ + python-simplejson \ + python-singledispatch \ + python-six \ + python-sqlalchemy \ + python-stevedore \ + python-taskflow \ + python-versiontools \ + python-warlock \ + python-webob \ + python-websockify \ + python-webtest \ + python-werkzeug \ + python-wsme \ + && yum clean all + +# This is dirty like zebra. This works around a bug in Ubuntu 14.04 LTS. The +# --net=host option does not work on ubuntu 14.04 because of a kernel bug. One +# workaround is to buid pam without authentication. +# See: +# https://registry.hub.docker.com/u/sequenceiq/pam/ +# +RUN rpm -e --nodeps pam +RUN yum -y install pam+noaudit && yum clean all +# End dirty like zebra + +RUN mkdir -p /opt/kolla +COPY service_hosts.sh kolla-common.sh /opt/kolla/ diff --git a/docker/centos/binary/centos-binary-base/build b/docker/centos/binary/centos-binary-base/build new file mode 120000 index 000000000..8d652f7ee --- /dev/null +++ b/docker/centos/binary/centos-binary-base/build @@ -0,0 +1 @@ +../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/centos-binary-base/kolla-common.sh b/docker/centos/binary/centos-binary-base/kolla-common.sh new file mode 120000 index 000000000..fcd13a80e --- /dev/null +++ b/docker/centos/binary/centos-binary-base/kolla-common.sh @@ -0,0 +1 @@ +../base/kolla-common.sh
\ No newline at end of file diff --git a/docker/centos/binary/centos-binary-base/service_hosts.sh b/docker/centos/binary/centos-binary-base/service_hosts.sh new file mode 120000 index 000000000..c36eb4203 --- /dev/null +++ b/docker/centos/binary/centos-binary-base/service_hosts.sh @@ -0,0 +1 @@ +../base/service_hosts.sh
\ No newline at end of file diff --git a/docker/centos/binary/centos-rdo-base b/docker/centos/binary/centos-rdo-base new file mode 120000 index 000000000..f3b111231 --- /dev/null +++ b/docker/centos/binary/centos-rdo-base @@ -0,0 +1 @@ +centos-binary-base/
\ No newline at end of file diff --git a/docker/centos/binary/cinder/Dockerfile b/docker/centos/binary/cinder/Dockerfile new file mode 100644 index 000000000..3dd7eca59 --- /dev/null +++ b/docker/centos/binary/cinder/Dockerfile @@ -0,0 +1,8 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +RUN yum -y install openstack-cinder && yum clean all + +ADD ./start.sh /start.sh +CMD ["/start.sh"] + diff --git a/docker/centos/binary/cinder/build b/docker/centos/binary/cinder/build new file mode 120000 index 000000000..8d652f7ee --- /dev/null +++ b/docker/centos/binary/cinder/build @@ -0,0 +1 @@ +../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/cinder/start.sh b/docker/centos/binary/cinder/start.sh new file mode 100755 index 000000000..c0d796f02 --- /dev/null +++ b/docker/centos/binary/cinder/start.sh @@ -0,0 +1,145 @@ +#!/bin/bash -e + +: ${CINDER_DB_USER:=cinder} +: ${CINDER_DB_NAME:=cinder} +: ${KEYSTONE_AUTH_PROTOCOL:=http} +: ${CINDER_KEYSTONE_USER:=cinder} +: ${ADMIN_TENANT_NAME:=admin} + +if ! [ "$CINDER_DB_PASSWORD" ]; then + CINDER_DB_PASSWORD=$(openssl rand -hex 15) + export CINDER_DB_PASSWORD +fi + +check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \ + CINDER_ADMIN_PASSWORD +fail_unless_db + +mysql -h ${MARIADB_SERVICE_HOST} -u root -p"${DB_ROOT_PASSWORD}" mysql <<EOF +CREATE DATABASE IF NOT EXISTS ${CINDER_DB_NAME}; +GRANT ALL PRIVILEGES ON glance* TO + '${CINDER_DB_USER}'@'%' IDENTIFIED BY '${CINDER_DB_PASSWORD}' +EOF + +#-----Cinder.conf setup----- + +# Cinder database +crudini --set /etc/cinder/cinder.conf \ + DEFAULT \ + db_driver \ + "cinder.db" + +# Rabbit +crudini --set /etc/cinder/cinder.conf \ + DEFAULT \ + rabbit_host \ + "127.0.0.1" +crudini --set /etc/cinder/cinder.conf \ + DEFAULT \ + rabbit_port \ + "5672" +crudini --set /etc/cinder/cinder.conf \ + DEFAULT \ + rabbit_hosts \ + "127.0.0.1:5672" +crudini --set /etc/cinder/cinder.conf \ + DEFAULT \ + rabbit_userid \ + "guest" +crudini --set /etc/cinder/cinder.conf \ + DEFAULT \ + rabbit_password \ + "guest" +crudini --set /etc/cinder/cinder.conf \ + DEFAULT \ + rabbit_virtual_host \ + "/" +crudini --set /etc/cinder/cinder.conf \ + DEFAULT \ + rabbit_ha_queues \ + "False" + +# backend +crudini --set /etc/cinder/cinder.conf \ + DEFAULT \ + rpc_backend \ + "cinder.openstack.common.rpc.impl_kombu" + +# control_exchange +crudini --set /etc/cinder/cinder.conf \ + DEFAULT \ + control_exchange \ + "openstack" + +# osapi +crudini --set /etc/cinder/cinder.conf \ + DEFAULT \ + osapi_volume_listen \ + "0.0.0.0" + +# api_paste_config +crudini --set /etc/cinder/cinder.conf \ + DEFUALT \ + api_paste_config \ + "/etc/cinder/api-paste.ini" + +# auth_strategy +crudini --set /etc/cinder/cinder.conf \ + DEFUALT \ + auth_strategy \ + "keystone" + +# debug +crudini --set /etc/cinder/cinder.conf \ + DEFAULT \ + debug \ + "False" + +# verbose +crudini --set /etc/cinder/cinder.conf \ + DEFAULT \ + verbose \ + "True" + +# logs +crudini --set /etc/cinder/cinder.conf \ + DEFAULT \ + log_dir \ + "/var/log/cinder/" +crudini --set /etc/cinder/cinder.conf \ + DEFAULT \ + log_file \ + "/var/log/cinder/cinder.log" + +# use_sysloge +crudini --set /etc/cinder/cinder.conf \ + DEFAULT \ + use_syslog \ + "False" + +# iscsi +crudini --set /etc/cinder/cinder.conf \ + DEFAULT \ + iscsi_ip_address \ + "127.0.0.1" +crudini --set /etc/cinder/cinder.conf \ + DEFAULT \ + iscsi_helper \ + "tgtadm" + +# volume_group +crudini --set /etc/cinder/cinder.conf \ + DEFAULT \ + volume_group \ + "cinder-volumes" + + +export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}" +export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:35357/v2.0" + +/bin/keystone user-create --name ${CINDER_KEYSTONE_USER} --pass ${CINDER_ADMIN_PASSWORD} +/bin/keystone role-create --name ${CINDER_KEYSTONE_USER} +/bin/keystone user-role-add --user ${CINDER_KEYSTONE_USER} --role admin --tenant ${ADMIN_TENANT_NAME} + +exec /usr/bin/cinder-all + diff --git a/docker/centos/binary/docker-compose/README.md b/docker/centos/binary/docker-compose/README.md new file mode 100644 index 000000000..a63e7fbc9 --- /dev/null +++ b/docker/centos/binary/docker-compose/README.md @@ -0,0 +1,107 @@ +Docker Compose (ie Fig) +======================= + +[](https://app.wercker.com/project/bykey/d5dbac3907301c3d5ce735e2d5e95a5b) + +Fast, isolated development environments using Docker. + +Define your app's environment with Docker so it can be reproduced anywhere: + + FROM python:2.7 + ADD . /code + WORKDIR /code + RUN pip install -r requirements.txt + CMD python app.py + +Define the services that make up your app so they can be run together in an isolated environment: + +```yaml +web: + build: . + links: + - db + ports: + - "8000:8000" + - "49100:22" +db: + image: postgres +``` + +(No more installing Postgres on your laptop!) + +Then type `docker-compose up`, and Compose will start and run your entire app. + +There are commands to: + + - start, stop and rebuild services + - view the status of running services + - tail running services' log output + - run a one-off command on a service + +Installation and documentation +------------------------------ + +Full documentation is available on [Fig's website](http://www.fig.sh/). + +Use wtih Kolla +-------------- + +Fig (ie docker-compose) is being used to compose one or more co-located +containers know as [container sets][]. Fig is deployed as a container from the +kollaglue [repository][] to Kolla nodes using the Heat orchestration [template]. +The fig container creates a host mount to communicate with the docker api over +a unix socket. The docker engine could be configured to expose the API over TCP +and may be evaluated for future use. An additional host mount to +/opt/docker-compose for fig to read the .yml file. This allows for seperating +the fig code from the data/configuration information. + +Either create or modify the existing docker-compose.yml file at +/opt/docker-compose. Here is a simple example of a single container for +RabbitMQ + +``` +rabbitmq: + image: kollaglue/fedora-rdo-rabbitmq + environment: + RABBITMQ_NODENAME: rabbit01 + RABBITMQ_USER: rabbit + RABBITMQ_PASS: password + net: "host" + ports: + - "5672:5672" + - "15672:15672" + - "4369:4369" + - "25672:25672" + privileged: true +``` + +Then run up to instantiate the container-set: +``` +$ docker run --privileged -v /opt/docker-compose:/opt/docker-compose -v /var/run/docker.sock:/var/run/docker.sock kollaglue/fedora-rdo-docker-compose up -d +``` +The -d flag tells fig to run the container set in daemonized mode. + +[container sets]: https://github.com/stackforge/kolla/blob/master/specs/containerize-openstack.rst +[template]: https://github.com/stackforge/kolla/tree/master/devenv +[repository]: https://registry.hub.docker.com/u/kollaglue/fedora-rdo-docker-compose/ + +Contribute to Kolla Fig +----------------------- + +Clone the repo: +``` +git clone https://github.com/docker/fig.git +``` +Set the following ENVs in the project's Dockerfile: +``` +ENV COMPOSE_PROJECT_NAME kollaglue-fedora-rdo +ENV COMPOSE_FILE /opt/docker-compose/docker-compose.yml +``` +Hack as needed, then build the image: +``` +$ docker build -t kollaglue/kollaglue-fedora-rdo-docker-compose . +``` +Push the image to the kollaglue repo +``` +$ docker push kollaglue/fedora-rdo-docker-compose:latest +``` diff --git a/docker/centos/binary/fedora-binary-base/.buildconf b/docker/centos/binary/fedora-binary-base/.buildconf new file mode 100644 index 000000000..d552b0d1b --- /dev/null +++ b/docker/centos/binary/fedora-binary-base/.buildconf @@ -0,0 +1 @@ +PREFIX= diff --git a/docker/centos/binary/fedora-binary-base/Dockerfile b/docker/centos/binary/fedora-binary-base/Dockerfile new file mode 100644 index 000000000..f41cac97e --- /dev/null +++ b/docker/centos/binary/fedora-binary-base/Dockerfile @@ -0,0 +1,108 @@ +FROM fedora:20 +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +# Set up repositories +RUN yum install -y https://rdo.fedorapeople.org/rdo-release.rpm +RUN yum -y install dnf dnf-plugins-core && yum clean all +RUN dnf copr enable -y larsks/crux +run dnf copr enable -y sdake/pam.noaudit + + +# Update packages +RUN yum update -y && yum clean all + +# Install base packages +RUN yum install -y \ + crux \ + mariadb \ + mariadb-libs \ + openssl \ + openstack-utils \ + pyparsing \ + python-alembic \ + python-amqp \ + python-amqplib \ + python-anyjson \ + python-boto \ + python-cheetah \ + python-cliff \ + python-cmd2 \ + python-croniter \ + python-crypto \ + python-d2to1 \ + python-docutils \ + python-dogpile-cache \ + python-dogpile-core \ + python-empy \ + python-eventlet \ + python-flask \ + python-futures \ + python-greenlet \ + python-httplib2 \ + python-iso8601 \ + python-itsdangerous \ + python-jinja2 \ + python-jsonpatch \ + python-jsonpath-rw \ + python-jsonpointer \ + python-jsonschema \ + python-keyring \ + python-kombu \ + python-ldap \ + python-lesscpy \ + python-lockfile \ + python-lxml \ + python-markdown \ + python-memcached \ + python-migrate \ + python-msgpack \ + python-netifaces \ + python-networkx \ + python-oauthlib \ + python-oslo-config \ + python-oslo-messaging \ + python-oslo-rootwrap \ + python-paramiko \ + python-passlib \ + python-paste-deploy \ + python-pbr \ + python-pecan \ + python-ply \ + python-prettytable \ + python-psutil \ + python-pycadf \ + python-pygments \ + python-pymongo \ + python-qpid \ + python-repoze-lru \ + python-requests \ + python-routes \ + python-simplegeneric \ + python-simplejson \ + python-singledispatch \ + python-six \ + python-sqlalchemy \ + python-stevedore \ + python-taskflow \ + python-versiontools \ + python-warlock \ + python-webob \ + python-websockify \ + python-webtest \ + python-werkzeug \ + python-wsme \ + && yum clean all + +# This is dirty like zebra. This works around a bug in Ubuntu 14.04 LTS. The +# --net=host option does not work on ubuntu 14.04 because of a kernel bug. One +# workaround is to build pam without authentication. +# See: +# https://registry.hub.docker.com/u/sequenceiq/pam/ +# +RUN rpm -e --nodeps pam +RUN yum -y install pam+noaudit && yum clean all +# End dirty like zebra + +RUN mkdir -p /opt/kolla +ADD service_hosts.sh /opt/kolla/service_hosts.sh +ADD kolla-common.sh /opt/kolla/kolla-common.sh diff --git a/docker/centos/binary/fedora-binary-base/build b/docker/centos/binary/fedora-binary-base/build new file mode 120000 index 000000000..8d652f7ee --- /dev/null +++ b/docker/centos/binary/fedora-binary-base/build @@ -0,0 +1 @@ +../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/fedora-binary-base/kolla-common.sh b/docker/centos/binary/fedora-binary-base/kolla-common.sh new file mode 120000 index 000000000..fcd13a80e --- /dev/null +++ b/docker/centos/binary/fedora-binary-base/kolla-common.sh @@ -0,0 +1 @@ +../base/kolla-common.sh
\ No newline at end of file diff --git a/docker/centos/binary/fedora-binary-base/service_hosts.sh b/docker/centos/binary/fedora-binary-base/service_hosts.sh new file mode 120000 index 000000000..c36eb4203 --- /dev/null +++ b/docker/centos/binary/fedora-binary-base/service_hosts.sh @@ -0,0 +1 @@ +../base/service_hosts.sh
\ No newline at end of file diff --git a/docker/centos/binary/fedora-rdo-base b/docker/centos/binary/fedora-rdo-base new file mode 120000 index 000000000..a9be4eebb --- /dev/null +++ b/docker/centos/binary/fedora-rdo-base @@ -0,0 +1 @@ +fedora-binary-base
\ No newline at end of file diff --git a/docker/centos/binary/glance/glance-api/Dockerfile b/docker/centos/binary/glance/glance-api/Dockerfile new file mode 100644 index 000000000..a4bd45bd1 --- /dev/null +++ b/docker/centos/binary/glance/glance-api/Dockerfile @@ -0,0 +1,9 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%glance-base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +VOLUME /var/lib/glance + +ADD ./start.sh /start.sh +ADD ./check.sh /check.sh + +CMD ["/start.sh"] diff --git a/docker/centos/binary/glance/glance-api/build b/docker/centos/binary/glance/glance-api/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/glance/glance-api/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/glance/glance-api/check.sh b/docker/centos/binary/glance/glance-api/check.sh new file mode 100755 index 000000000..f97ef70f4 --- /dev/null +++ b/docker/centos/binary/glance/glance-api/check.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +RES=0 + +. /openrc +if ! keystone token-get > /dev/null; then + echo "ERROR: keystone token-get failed" >&2 + RES=1 +else + if ! glance image-list > /dev/null; then + echo "ERROR: glance image-list failed" >&2 + RES=1 + fi +fi + +exit $RES + diff --git a/docker/centos/binary/glance/glance-api/start.sh b/docker/centos/binary/glance/glance-api/start.sh new file mode 100755 index 000000000..c546333f4 --- /dev/null +++ b/docker/centos/binary/glance/glance-api/start.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +set -e + +. /opt/kolla/kolla-common.sh +. /opt/kolla/config-glance.sh +: ${GLANCE_API_SERVICE_HOST:=$PUBLIC_IP} + +check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \ + GLANCE_KEYSTONE_USER GLANCE_KEYSTONE_PASSWORD \ + ADMIN_TENANT_NAME GLANCE_API_SERVICE_HOST \ + PUBLIC_IP + +fail_unless_os_service_running keystone + +export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}" +export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:${KEYSTONE_ADMIN_SERVICE_PORT}/v2.0" + +crux user-create --update \ + -n "${GLANCE_KEYSTONE_USER}" \ + -p "${GLANCE_KEYSTONE_PASSWORD}" \ + -t "${ADMIN_TENANT_NAME}" \ + -r admin + +crux endpoint-create --remove-all \ + -n glance -t image \ + -I "http://${GLANCE_API_SERVICE_HOST}:9292" \ + -P "http://${PUBLIC_IP}:9292" \ + -A "http://${GLANCE_API_SERVICE_HOST}:9292" + +# turn on notification sending by glance +crudini --set /etc/glance/glance-api.conf \ + DEFAULT \ + notification_driver \ + "messaging" + +crudini --set /etc/glance/glance-api.conf \ + DEFAULT \ + rabbit_host \ + "${RABBITMQ_SERVICE_HOST}" + +crudini --set /etc/glance/glance-api.conf \ + DEFAULT \ + registry_host \ + "${GLANCE_REGISTRY_SERVICE_HOST}" + +crudini --set /etc/glance/glance-api.conf \ + DEFAULT \ + debug \ + "True" + +exec /usr/bin/glance-api diff --git a/docker/centos/binary/glance/glance-base/Dockerfile b/docker/centos/binary/glance/glance-base/Dockerfile new file mode 100644 index 000000000..dcd70678d --- /dev/null +++ b/docker/centos/binary/glance/glance-base/Dockerfile @@ -0,0 +1,10 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +# We really shouldn't need to install python-oslo-log or python-oslo-policy +# See: https://bugzilla.redhat.com/show_bug.cgi?id=1218349 +RUN yum -y install openstack-glance python-oslo-log python-oslo-policy && yum clean all + +RUN mkdir -p /opt/kolla +COPY config-glance.sh /opt/kolla/config-glance.sh + diff --git a/docker/centos/binary/glance/glance-base/build b/docker/centos/binary/glance/glance-base/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/glance/glance-base/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/glance/glance-base/config-glance.sh b/docker/centos/binary/glance/glance-base/config-glance.sh new file mode 100644 index 000000000..aed044df5 --- /dev/null +++ b/docker/centos/binary/glance/glance-base/config-glance.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +set -e + +. /opt/kolla/kolla-common.sh + +: ${ADMIN_TENANT_NAME:=admin} +: ${GLANCE_DB_NAME:=glance} +: ${GLANCE_DB_USER:=glance} +: ${GLANCE_KEYSTONE_USER:=glance} +: ${KEYSTONE_AUTH_PROTOCOL:=http} +: ${PUBLIC_IP:=$GLANCE_API_PORT_9292_TCP_ADDR} + +check_required_vars GLANCE_DB_PASSWORD GLANCE_KEYSTONE_PASSWORD +dump_vars + +cat > /openrc <<EOF +export OS_AUTH_URL="http://${KEYSTONE_PUBLIC_SERVICE_HOST}:5000/v2.0" +export OS_USERNAME="${GLANCE_KEYSTONE_USER}" +export OS_PASSWORD="${GLANCE_KEYSTONE_PASSWORD}" +export OS_TENANT_NAME="${ADMIN_TENANT_NAME}" +EOF + +for cfg in /etc/glance/glance-api.conf /etc/glance/glance-registry.conf; do + crudini --set $cfg \ + DEFAULT \ + log_file \ + "" + + for option in auth_protocol auth_host auth_port; do + crudini --del $cfg \ + keystone_authtoken \ + $option + done + + crudini --set $cfg \ + keystone_authtoken \ + auth_uri \ + "http://${KEYSTONE_PUBLIC_SERVICE_HOST}:5000/" + crudini --set $cfg \ + keystone_authtoken \ + admin_tenant_name \ + "${ADMIN_TENANT_NAME}" + crudini --set $cfg \ + keystone_authtoken \ + admin_user \ + "${GLANCE_KEYSTONE_USER}" + crudini --set $cfg \ + keystone_authtoken \ + admin_password \ + "${GLANCE_KEYSTONE_PASSWORD}" + + crudini --set $cfg \ + paste_deploy \ + flavor \ + keystone + + crudini --set $cfg \ + database \ + connection \ + "mysql://${GLANCE_DB_USER}:${GLANCE_DB_PASSWORD}@${MARIADB_SERVICE_HOST}/${GLANCE_DB_NAME}" +done + diff --git a/docker/centos/binary/glance/glance-registry/Dockerfile b/docker/centos/binary/glance/glance-registry/Dockerfile new file mode 100644 index 000000000..f950ce685 --- /dev/null +++ b/docker/centos/binary/glance/glance-registry/Dockerfile @@ -0,0 +1,5 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%glance-base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +ADD ./start.sh /start.sh +CMD ["/start.sh"] diff --git a/docker/centos/binary/glance/glance-registry/build b/docker/centos/binary/glance/glance-registry/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/glance/glance-registry/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/glance/glance-registry/start.sh b/docker/centos/binary/glance/glance-registry/start.sh new file mode 100755 index 000000000..5f590fb1c --- /dev/null +++ b/docker/centos/binary/glance/glance-registry/start.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +set -e + +. /opt/kolla/kolla-common.sh +. /opt/kolla/config-glance.sh + +check_required_vars GLANCE_DB_NAME GLANCE_DB_USER GLANCE_DB_PASSWORD +# lets wait for the DB to be available +wait_for 25 1 check_for_db + +mysql -h ${MARIADB_SERVICE_HOST} -u root -p${DB_ROOT_PASSWORD} mysql <<EOF +CREATE DATABASE IF NOT EXISTS ${GLANCE_DB_NAME} DEFAULT CHARACTER SET utf8; +GRANT ALL PRIVILEGES ON ${GLANCE_DB_NAME}.* TO + '${GLANCE_DB_USER}'@'%' IDENTIFIED BY '${GLANCE_DB_PASSWORD}' + +EOF + +/usr/bin/glance-manage db_sync + +exec /usr/bin/glance-registry diff --git a/docker/centos/binary/hautoproxy/Dockerfile b/docker/centos/binary/hautoproxy/Dockerfile new file mode 100644 index 000000000..82b31eca3 --- /dev/null +++ b/docker/centos/binary/hautoproxy/Dockerfile @@ -0,0 +1,9 @@ +FROM fedora:20 +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +RUN yum -y install haproxy python-jinja2 && yum clean all +RUN mkdir -p /etc/haproxy/templates +ADD haproxy.cfg.tmpl /etc/haproxy/templates/haproxy.cfg.tmpl +ADD start.py /start.py +CMD ["/start.py"] + diff --git a/docker/centos/binary/hautoproxy/build b/docker/centos/binary/hautoproxy/build new file mode 120000 index 000000000..8d652f7ee --- /dev/null +++ b/docker/centos/binary/hautoproxy/build @@ -0,0 +1 @@ +../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/hautoproxy/haproxy.cfg.tmpl b/docker/centos/binary/hautoproxy/haproxy.cfg.tmpl new file mode 100644 index 000000000..cd1174b21 --- /dev/null +++ b/docker/centos/binary/hautoproxy/haproxy.cfg.tmpl @@ -0,0 +1,26 @@ +global + daemon + maxconn 4096 + pidfile /var/run/haproxy.pid + +defaults + mode tcp + timeout connect 5s + timeout client 1m + timeout server 1m + option redispatch + balance roundrobin + +listen stats :1936 + mode http + stats enable + stats hide-version + #stats realm Haproxy\ Statistics + stats uri / + #stats auth Username:Password + +{% for service in services %} +listen {{ service.service_name }} + bind 127.0.0.1:{{service.local_port}} + server {{ service.remote_name }} {{ service.remote_addr }}:{{ service.remote_port}} check inter 2s rise 3 fall 2 +{% endfor %} diff --git a/docker/centos/binary/hautoproxy/start.py b/docker/centos/binary/hautoproxy/start.py new file mode 100755 index 000000000..877b22157 --- /dev/null +++ b/docker/centos/binary/hautoproxy/start.py @@ -0,0 +1,65 @@ +#!/usr/bin/python + +'''This script configures and starts a local haproxy instances, bound to +127.0.0.1, that forwards connections all of the discovered +docker/kubernetes environment variables.''' + +import argparse +import os +import sys +from jinja2 import Environment, FileSystemLoader +import re +import urlparse + +re_url = re.compile( + '^(?P<name>.*)_PORT_(?P<port>\d+)_(?P<proto>(UDP|TCP))$') + +def parse_args(): + p = argparse.ArgumentParser() + p.add_argument('--output', '-o', + default='/etc/haproxy/haproxy.cfg') + p.add_argument('--no-start', '-n', + action='store_true') + p.add_argument('--template-dir', '-t', + default='/etc/haproxy/templates') + return p.parse_args() + +def discover_services(): + services = [] + for k in os.environ: + mo = re_url.match(k) + + if mo: + parts = urlparse.urlparse(os.environ[k]) + remote_host,remote_port = parts.netloc.split(':') + service_name = '%(name)s-%(port)s' % mo.groupdict() + + services.append({ + 'remote_name': mo.group('name'), + 'remote_addr': remote_host, + 'remote_port': remote_port, + 'remote_proto': parts.scheme, + 'local_port': mo.group('port'), + 'service_name': service_name, + }) + + return services + +def main(): + args = parse_args() + services = discover_services() + + env = Environment(loader=FileSystemLoader(['.', + args.template_dir])) + template = env.get_template('haproxy.cfg.tmpl') + with open(args.output, 'w') as fd: + fd.write(template.render(services=services)) + + if args.no_start: + return + + os.execlp('haproxy', 'haproxy', '-f', args.output, '-db') + +if __name__ == '__main__': + main() + diff --git a/docker/centos/binary/heat/heat-api-cfn/Dockerfile b/docker/centos/binary/heat/heat-api-cfn/Dockerfile new file mode 100644 index 000000000..18a7e369d --- /dev/null +++ b/docker/centos/binary/heat/heat-api-cfn/Dockerfile @@ -0,0 +1,12 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%heat-base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +RUN yum -y install \ + openstack-heat-api-cfn \ + python-openstackclient \ + && yum clean all + +ADD ./start.sh /start.sh +ADD ./check.sh /check.sh + +CMD ["/start.sh"] diff --git a/docker/centos/binary/heat/heat-api-cfn/build b/docker/centos/binary/heat/heat-api-cfn/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/heat/heat-api-cfn/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/heat/heat-api-cfn/check.sh b/docker/centos/binary/heat/heat-api-cfn/check.sh new file mode 100755 index 000000000..ee03dc6d2 --- /dev/null +++ b/docker/centos/binary/heat/heat-api-cfn/check.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +RES=0 + +. /openrc +if ! keystone token-get > /dev/null; then + echo "ERROR: keystone token-get failed" >&2 + RES=1 +else + if ! heat stack-list > /dev/null; then + echo "ERROR: heat stack-list failed" >&2 + RES=1 + fi +fi + +exit $RES diff --git a/docker/centos/binary/heat/heat-api-cfn/start.sh b/docker/centos/binary/heat/heat-api-cfn/start.sh new file mode 100755 index 000000000..bcd72250b --- /dev/null +++ b/docker/centos/binary/heat/heat-api-cfn/start.sh @@ -0,0 +1,28 @@ +#!/bin/bash +set -e + +. /opt/kolla/kolla-common.sh +. /opt/kolla/config-heat.sh + +check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \ + HEAT_CFN_KEYSTONE_USER HEAT_CFN_KEYSTONE_PASSWORD \ + KEYSTONE_AUTH_PROTOCOL KEYSTONE_ADMIN_SERVICE_PORT \ + ADMIN_TENANT_NAME HEAT_API_CFN_SERVICE_HOST \ + HEAT_API_CFN_SERVICE_PORT + +fail_unless_os_service_running keystone + +export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}" +export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:${KEYSTONE_ADMIN_SERVICE_PORT}/v2.0" + +crux user-create -n ${HEAT_CFN_KEYSTONE_USER} \ + -p ${HEAT_CFN_KEYSTONE_PASSWORD} \ + -t ${ADMIN_TENANT_NAME} \ + -r admin + +crux endpoint-create --remove-all -n ${HEAT_CFN_KEYSTONE_USER} -t cloudformation \ + -I "${KEYSTONE_AUTH_PROTOCOL}://${HEAT_API_CFN_SERVICE_HOST}:${HEAT_API_CFN_SERVICE_PORT}/v1" \ + -P "${KEYSTONE_AUTH_PROTOCOL}://${HEAT_API_CFN_SERVICE_HOST}:${HEAT_API_CFN_SERVICE_PORT}/v1" \ + -A "${KEYSTONE_AUTH_PROTOCOL}://${HEAT_API_CFN_SERVICE_HOST}:${HEAT_API_CFN_SERVICE_PORT}/v1" + +exec /usr/bin/heat-api-cfn diff --git a/docker/centos/binary/heat/heat-api/Dockerfile b/docker/centos/binary/heat/heat-api/Dockerfile new file mode 100644 index 000000000..407aee601 --- /dev/null +++ b/docker/centos/binary/heat/heat-api/Dockerfile @@ -0,0 +1,14 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%heat-base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +# TODO: configure cfn and cloudwatch +# TODO: remove python-openstackclient once crux feature is added in start.sh +RUN yum -y install \ + openstack-heat-api \ + python-openstackclient \ + && yum clean all + +ADD ./start.sh /start.sh +ADD ./check.sh /check.sh + +CMD ["/start.sh"] diff --git a/docker/centos/binary/heat/heat-api/build b/docker/centos/binary/heat/heat-api/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/heat/heat-api/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/heat/heat-api/check.sh b/docker/centos/binary/heat/heat-api/check.sh new file mode 100755 index 000000000..ee03dc6d2 --- /dev/null +++ b/docker/centos/binary/heat/heat-api/check.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +RES=0 + +. /openrc +if ! keystone token-get > /dev/null; then + echo "ERROR: keystone token-get failed" >&2 + RES=1 +else + if ! heat stack-list > /dev/null; then + echo "ERROR: heat stack-list failed" >&2 + RES=1 + fi +fi + +exit $RES diff --git a/docker/centos/binary/heat/heat-api/start.sh b/docker/centos/binary/heat/heat-api/start.sh new file mode 100755 index 000000000..b57aaa710 --- /dev/null +++ b/docker/centos/binary/heat/heat-api/start.sh @@ -0,0 +1,29 @@ +#!/bin/bash +set -e + +. /opt/kolla/kolla-common.sh +. /opt/kolla/config-heat.sh + +check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \ + HEAT_KEYSTONE_USER HEAT_KEYSTONE_PASSWORD \ + KEYSTONE_AUTH_PROTOCOL ADMIN_TENANT_NAME \ + HEAT_API_SERVICE_HOST PUBLIC_IP + +fail_unless_os_service_running keystone + +export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}" +export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:35357/v2.0" +crux user-create -n ${HEAT_KEYSTONE_USER} \ + -p ${HEAT_KEYSTONE_PASSWORD} \ + -t ${ADMIN_TENANT_NAME} \ + -r admin + +crux endpoint-create --remove-all -n ${HEAT_KEYSTONE_USER} -t orchestration \ + -I "${KEYSTONE_AUTH_PROTOCOL}://${HEAT_API_SERVICE_HOST}:8004/v1/%(tenant_id)s" \ + -P "${KEYSTONE_AUTH_PROTOCOL}://${PUBLIC_IP}:8004/v1/%(tenant_id)s" \ + -A "${KEYSTONE_AUTH_PROTOCOL}://${HEAT_API_SERVICE_HOST}:8004/v1/%(tenant_id)s" + +# will use crux after https://github.com/larsks/crux/issues/1 is implemented +openstack role list --os-token="${KEYSTONE_ADMIN_TOKEN}" --os-url $SERVICE_ENDPOINT -f csv | tail -n +2 | awk -F, '{print $2}' | grep heat_stack_user || keystone role-create --name heat_stack_user + +exec /usr/bin/heat-api diff --git a/docker/centos/binary/heat/heat-base/Dockerfile b/docker/centos/binary/heat/heat-base/Dockerfile new file mode 100644 index 000000000..ebe9fa15c --- /dev/null +++ b/docker/centos/binary/heat/heat-base/Dockerfile @@ -0,0 +1,5 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +RUN mkdir -p /opt/kolla +COPY config-heat.sh /opt/kolla/config-heat.sh diff --git a/docker/centos/binary/heat/heat-base/build b/docker/centos/binary/heat/heat-base/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/heat/heat-base/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/heat/heat-base/config-heat.sh b/docker/centos/binary/heat/heat-base/config-heat.sh new file mode 100755 index 000000000..74b2718a4 --- /dev/null +++ b/docker/centos/binary/heat/heat-base/config-heat.sh @@ -0,0 +1,67 @@ +#!/bin/bash + +set -e + +. /opt/kolla/kolla-common.sh + +: ${ADMIN_TENANT_NAME:=admin} +: ${HEAT_DB_NAME:=heat} +: ${HEAT_DB_USER:=heat} +: ${HEAT_KEYSTONE_USER:=heat} +: ${HEAT_CFN_KEYSTONE_USER:=heat_cfn} +: ${KEYSTONE_AUTH_PROTOCOL:=http} +: ${PUBLIC_IP:=$HEAT_API_PORT_8004_TCP_ADDR} +: ${RABBIT_USER:=guest} +: ${RABBIT_PASSWORD:=guest} + +check_required_vars HEAT_DB_PASSWORD HEAT_KEYSTONE_PASSWORD \ + KEYSTONE_PUBLIC_SERVICE_HOST RABBITMQ_SERVICE_HOST + +fail_unless_db +dump_vars + +cat > /openrc <<EOF +export OS_AUTH_URL="http://${KEYSTONE_PUBLIC_SERVICE_HOST}:5000/v2.0" +export OS_USERNAME="${HEAT_KEYSTONE_USER}" +export OS_PASSWORD="${HEAT_KEYSTONE_PASSWORD}" +export OS_TENANT_NAME="${ADMIN_TENANT_NAME}" +EOF + +crudini --set /etc/heat/heat.conf DEFAULT log_file \ + "" +crudini --set /etc/heat/heat.conf DEFAULT use_stderr \ + true +crudini --set /etc/heat/heat.conf DEFAULT rpc_backend \ + heat.openstack.common.rpc.impl_kombu +crudini --set /etc/heat/heat.conf DEFAULT rabbit_host \ + "${RABBITMQ_SERVICE_HOST}" +crudini --set /etc/heat/heat.conf DEFAULT rabbit_userid \ + "${RABBIT_USER}" +crudini --set /etc/heat/heat.conf DEFAULT rabbit_password \ + "${RABBIT_PASSWORD}" + +crudini --set /etc/heat/heat.conf database connection \ + mysql://${HEAT_DB_USER}:${HEAT_DB_PASSWORD}@${MARIADB_SERVICE_HOST}/${HEAT_DB_NAME} + +crudini --set /etc/heat/heat.conf keystone_authtoken auth_protocol \ + "${KEYSTONE_AUTH_PROTOCOL}" +crudini --set /etc/heat/heat.conf keystone_authtoken auth_host \ + "${KEYSTONE_PUBLIC_SERVICE_HOST}" +crudini --set /etc/heat/heat.conf keystone_authtoken auth_port \ + "${KEYSTONE_PUBLIC_SERVICE_PORT}" +crudini --set /etc/heat/heat.conf keystone_authtoken auth_uri \ + "${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_PUBLIC_SERVICE_HOST}:${KEYSTONE_PUBLIC_SERVICE_PORT}/v2.0" +crudini --set /etc/heat/heat.conf keystone_authtoken admin_tenant_name \ + "${ADMIN_TENANT_NAME}" +crudini --set /etc/heat/heat.conf keystone_authtoken admin_user \ + "${HEAT_KEYSTONE_USER}" +crudini --set /etc/heat/heat.conf keystone_authtoken admin_password \ + "${HEAT_KEYSTONE_PASSWORD}" + +crudini --set /etc/heat/heat.conf ec2authtoken auth_uri \ + "${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_PUBLIC_SERVICE_HOST}:${KEYSTONE_PUBLIC_SERVICE_PORT}/v2.0" + +crudini --set /etc/heat/heat.conf DEFAULT heat_metadata_server_url \ + http://${HEAT_API_CFN_URL_HOST}:${HEAT_API_CFN_SERVICE_PORT} +crudini --set /etc/heat/heat.conf DEFAULT heat_waitcondition_server_url \ + http://${HEAT_API_CFN_URL_HOST}:${HEAT_API_CFN_SERVICE_PORT}/v1/waitcondition diff --git a/docker/centos/binary/heat/heat-engine/Dockerfile b/docker/centos/binary/heat/heat-engine/Dockerfile new file mode 100644 index 000000000..227ac335d --- /dev/null +++ b/docker/centos/binary/heat/heat-engine/Dockerfile @@ -0,0 +1,9 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%heat-base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +RUN yum -y install \ + openstack-heat-engine \ + && yum clean all + +ADD ./start.sh /start.sh +CMD ["/start.sh"] diff --git a/docker/centos/binary/heat/heat-engine/build b/docker/centos/binary/heat/heat-engine/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/heat/heat-engine/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/heat/heat-engine/start.sh b/docker/centos/binary/heat/heat-engine/start.sh new file mode 100755 index 000000000..2dfc78e92 --- /dev/null +++ b/docker/centos/binary/heat/heat-engine/start.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +. /opt/kolla/kolla-common.sh +. /opt/kolla/config-heat.sh + +check_required_vars HEAT_DB_NAME HEAT_DB_USER HEAT_DB_PASSWORD +fail_unless_db + +mysql -h ${MARIADB_SERVICE_HOST} -u root -p${DB_ROOT_PASSWORD} mysql <<EOF +CREATE DATABASE IF NOT EXISTS ${HEAT_DB_NAME} DEFAULT CHARACTER SET utf8; +GRANT ALL PRIVILEGES ON ${HEAT_DB_NAME}.* TO + '${HEAT_DB_USER}'@'%' IDENTIFIED BY '${HEAT_DB_PASSWORD}' +EOF + +/usr/bin/heat-manage db_sync + +exec /usr/bin/heat-engine diff --git a/docker/centos/binary/horizon/Dockerfile b/docker/centos/binary/horizon/Dockerfile new file mode 100644 index 000000000..2c34ee03a --- /dev/null +++ b/docker/centos/binary/horizon/Dockerfile @@ -0,0 +1,16 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +RUN yum -y install \ + openstack-dashboard \ + httpd \ + httpd-mod-wsgi \ + && yum clean all \ + && chown -R apache:apache /usr/share/openstack-dashboard/static + +# The chown is required because of this packaging bug: +# https://bugzilla.redhat.com/show_bug.cgi?id=1219006 + +ADD ./start.sh /start.sh + +CMD ["/start.sh"] diff --git a/docker/centos/binary/horizon/build b/docker/centos/binary/horizon/build new file mode 120000 index 000000000..8d652f7ee --- /dev/null +++ b/docker/centos/binary/horizon/build @@ -0,0 +1 @@ +../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/horizon/start.sh b/docker/centos/binary/horizon/start.sh new file mode 100755 index 000000000..4e720bb87 --- /dev/null +++ b/docker/centos/binary/horizon/start.sh @@ -0,0 +1,36 @@ +#!/bin/bash +set -e + +: ${HORIZON_KEYSTONE_USER:=horizon} + +. /opt/kolla/kolla-common.sh + +fail_unless_os_service_running keystone +fail_unless_os_service_running glance +fail_unless_os_service_running nova + +export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}" +export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:35357/v2.0" + +cfg=/etc/openstack-dashboard/local_settings +httpdcfg=/etc/httpd/conf.d/openstack-dashboard.conf + +sed -ri 's/ALLOWED_HOSTS = \['\''horizon.example.com'\'', '\''localhost'\''\]/ALLOWED_HOSTS = \['\''*'\'', \]/' /etc/openstack-dashboard/local_settings + +sed -ri 's/OPENSTACK_KEYSTONE_URL = \"http:\/\/%s:5000\/v2.0\" % OPENSTACK_HOST/OPENSTACK_KEYSTONE_URL = \"http:\/\/'"$KEYSTONE_PUBLIC_SERVICE_HOST"':5000\/v2.0\"/' /etc/openstack-dashboard/local_settings + +sed -ri 's/OPENSTACK_HOST = \"127.0.0.1\"/OPENSTACK_HOST = \"'"$KEYSTONE_PUBLIC_SERVICE_HOST"'\" /' /etc/openstack-dashboard/local_settings + +# Make sure we launch horizon using the default value for WEBROOT, which is +# '/'. +sed -ri '/^WEBROOT =.+/d' $cfg +sed -ri 's,^(WSGIScriptAlias) /dashboard (/usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi),\1 / \2,' $httpdcfg +sed -ri 's,^(Alias /dashboard)(/static /usr/share/openstack-dashboard/static),Alias \2,' $httpdcfg + +# This step is required because of: +# https://bugzilla.redhat.com/show_bug.cgi?id=1220070 +# Running this in the Dockerfile didn't fix the HTTP/500 as a result of the +# missing compress action. +python /usr/share/openstack-dashboard/manage.py compress + +/usr/sbin/httpd -DFOREGROUND diff --git a/docker/centos/binary/keystone/Dockerfile b/docker/centos/binary/keystone/Dockerfile new file mode 100644 index 000000000..377ef7b4f --- /dev/null +++ b/docker/centos/binary/keystone/Dockerfile @@ -0,0 +1,14 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +#Install required packages +RUN yum -y install openstack-keystone \ + python-keystoneclient \ + && yum clean all + +# Add start-up and check scripts +ADD ./start.sh /start.sh +ADD ./check.sh /check.sh + +# Run the Keystone start script +CMD ["/start.sh"] diff --git a/docker/centos/binary/keystone/build b/docker/centos/binary/keystone/build new file mode 120000 index 000000000..8d652f7ee --- /dev/null +++ b/docker/centos/binary/keystone/build @@ -0,0 +1 @@ +../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/keystone/check.sh b/docker/centos/binary/keystone/check.sh new file mode 100755 index 000000000..ca4844784 --- /dev/null +++ b/docker/centos/binary/keystone/check.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +RES=0 + +. /openrc +if ! keystone token-get > /dev/null; then + echo "ERROR: keystone token-get failed" >&2 + RES=1 +fi + +exit $RES + diff --git a/docker/centos/binary/keystone/start.sh b/docker/centos/binary/keystone/start.sh new file mode 100755 index 000000000..408f250e0 --- /dev/null +++ b/docker/centos/binary/keystone/start.sh @@ -0,0 +1,162 @@ +#!/bin/bash + +set -e + +# Run Kolla common script +echo "Running the kolla-common script" +. /opt/kolla/kolla-common.sh + +# Credentials, token, etc.. +: ${ADMIN_USER:=admin} +: ${ADMIN_USER_PASSWORD:=password} +: ${ADMIN_TENANT_NAME:=admin} +: ${KEYSTONE_USER:=keystone} +: ${KEYSTONE_ADMIN_PASSWORD:=password} +: ${KEYSTONE_ADMIN_TOKEN:=changeme} +# DB Settings +: ${INIT_DB:=true} +: ${KEYSTONE_DB_NAME:=keystone} +: ${KEYSTONE_DB_USER:=keystone} +: ${DB_ROOT_PASSWORD:=password} +: ${MARIADB_SERVICE_HOST:=$PUBLIC_IP} +: ${KEYSTONE_DB_PASSWORD:=password} +# Service Addresses/Ports/Version +: ${KEYSTONE_PUBLIC_SERVICE_HOST:=$PUBLIC_IP} +: ${KEYSTONE_ADMIN_SERVICE_HOST:=$PUBLIC_IP} +: ${KEYSTONE_PUBLIC_SERVICE_PORT:=5000} +: ${KEYSTONE_ADMIN_SERVICE_PORT:=35357} +: ${KEYSTONE_API_VERSION:=2.0} +# Logging +: ${LOG_FILE:=/var/log/keystone/keystone.log} +: ${VERBOSE_LOGGING:=true} +: ${DEBUG_LOGGING:=false} +: ${USE_STDERR:=false} +# Token provider, driver, etc.. +: ${TOKEN_PROVIDER:=uuid} +: ${TOKEN_DRIVER:=sql} + +## Check DB connectivity and required variables +echo "Checking connectivity to the DB" +fail_unless_db +echo "Checking for required variables" +check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_DB_PASSWORD \ + KEYSTONE_ADMIN_PASSWORD ADMIN_TENANT_NAME \ + KEYSTONE_PUBLIC_SERVICE_HOST KEYSTONE_ADMIN_SERVICE_HOST \ + PUBLIC_IP +dump_vars + +# Setup the Keystone DB +echo "Setting up Keystone DB" +mysql -h ${MARIADB_SERVICE_HOST} -u root -p"${DB_ROOT_PASSWORD}" mysql <<EOF +CREATE DATABASE IF NOT EXISTS ${KEYSTONE_DB_NAME}; +GRANT ALL PRIVILEGES ON ${KEYSTONE_DB_NAME}.* TO + '${KEYSTONE_DB_USER}'@'%' IDENTIFIED BY '${KEYSTONE_DB_PASSWORD}' +EOF + +# File path and name used by crudini tool +cfg=/etc/keystone/keystone.conf + +# Token Configuration +echo "Configuring keystone.conf" +crudini --set $cfg \ + DEFAULT \ + admin_token \ + "${KEYSTONE_ADMIN_TOKEN}" + +# Database Configuration +crudini --set $cfg \ + database \ + connection \ + "mysql://${KEYSTONE_DB_USER}:${KEYSTONE_DB_PASSWORD}@${MARIADB_SERVICE_HOST}/${KEYSTONE_DB_NAME}" + +# Logging +crudini --del $cfg \ + DEFAULT \ + log_dir +crudini --set $cfg \ + DEFAULT \ + log_file \ + ${LOG_FILE} +crudini --set $cfg \ + DEFAULT \ + verbose \ + ${VERBOSE_LOGGING} +crudini --set $cfg \ + DEFAULT \ + debug \ + ${DEBUG_LOGGING} +crudini --set $cfg \ + DEFAULT \ + use_stderr \ + ${USE_STDERR} + +# Token Management +crudini --set $cfg \ + token \ + provider \ + keystone.token.providers."${TOKEN_PROVIDER}".Provider +crudini --set $cfg \ + token \ + driver \ + keystone.token.persistence.backends."${TOKEN_DRIVER}".Token +crudini --set $cfg \ + revoke \ + driver \ + keystone.contrib.revoke.backends."${TOKEN_DRIVER}".Revoke + +# Setup the openrc auth file +cat > /openrc <<EOF +export OS_AUTH_URL=http://${KEYSTONE_ADMIN_SERVICE_HOST}:${KEYSTONE_ADMIN_SERVICE_PORT}/v${KEYSTONE_API_VERSION} +export OS_USERNAME=${KEYSTONE_USER} +export OS_PASSWORD=${KEYSTONE_ADMIN_PASSWORD} +export OS_TENANT_NAME=${ADMIN_TENANT_NAME} +EOF + +# Run PKI Setup script +echo "Setting up PKI" +/usr/bin/keystone-manage pki_setup --keystone-user keystone --keystone-group keystone + +# Fix permissions +chown -R keystone:keystone /var/log/keystone +chown -R keystone:keystone /etc/keystone/ssl +chmod -R o-rwx /etc/keystone/ssl + +# Initialize the Keystone DB +echo "Initializing Keystone DB" +if [ "${INIT_DB}" == "true" ] ; then + su -s /bin/bash -c "keystone-manage db_sync" keystone +fi + +# Start Keystone +echo "Starting Keystone" +/usr/bin/keystone-all & +PID=$! + +# Export Keystone service environment variables +export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}" +export SERVICE_ENDPOINT="http://${KEYSTONE_ADMIN_SERVICE_HOST}:${KEYSTONE_ADMIN_SERVICE_PORT}/v${KEYSTONE_API_VERSION}" + +# Check to make sure the service is running +echo "Verifying Keystone is running" +while ! curl -o /dev/null -s --fail ${SERVICE_ENDPOINT}; do + echo "waiting for Keystone @ ${SERVICE_ENDPOINT}" + sleep 1; +done +echo "keystone is active @ ${SERVICE_ENDPOINT}" + +# Create Keystone tenant, user, role, service and endpoints +echo "Creating Keystone tenant, user, role, service and endpoints" +crux user-create --update \ + -n ${ADMIN_USER} -p "${ADMIN_USER_PASSWORD}" \ + -t ${ADMIN_TENANT_NAME} -r admin +crux user-create --update \ + -n ${KEYSTONE_USER} -p "${KEYSTONE_ADMIN_PASSWORD}" \ + -t ${ADMIN_TENANT_NAME} -r admin +crux endpoint-create --remove-all \ + -n keystone -t identity \ + -I "http://${KEYSTONE_PUBLIC_SERVICE_HOST}:${KEYSTONE_PUBLIC_SERVICE_PORT}/v${KEYSTONE_API_VERSION}" \ + -A "http://${KEYSTONE_ADMIN_SERVICE_HOST}:${KEYSTONE_ADMIN_SERVICE_PORT}/v${KEYSTONE_API_VERSION}" \ + -P "http://${KEYSTONE_PUBLIC_SERVICE_HOST}:${KEYSTONE_PUBLIC_SERVICE_PORT}/v${KEYSTONE_API_VERSION}" + +# Wait on all jobs to exit before proceeding (see man wait) +wait diff --git a/docker/centos/binary/magnum/magnum-api/Dockerfile b/docker/centos/binary/magnum/magnum-api/Dockerfile new file mode 100644 index 000000000..84efa2a92 --- /dev/null +++ b/docker/centos/binary/magnum/magnum-api/Dockerfile @@ -0,0 +1,11 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%magnum-base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +RUN yum -y install \ + openstack-magnum-api \ + && yum clean all + +ADD ./start.sh /start.sh +ADD ./check.sh /check.sh + +CMD ["/start.sh"] diff --git a/docker/centos/binary/magnum/magnum-api/build b/docker/centos/binary/magnum/magnum-api/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/magnum/magnum-api/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/magnum/magnum-api/check.sh b/docker/centos/binary/magnum/magnum-api/check.sh new file mode 100755 index 000000000..ee03dc6d2 --- /dev/null +++ b/docker/centos/binary/magnum/magnum-api/check.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +RES=0 + +. /openrc +if ! keystone token-get > /dev/null; then + echo "ERROR: keystone token-get failed" >&2 + RES=1 +else + if ! heat stack-list > /dev/null; then + echo "ERROR: heat stack-list failed" >&2 + RES=1 + fi +fi + +exit $RES diff --git a/docker/centos/binary/magnum/magnum-api/start.sh b/docker/centos/binary/magnum/magnum-api/start.sh new file mode 100755 index 000000000..00a51b3cd --- /dev/null +++ b/docker/centos/binary/magnum/magnum-api/start.sh @@ -0,0 +1,27 @@ +#!/bin/bash +set -e + +. /opt/kolla/kolla-common.sh +. /opt/kolla/config-magnum.sh + +check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \ + MAGNUM_KEYSTONE_USER MAGNUM_KEYSTONE_PASSWORD \ + KEYSTONE_AUTH_PROTOCOL ADMIN_TENANT_NAME \ + MAGNUM_API_SERVICE_HOST KEYSTONE_ADMIN_SERVICE_PORT \ + MAGNUM_API_SERVICE_PORT + +fail_unless_os_service_running keystone + +export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}" +export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:${KEYSTONE_ADMIN_SERVICE_PORT}/v2.0" +crux user-create -n ${MAGNUM_KEYSTONE_USER} \ + -p ${MAGNUM_KEYSTONE_PASSWORD} \ + -t ${ADMIN_TENANT_NAME} \ + -r admin + +crux endpoint-create --remove-all -n ${MAGNUM_KEYSTONE_USER} -t container \ + -I "${KEYSTONE_AUTH_PROTOCOL}://${MAGNUM_API_SERVICE_HOST}:${MAGNUM_API_SERVICE_PORT}/v1" \ + -P "${KEYSTONE_AUTH_PROTOCOL}://${MAGNUM_API_SERVICE_HOST}:${MAGNUM_API_SERVICE_PORT}/v1" \ + -A "${KEYSTONE_AUTH_PROTOCOL}://${MAGNUM_API_SERVICE_HOST}:${MAGNUM_API_SERVICE_PORT}/v1" + +exec /usr/bin/magnum-api diff --git a/docker/centos/binary/magnum/magnum-base/Dockerfile b/docker/centos/binary/magnum/magnum-base/Dockerfile new file mode 100644 index 000000000..c9c3db08b --- /dev/null +++ b/docker/centos/binary/magnum/magnum-base/Dockerfile @@ -0,0 +1,9 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +# Magnum is not yet in upstream RDO packaging + +RUN curl https://copr.fedoraproject.org/coprs/sdake/openstack-magnum/repo/epel-7/sdake-openstack-magnum-epel-7.repo -o /etc/yum.repos.d/sdake-openstack-magnum-epel-7.repo + +RUN mkdir -p /opt/kolla +COPY config-magnum.sh /opt/kolla/config-magnum.sh diff --git a/docker/centos/binary/magnum/magnum-base/build b/docker/centos/binary/magnum/magnum-base/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/magnum/magnum-base/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/magnum/magnum-base/config-magnum.sh b/docker/centos/binary/magnum/magnum-base/config-magnum.sh new file mode 100755 index 000000000..03599d359 --- /dev/null +++ b/docker/centos/binary/magnum/magnum-base/config-magnum.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +set -e + +. /opt/kolla/kolla-common.sh + +check_required_vars MAGNUM_DB_PASSWORD MAGNUM_KEYSTONE_PASSWORD \ + KEYSTONE_PUBLIC_SERVICE_HOST KEYSTONE_PUBLIC_SERVICE_PORT \ + MAGNUM_KEYSTONE_USER ADMIN_TENANT_NAME \ + MAGNUM_DB_USER MAGNUM_DB_NAME KEYSTONE_AUTH_PROTOCOL \ + KEYSTONE_PUBLIC_SERVICE_PORT RABBITMQ_SERVICE_HOST \ + VERBOSE_LOGGING DEBUG_LOGGING + +fail_unless_db +dump_vars + +cat > /openrc <<EOF +export OS_AUTH_URL="http://${KEYSTONE_PUBLIC_SERVICE_HOST}:${KEYSTONE_PUBLIC_SERVICE_PORT}/v2.0" +export OS_USERNAME="${MAGNUM_KEYSTONE_USER}" +export OS_PASSWORD="${MAGNUM_KEYSTONE_PASSWORD}" +export OS_TENANT_NAME="${ADMIN_TENANT_NAME}" +EOF + +cfg=/etc/magnum/magnum.conf + +crudini --set $cfg DEFAULT log_file "" +crudini --set $cfg DEFAULT verbose "${VERBOSE_LOGGING}" +crudini --set $cfg DEFAULT debug "${DEBUG_LOGGING}" +crudini --set $cfg DEFAULT use_stderr true +crudini --set $cfg DEFAULT rpc_backend magnum.openstack.common.rpc.impl_kombu +crudini --set $cfg DEFAULT admin_user admin +crudini --set $cfg oslo_messaging_rabbit rabbit_host ${RABBITMQ_SERVICE_HOST} +crudini --set $cfg oslo_messaging_rabbit rabbit_userid ${RABBIT_USER} +crudini --set $cfg oslo_messaging_rabbit rabbit_password ${RABBIT_PASSWORD} +crudini --set $cfg database connection \ + mysql://${MAGNUM_DB_USER}:${MAGNUM_DB_PASSWORD}@${MARIADB_SERVICE_HOST}/${MAGNUM_DB_NAME} +crudini --set $cfg keystone_authtoken auth_protocol "${KEYSTONE_AUTH_PROTOCOL}" +crudini --set $cfg keystone_authtoken auth_host "${KEYSTONE_PUBLIC_SERVICE_HOST}" +crudini --set $cfg keystone_authtoken auth_port "${KEYSTONE_PUBLIC_SERVICE_PORT}" +crudini --set $cfg keystone_authtoken auth_uri \ + "${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_PUBLIC_SERVICE_HOST}:${KEYSTONE_PUBLIC_SERVICE_PORT}/v2.0" +crudini --set $cfg keystone_authtoken admin_tenant_name "${ADMIN_TENANT_NAME}" +crudini --set $cfg keystone_authtoken admin_user "${MAGNUM_KEYSTONE_USER}" +crudini --set $cfg keystone_authtoken admin_password \ + "${MAGNUM_KEYSTONE_PASSWORD}" +crudini --set $cfg api host ${MAGNUM_API_SERVICE_HOST} diff --git a/docker/centos/binary/magnum/magnum-conductor/Dockerfile b/docker/centos/binary/magnum/magnum-conductor/Dockerfile new file mode 100644 index 000000000..f3d506cb8 --- /dev/null +++ b/docker/centos/binary/magnum/magnum-conductor/Dockerfile @@ -0,0 +1,13 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%magnum-base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +RUN yum -y install \ + openstack-magnum-conductor \ + tar \ + && yum clean all + +# Install kubectl binary (ugh) +RUN cd /tmp && curl -L https://github.com/GoogleCloudPlatform/kubernetes/releases/download/v0.15.0/kubernetes.tar.gz -o /tmp/kubernetes.tar.gz && /usr/bin/tar -xzvf /tmp/kubernetes.tar.gz && cp -a /tmp/kubernetes/platforms/linux/amd64/kubectl /usr/bin/kubectl && rm -rf /tmp/kubernetes + +ADD ./start.sh /start.sh +CMD ["/start.sh"] diff --git a/docker/centos/binary/magnum/magnum-conductor/build b/docker/centos/binary/magnum/magnum-conductor/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/magnum/magnum-conductor/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/magnum/magnum-conductor/start.sh b/docker/centos/binary/magnum/magnum-conductor/start.sh new file mode 100755 index 000000000..4cf1291a3 --- /dev/null +++ b/docker/centos/binary/magnum/magnum-conductor/start.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +. /opt/kolla/kolla-common.sh +. /opt/kolla/config-magnum.sh + +check_required_vars MAGNUM_DB_NAME MAGNUM_DB_USER MAGNUM_DB_PASSWORD +fail_unless_db + +mysql -h ${MARIADB_SERVICE_HOST} -u root -p${DB_ROOT_PASSWORD} mysql <<EOF +CREATE DATABASE IF NOT EXISTS ${MAGNUM_DB_NAME} DEFAULT CHARACTER SET utf8; +GRANT ALL PRIVILEGES ON ${MAGNUM_DB_NAME}.* TO + '${MAGNUM_DB_USER}'@'%' IDENTIFIED BY '${MAGNUM_DB_PASSWORD}' +EOF + +/usr/bin/magnum-db-manage upgrade + +exec /usr/bin/magnum-conductor diff --git a/docker/centos/binary/mariadb-app/Dockerfile b/docker/centos/binary/mariadb-app/Dockerfile new file mode 100644 index 000000000..dc4025454 --- /dev/null +++ b/docker/centos/binary/mariadb-app/Dockerfile @@ -0,0 +1,18 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +# Install packages +# TODO check if hostname pkg is needed. +RUN yum -y install mariadb \ + mariadb-server \ + MySQL-python \ + hostname \ + && yum clean all + +# Add mysql configuration scripts +ADD config-mysql.sh /opt/kolla/config-mysql.sh +ADD mysql-entrypoint.sh /opt/kolla/mysql-entrypoint.sh + +# start mysql +ENTRYPOINT ["/opt/kolla/mysql-entrypoint.sh"] +CMD ["mysqld_safe"] diff --git a/docker/centos/binary/mariadb-app/build b/docker/centos/binary/mariadb-app/build new file mode 120000 index 000000000..8d652f7ee --- /dev/null +++ b/docker/centos/binary/mariadb-app/build @@ -0,0 +1 @@ +../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/mariadb-app/config-mysql.sh b/docker/centos/binary/mariadb-app/config-mysql.sh new file mode 100755 index 000000000..0d39fa870 --- /dev/null +++ b/docker/centos/binary/mariadb-app/config-mysql.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +. /opt/kolla/kolla-common.sh + +: ${BIND_ADDRESS:=$PUBLIC_IP} +: ${DB_ROOT_PASSWORD:=$DB_ROOT_PASSWORD} +: ${DEFAULT_STORAGE_ENGINE:=innodb} +: ${COLLATION_SERVER:=utf8_general_ci} +: ${INIT_CONNECT:=SET NAMES utf8} +: ${CHAR_SET_SERVER:=utf8} +: ${INNODB_FILE_PER_TABLE:=true} +: ${DATADIR:=/var/lib/mysql} +: ${TEMP_FILE:='/tmp/mysql-first-time.sql'} + +server_cnf=/etc/my.cnf.d/server.cnf + +crudini --set $server_cnf mysqld bind-address $BIND_ADDRESS +crudini --set $server_cnf mysqld default-storage-engine $DEFAULT_STORAGE_ENGINE +crudini --set $server_cnf mysqld collation-server $COLLATION_SERVER +crudini --set $server_cnf mysqld init-connect "'${INIT_CONNECT}'" +crudini --set $server_cnf mysqld character-set-server $CHAR_SET_SERVER +if [ "${INNODB_FILE_PER_TABLE}" == "true" ] || ["${INNODB_FILE_PER_TABLE}" == "True" ] ; then + crudini --set $server_cnf mysqld innodb_file_per_table 1 +fi diff --git a/docker/centos/binary/mariadb-app/mysql-entrypoint.sh b/docker/centos/binary/mariadb-app/mysql-entrypoint.sh new file mode 100755 index 000000000..1b4a559f1 --- /dev/null +++ b/docker/centos/binary/mariadb-app/mysql-entrypoint.sh @@ -0,0 +1,49 @@ +#!/bin/bash +set -e + +# Configure MySQL settings +. /opt/kolla/config-mysql.sh + +if [ -z "$(ls -A /var/lib/mysql)" -a "${1%_safe}" = 'mysqld' ]; then + PATH=/usr/libexec:$PATH + export PATH + + if [ -z "$MARIADB_ROOT_PASSWORD" ]; then + echo >&2 'error: database is uninitialized and MARIADB_ROOT_PASSWORD not set' + echo >&2 ' Did you forget to add -e MARIADB_ROOT_PASSWORD=... ?' + exit 1 + fi + + mysql_install_db --user=mysql --datadir="$DATADIR" + + # These statements _must_ be on individual lines, and _must_ end with + # semicolons (no line breaks or comments are permitted). + # TODO proper SQL escaping on ALL the things D: + TEMP_FILE='/tmp/mysql-first-time.sql' + cat > "$TEMP_FILE" <<-EOSQL + DELETE FROM mysql.user ; + CREATE USER 'root'@'%' IDENTIFIED BY '${MARIADB_ROOT_PASSWORD}' ; + GRANT ALL ON *.* TO 'root'@'%' WITH GRANT OPTION ; + DROP DATABASE IF EXISTS test ; + EOSQL + + if [ "$MARIADB_DATABASE" ]; then + echo "CREATE DATABASE IF NOT EXISTS $MARIADB_DATABASE ;" >> "$TEMP_FILE" + fi + + if [ "$MARIADB_USER" -a "$MARIADB_PASSWORD" ]; then + echo "CREATE USER '$MARIADB_USER'@'%' IDENTIFIED BY '$MARIADB_PASSWORD' ;" >> "$TEMP_FILE" + + if [ "$MARIADB_DATABASE" ]; then + echo "GRANT ALL ON $MARIADB_DATABASE.* TO '$MARIADB_USER'@'%' ;" >> "$TEMP_FILE" + fi + fi + + echo 'FLUSH PRIVILEGES ;' >> "$TEMP_FILE" + + set -- "$@" --init-file="$TEMP_FILE" +fi + +chown -R mysql:mysql "$DATADIR" + +exec "$@" diff --git a/docker/centos/binary/mariadb-data/Dockerfile b/docker/centos/binary/mariadb-data/Dockerfile new file mode 100644 index 000000000..f60599d16 --- /dev/null +++ b/docker/centos/binary/mariadb-data/Dockerfile @@ -0,0 +1,8 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +VOLUME [ "/var/lib/mysql" ] + +# Command needed to start the data container. +# Note: data containers do not need to be persistent. +CMD ["/bin/bash"] diff --git a/docker/centos/binary/mariadb-data/build b/docker/centos/binary/mariadb-data/build new file mode 120000 index 000000000..8d652f7ee --- /dev/null +++ b/docker/centos/binary/mariadb-data/build @@ -0,0 +1 @@ +../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/mongodb/Dockerfile b/docker/centos/binary/mongodb/Dockerfile new file mode 100644 index 000000000..e05047f02 --- /dev/null +++ b/docker/centos/binary/mongodb/Dockerfile @@ -0,0 +1,11 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +RUN yum -y install mongodb mongodb-server && yum clean all + +RUN mkdir -p /data/db + +VOLUME /data/db +VOLUME /var/log/mongodb + +ENTRYPOINT exec /bin/mongod --dbpath /data/db --logpath /var/log/mongodb/mongo.log --noprealloc --smallfiles diff --git a/docker/centos/binary/mongodb/build b/docker/centos/binary/mongodb/build new file mode 120000 index 000000000..8d652f7ee --- /dev/null +++ b/docker/centos/binary/mongodb/build @@ -0,0 +1 @@ +../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/neutron/neutron-agents/Dockerfile b/docker/centos/binary/neutron/neutron-agents/Dockerfile new file mode 100644 index 000000000..89ce874bb --- /dev/null +++ b/docker/centos/binary/neutron/neutron-agents/Dockerfile @@ -0,0 +1,39 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%neutron-base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +# Install supervisor +RUN easy_install supervisor + +# Install supervisor-stdout +RUN pip install supervisor-stdout + +# Install required packages +RUN yum install -y openstack-neutron openstack-neutron-linuxbridge \ + net-tools \ + && yum clean all + +# Add config scripts +ADD config-scripts/config-linuxbridge-agent.sh /opt/kolla/neutron/ +ADD config-scripts/config-dhcp-agent.sh /opt/kolla/neutron/ +ADD config-scripts/config-l3-agent.sh /opt/kolla/neutron/ +ADD config-scripts/config-metadata-agent.sh /opt/kolla/neutron/ +ADD config-scripts/config-sudoers.sh /opt/kolla/ + +# Add check scripts +ADD check-scripts/check-linuxbridge-agent.sh /opt/kolla/neutron/ +ADD check-scripts/check-dhcp-agent.sh /opt/kolla/neutron/ +ADD check-scripts/check-l3-agent.sh /opt/kolla/neutron/ +ADD check-scripts/check-metadata-agent.sh /opt/kolla/neutron/ + +# This is needed to workaround a problem with the agents exiting if the +# file is not present. This file really shouldn't need to be present and +# implies a configuration problem somewhere else in the code base, but +# we are out of time. +COPY fwaas_driver.ini /etc/neutron/ + +# Configure supervisord +RUN mkdir -p /var/log/supervisor/ +ADD supervisord.conf /etc/ + +# Start supervisor +CMD ["/usr/bin/supervisord"] diff --git a/docker/centos/binary/neutron/neutron-agents/build b/docker/centos/binary/neutron/neutron-agents/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/neutron/neutron-agents/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/neutron/neutron-agents/check-scripts/check-dhcp-agent.sh b/docker/centos/binary/neutron/neutron-agents/check-scripts/check-dhcp-agent.sh new file mode 100755 index 000000000..7dda736ef --- /dev/null +++ b/docker/centos/binary/neutron/neutron-agents/check-scripts/check-dhcp-agent.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +RES=0 + +check=$(/usr/bin/neutron agent-list | awk '/ DHCP / {print $9}') +error="ERROR: Neutron DHCP Agent is not alive." + +if [[ $check != ":-)" ]]; then + echo $error >&2 + RES=1 +fi + +exit $RES diff --git a/docker/centos/binary/neutron/neutron-agents/check-scripts/check-l3-agent.sh b/docker/centos/binary/neutron/neutron-agents/check-scripts/check-l3-agent.sh new file mode 100755 index 000000000..d32c1e272 --- /dev/null +++ b/docker/centos/binary/neutron/neutron-agents/check-scripts/check-l3-agent.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +RES=0 + +check=$(/usr/bin/neutron agent-list | awk '/ L3 / {print $9}') +error="ERROR: Neutron L3 Agent is not alive." + +if [[ $check != ":-)" ]]; then + echo $error >&2 + RES=1 +fi + +exit $RES diff --git a/docker/centos/binary/neutron/neutron-agents/check-scripts/check-linuxbridge-agent.sh b/docker/centos/binary/neutron/neutron-agents/check-scripts/check-linuxbridge-agent.sh new file mode 100755 index 000000000..4485fc1ec --- /dev/null +++ b/docker/centos/binary/neutron/neutron-agents/check-scripts/check-linuxbridge-agent.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +RES=0 + +check=$(/usr/bin/neutron agent-list | awk '/ Linux / {print $10}') +error="ERROR: Neutron Linux Bridge agent is not alive." + +if [[ $check != ":-)" ]]; then + echo $error >&2 + RES=1 +fi + +exit $RES diff --git a/docker/centos/binary/neutron/neutron-agents/check-scripts/check-metadata-agent.sh b/docker/centos/binary/neutron/neutron-agents/check-scripts/check-metadata-agent.sh new file mode 100755 index 000000000..fd1c6812b --- /dev/null +++ b/docker/centos/binary/neutron/neutron-agents/check-scripts/check-metadata-agent.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +RES=0 + +check=$(/usr/bin/neutron agent-list | awk '/ Metadata / {print $9}') +error="ERROR: Neutron Metadata Agent is not alive." + +if [[ $check != ":-)" ]]; then + echo $error >&2 + RES=1 +fi + +exit $RES diff --git a/docker/centos/binary/neutron/neutron-agents/config-scripts/config-dhcp-agent.sh b/docker/centos/binary/neutron/neutron-agents/config-scripts/config-dhcp-agent.sh new file mode 100755 index 000000000..1295d9c57 --- /dev/null +++ b/docker/centos/binary/neutron/neutron-agents/config-scripts/config-dhcp-agent.sh @@ -0,0 +1,88 @@ +#!/bin/bash + +set -e + +. /opt/kolla/config-neutron.sh +. /opt/kolla/config-sudoers.sh + +: ${DHCP_DRIVER:=neutron.agent.linux.dhcp.Dnsmasq} +: ${USE_NAMESPACES:=true} +: ${DELETE_NAMESPACES:=true} +: ${DNSMASQ_CONFIG_FILE:=/etc/neutron/dnsmasq/dnsmasq-neutron.conf} +: ${ROOT_HELPER:=sudo neutron-rootwrap /etc/neutron/rootwrap.conf} + +mkdir -p $(dirname $DNSMASQ_CONFIG_FILE) + +check_required_vars VERBOSE_LOGGING DEBUG_LOGGING MECHANISM_DRIVERS \ + DHCP_DRIVER USE_NAMESPACES DELETE_NAMESPACES \ + NEUTRON_LOG_DIR DNSMASQ_CONFIG_FILE \ + +cfg=/etc/neutron/dhcp_agent.ini +neutron_conf=/etc/neutron/neutron.conf + +# Workaround bug in dhclient in cirros images which does not correctly +# handle setting checksums of packets when using hardware with checksum +# offloading. See: +# https://www.rdoproject.org/forum/discussion/567/packstack-allinone-grizzly-cirros-image-cannot-get-a-dhcp-address-when-a-centos-image-can/p1 + +/usr/sbin/iptables -A POSTROUTING -t mangle -p udp --dport bootpc \ + -j CHECKSUM --checksum-fill + +if [[ ${MECHANISM_DRIVERS} =~ linuxbridge ]]; then + interface_driver="neutron.agent.linux.interface.BridgeInterfaceDriver" +elif [[ ${MECHANISM_DRIVERS} == "openvswitch" ]]; then + interface_driver="neutron.agent.linux.interface.OVSInterfaceDriver" +fi + +# Logging +crudini --set $neutron_conf \ + DEFAULT \ + log_file \ + "${NEUTRON_DHCP_AGENT_LOG_FILE}" + +# Configure dhcp_agent.ini +crudini --set $cfg \ + DEFAULT \ + verbose \ + "${VERBOSE_LOGGING}" +crudini --set $cfg \ + DEFAULT \ + debug \ + "${DEBUG_LOGGING}" +crudini --set $cfg \ + DEFAULT \ + interface_driver \ + "$interface_driver" +crudini --set $cfg \ + DEFAULT \ + dhcp_driver \ + "${DHCP_DRIVER}" +crudini --set $cfg \ + DEFAULT \ + use_namespaces \ + "${USE_NAMESPACES}" +crudini --set $cfg \ + DEFAULT \ + delete_namespaces \ + "${DELETE_NAMESPACES}" +crudini --set $cfg \ + DEFAULT \ + dnsmasq_config_file \ + "${DNSMASQ_CONFIG_FILE}" +crudini --set $cfg \ + DEFAULT \ + root_helper \ + "${ROOT_HELPER}" + +cat > ${DNSMASQ_CONFIG_FILE} <<EOF +dhcp-option-force=26,1450 +log-facility=${NEUTRON_LOG_DIR}/neutron-dnsmasq.log +EOF + +# Remove any existing qdhcp namespaces +ip netns list | grep qdhcp | while read -r line ; do + ip netns delete $line +done + +# Start DHCP Agent +exec /usr/bin/neutron-dhcp-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/dhcp_agent.ini --config-dir /etc/neutron diff --git a/docker/centos/binary/neutron/neutron-agents/config-scripts/config-l3-agent.sh b/docker/centos/binary/neutron/neutron-agents/config-scripts/config-l3-agent.sh new file mode 100755 index 000000000..9bb7168cd --- /dev/null +++ b/docker/centos/binary/neutron/neutron-agents/config-scripts/config-l3-agent.sh @@ -0,0 +1,85 @@ +#!/bin/bash + +set -e + +. /opt/kolla/config-neutron.sh +. /opt/kolla/config-sudoers.sh + +: ${USE_NAMESPACES:=true} + +check_required_vars VERBOSE_LOGGING DEBUG_LOGGING + +cfg=/etc/neutron/l3_agent.ini +neutron_conf=/etc/neutron/neutron.conf + +# Logging +crudini --set $neutron_conf \ + DEFAULT \ + log_file \ + "${NEUTRON_L3_AGENT_LOG_FILE}" + +# Configure l3_agent.ini +crudini --set $cfg \ + DEFAULT \ + verbose \ + "${VERBOSE_LOGGING}" +crudini --set $cfg \ + DEFAULT \ + debug \ + "${DEBUG_LOGGING}" +if [[ "${MECHANISM_DRIVERS}" =~ linuxbridge ]] ; then + crudini --set $cfg \ + DEFAULT \ + interface_driver \ + "neutron.agent.linux.interface.BridgeInterfaceDriver" + crudini --set $cfg \ + DEFAULT \ + gateway_external_network_id \ + "" + crudini --set $cfg \ + DEFAULT \ + external_network_bridge \ + "" +elif [[ "${MECHANISM_DRIVERS}" =~ .*openvswitch* ]] ; then + crudini --set $cfg \ + DEFAULT \ + interface_driver \ + "neutron.agent.linux.interface.OVSInterfaceDriver" + crudini --set $cfg \ + DEFAULT \ + gateway_external_network_id \ + "${NEUTRON_FLAT_NETWORK_BRIDGE}" + crudini --set $cfg \ + DEFAULT \ + external_network_bridge \ + "${NEUTRON_FLAT_NETWORK_BRIDGE}" +fi + +crudini --set $cfg \ + DEFAULT \ + use_namespaces \ + "${USE_NAMESPACES}" + +if [ "${USE_NAMESPACES}" == "false" ] ; then + source /openrc + # Create router if it does not exist + /usr/bin/neutron router-list | grep admin-router || /usr/bin/neutron router-create admin-router + # Set router-id + crudini --set $cfg \ + DEFAULT \ + router_id \ + "$(/usr/bin/neutron router-list | awk '/ admin-router / {print $2}')" +elif [ "${USE_NAMESPACES}" == "true" ] ; then + crudini --set $cfg \ + DEFAULT \ + router_delete_namespaces \ + "true" +fi + +# Remove any existing qrouter namespaces +ip netns list | grep qrouter | while read -r line ; do + ip netns delete $line +done + +# Start L3 Agent +exec /usr/bin/neutron-l3-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/l3_agent.ini --config-file /etc/neutron/fwaas_driver.ini --config-dir /etc/neutron diff --git a/docker/centos/binary/neutron/neutron-agents/config-scripts/config-linuxbridge-agent.sh b/docker/centos/binary/neutron/neutron-agents/config-scripts/config-linuxbridge-agent.sh new file mode 100755 index 000000000..fbf540f6e --- /dev/null +++ b/docker/centos/binary/neutron/neutron-agents/config-scripts/config-linuxbridge-agent.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +set -e + +. /opt/kolla/config-neutron.sh +. /opt/kolla/config-sudoers.sh + +: ${NEUTRON_FLAT_NETWORK_NAME:=physnet1} +: ${NEUTRON_FLAT_NETWORK_INTERFACE:=eth1} + +check_required_vars PUBLIC_IP NEUTRON_FLAT_NETWORK_NAME \ + NEUTRON_FLAT_NETWORK_INTERFACE + +cfg=/etc/neutron/plugins/ml2/ml2_conf.ini + +# Configure ml2_conf.ini +if [[ ${TYPE_DRIVERS} =~ vxlan ]]; then + crudini --set $cfg \ + vxlan \ + local_ip \ + "${PUBLIC_IP}" +fi + +crudini --set $cfg \ + linux_bridge \ + physical_interface_mappings \ + "${NEUTRON_FLAT_NETWORK_NAME}:${NEUTRON_FLAT_NETWORK_INTERFACE}" + +exec /usr/bin/neutron-linuxbridge-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini --config-dir /etc/neutron diff --git a/docker/centos/binary/neutron/neutron-agents/config-scripts/config-metadata-agent.sh b/docker/centos/binary/neutron/neutron-agents/config-scripts/config-metadata-agent.sh new file mode 100755 index 000000000..d1eef341c --- /dev/null +++ b/docker/centos/binary/neutron/neutron-agents/config-scripts/config-metadata-agent.sh @@ -0,0 +1,74 @@ +#!/bin/bash + +set -e + +. /opt/kolla/config-neutron.sh +. /opt/kolla/config-sudoers.sh + +: ${KEYSTONE_REGION:=RegionOne} +: ${ENDPOINT_TYPE:=adminURL} +: ${NEUTRON_SHARED_SECRET:=sharedsecret} + +check_required_vars VERBOSE_LOGGING DEBUG_LOGGING KEYSTONE_AUTH_PROTOCOL \ + KEYSTONE_PUBLIC_SERVICE_HOST ADMIN_TENANT_NAME \ + NEUTRON_KEYSTONE_USER NEUTRON_KEYSTONE_PASSWORD \ + NEUTRON_SHARED_SECRET NOVA_METADATA_API_SERVICE_HOST \ + NOVA_METADATA_API_SERVICE_PORT + +cfg=/etc/neutron/metadata_agent.ini +neutron_conf=/etc/neutron/neutron.conf + +# Logging +crudini --set $neutron_conf \ + DEFAULT \ + log_file \ + "${NEUTRON_METADATA_AGENT_LOG_FILE}" + +# Configure metadata_agent.ini +crudini --set $cfg \ + DEFAULT \ + verbose \ + "${VERBOSE_LOGGING}" +crudini --set $cfg \ + DEFAULT \ + debug \ + "${DEBUG_LOGGING}" +crudini --set $cfg \ + DEFAULT \ + auth_region \ + "${KEYSTONE_REGION}" +crudini --set $cfg \ + DEFAULT \ + endpoint_type \ + "${ENDPOINT_TYPE}" +crudini --set $cfg \ + DEFAULT \ + auth_url \ + "${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_PUBLIC_SERVICE_HOST}:${KEYSTONE_PUBLIC_SERVICE_PORT}/v2.0" +crudini --set $cfg \ + DEFAULT \ + admin_tenant_name \ + "${ADMIN_TENANT_NAME}" +crudini --set $cfg \ + DEFAULT \ + admin_user \ + "${NEUTRON_KEYSTONE_USER}" +crudini --set $cfg \ + DEFAULT \ + admin_password \ + "${NEUTRON_KEYSTONE_PASSWORD}" +crudini --set $cfg \ + DEFAULT \ + nova_metadata_ip \ + "${NOVA_METADATA_API_SERVICE_HOST}" +crudini --set $cfg \ + DEFAULT \ + nova_metadata_port \ + "${NOVA_METADATA_API_SERVICE_PORT}" +crudini --set $cfg \ + DEFAULT \ + metadata_proxy_shared_secret \ + "${NEUTRON_SHARED_SECRET}" + +# Start Metadata Agent +exec /usr/bin/neutron-metadata-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/metadata_agent.ini --config-dir /etc/neutron diff --git a/docker/centos/binary/neutron/neutron-agents/config-scripts/config-sudoers.sh b/docker/centos/binary/neutron/neutron-agents/config-scripts/config-sudoers.sh new file mode 100755 index 000000000..198420026 --- /dev/null +++ b/docker/centos/binary/neutron/neutron-agents/config-scripts/config-sudoers.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Neutron uses rootwrap which requires a tty for sudo. +# Since the container is running in daemon mode, a tty +# is not present and requiretty must be commented out. +if [ ! -f /var/run/sudo-modified ]; then + chmod 0640 /etc/sudoers + sed -i '/Defaults requiretty/s/^/#/' /etc/sudoers + chmod 0440 /etc/sudoers +fi + +touch /var/run/sudo-modified diff --git a/docker/centos/binary/neutron/neutron-agents/fwaas_driver.ini b/docker/centos/binary/neutron/neutron-agents/fwaas_driver.ini new file mode 100644 index 000000000..41f761abf --- /dev/null +++ b/docker/centos/binary/neutron/neutron-agents/fwaas_driver.ini @@ -0,0 +1,3 @@ +[fwaas] +#driver = neutron.services.firewall.drivers.linux.iptables_fwaas.IptablesFwaasDriver +#enabled = True diff --git a/docker/centos/binary/neutron/neutron-agents/supervisord.conf b/docker/centos/binary/neutron/neutron-agents/supervisord.conf new file mode 100644 index 000000000..7455cb3d7 --- /dev/null +++ b/docker/centos/binary/neutron/neutron-agents/supervisord.conf @@ -0,0 +1,53 @@ +[unix_http_server] +file = /var/run/supervisor.sock + +[inet_http_server] +port = 127.0.0.1:9001 + +[supervisord] +nodaemon=true +logfile = /var/log/supervisor/supervisord.log +logfile_maxbytes = 200KB +logfile_backups = 1 +pidfile = /var/run/supervisord.pid +childlogdir = /var/log/supervisor + +[rpcinterface:supervisor] +supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface + +[supervisorctl] +serverurl = unix:///var/run/supervisor.sock + +[program:neutron-linuxbridge-agent] +command=/opt/kolla/neutron/config-linuxbridge-agent.sh +priority=30 +startsec=10 +stderr_events_enabled=true +stdout_events_enabled=true + +[program:neutron-dhcp-agent] +command=/opt/kolla/neutron/config-dhcp-agent.sh +priority=40 +startsec=10 +stderr_events_enabled=true +stdout_events_enabled=true + +[program:neutron-metadata-agent] +command=/opt/kolla/neutron/config-metadata-agent.sh +priority=40 +startsec=10 +stderr_events_enabled=true +stdout_events_enabled=true + +[program:neutron-l3-agent] +command=/opt/kolla/neutron/config-l3-agent.sh +priority=40 +startsec=10 +stderr_events_enabled=true +stdout_events_enabled=true + +[eventlistener:stdout] +command = supervisor_stdout +buffer_size = 100 +events = PROCESS_LOG +result_handler = supervisor_stdout:event_handler diff --git a/docker/centos/binary/neutron/neutron-base/Dockerfile b/docker/centos/binary/neutron/neutron-base/Dockerfile new file mode 100644 index 000000000..c8a5ef2d9 --- /dev/null +++ b/docker/centos/binary/neutron/neutron-base/Dockerfile @@ -0,0 +1,7 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +RUN yum -y install openstack-neutron-ml2 && yum clean all + +RUN mkdir -p /opt/kolla +COPY config-neutron.sh /opt/kolla/config-neutron.sh diff --git a/docker/centos/binary/neutron/neutron-base/build b/docker/centos/binary/neutron/neutron-base/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/neutron/neutron-base/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/neutron/neutron-base/config-neutron.sh b/docker/centos/binary/neutron/neutron-base/config-neutron.sh new file mode 100644 index 000000000..8f6c87534 --- /dev/null +++ b/docker/centos/binary/neutron/neutron-base/config-neutron.sh @@ -0,0 +1,210 @@ +#!/bin/bash + +set -e + +. /opt/kolla/kolla-common.sh + +# Database +: ${NEUTRON_DB_NAME:=neutron} +: ${NEUTRON_DB_USER:=neutron} +: ${NEUTRON_DB_PASSWORD:=password} +# Keystone +: ${ADMIN_TENANT_NAME:=admin} +: ${NEUTRON_KEYSTONE_USER:=neutron} +: ${NEUTRON_KEYSTONE_PASSWORD:=password} +: ${KEYSTONE_AUTH_PROTOCOL:=http} +: ${KEYSTONE_ADMIN_SERVICE_HOST:=127.0.0.1} +: ${KEYSTONE_PUBLIC_SERVICE_HOST:=127.0.0.1} +: ${KEYSTONE_ADMIN_SERVICE_PORT:=35357} +: ${KEYSTONE_PUBLIC_SERVICE_PORT:=5000} +: ${KEYSTONE_REGION:=RegionOne} +# RabbitMQ +: ${RABBIT_HOST:=$RABBITMQ_SERVICE_HOST} +: ${RABBIT_USER:=guest} +: ${RABBIT_PASSWORD:=guest} +# Logging +: ${VERBOSE_LOGGING:=true} +: ${DEBUG_LOGGING:=false} +# Networking +: ${NEUTRON_FLAT_NETWORK_NAME:=physnet1} +# Paste configuration file +: ${API_PASTE_CONFIG:=/usr/share/neutron/api-paste.ini} + +check_required_vars NEUTRON_KEYSTONE_PASSWORD NEUTRON_API_PASTE_CONFIG \ + KEYSTONE_PUBLIC_SERVICE_HOST RABBITMQ_SERVICE_HOST + +core_cfg=/etc/neutron/neutron.conf +ml2_cfg=/etc/neutron/plugins/ml2/ml2_conf.ini + +# Logging +crudini --set $core_cfg \ + DEFAULT \ + log_dir \ + "${NEUTRON_LOG_DIR}" +crudini --set $core_cfg \ + DEFAULT \ + verbose \ + "${VERBOSE_LOGGING}" +crudini --set $core_cfg \ + DEFAULT \ + debug \ + "${DEBUG_LOGGING}" + +# Paste config +crudini --set $core_cfg \ + DEFAULT \ + api_paste_config \ + "${NEUTRON_API_PASTE_CONFIG}" + +# Rabbit +crudini --set $core_cfg \ + DEFAULT \ + rabbit_host \ + "${RABBIT_HOST}" +crudini --set $core_cfg \ + DEFAULT \ + rabbit_userid \ + "${RABBIT_USER}" +crudini --set $core_cfg \ + DEFAULT \ + rabbit_password \ + "${RABBIT_PASSWORD}" + +# Locking +crudini --set $core_cfg \ + DEFAULT \ + lock_path \ + "/var/lock/neutron" + +# Keystone +crudini --set $core_cfg \ + DEFAULT \ + auth_strategy \ + "keystone" +crudini --set $core_cfg \ + keystone_authtoken \ + auth_uri \ + "${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_PUBLIC_SERVICE_HOST}:${KEYSTONE_PUBLIC_SERVICE_PORT}/v2.0" +crudini --set $core_cfg \ + keystone_authtoken \ + identity_uri \ + "${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:${KEYSTONE_ADMIN_SERVICE_PORT}" +crudini --set $core_cfg \ + keystone_authtoken \ + admin_tenant_name \ + "${ADMIN_TENANT_NAME}" +crudini --set $core_cfg \ + keystone_authtoken \ + admin_user \ + "${NEUTRON_KEYSTONE_USER}" +crudini --set $core_cfg \ + keystone_authtoken \ + admin_password \ + "${NEUTRON_KEYSTONE_PASSWORD}" + +# Rootwrap +crudini --set $core_cfg \ + agent \ + root_helper \ + "sudo neutron-rootwrap /etc/neutron/rootwrap.conf" + +# neutron.conf ml2 configuration +crudini --set $core_cfg \ + DEFAULT \ + core_plugin \ + "neutron.plugins.ml2.plugin.Ml2Plugin" +crudini --set $core_cfg \ + DEFAULT \ + service_plugins \ + "neutron.services.l3_router.l3_router_plugin.L3RouterPlugin" +crudini --set $core_cfg \ + DEFAULT \ + allow_overlapping_ips \ + "True" + +# Configure ml2_conf.ini +crudini --set $ml2_cfg \ + ml2 \ + type_drivers \ + "${TYPE_DRIVERS}" +crudini --set $ml2_cfg \ + ml2 \ + tenant_network_types \ + "${TENANT_NETWORK_TYPES}" +crudini --set $ml2_cfg \ + ml2 \ + mechanism_drivers \ + "${MECHANISM_DRIVERS}" + +if [[ ${TYPE_DRIVERS} =~ .*flat.* ]]; then + crudini --set $ml2_cfg \ + ml2_type_flat \ + flat_networks \ + ${NEUTRON_FLAT_NETWORK_NAME} +fi + +if [[ ${TYPE_DRIVERS} =~ .*vxlan.* ]]; then + crudini --set $ml2_cfg \ + ml2_type_vxlan \ + vxlan_group \ + "" + crudini --set $ml2_cfg \ + ml2_type_vxlan \ + vni_ranges \ + "1:1000" + crudini --set $ml2_cfg \ + vxlan \ + enable_vxlan \ + "True" + crudini --set $ml2_cfg \ + vxlan \ + vxlan_group \ + "" + crudini --set $ml2_cfg \ + vxlan \ + l2_population \ + "True" + crudini --set $ml2_cfg \ + agent \ + tunnel_types \ + "vxlan" + crudini --set $ml2_cfg \ + agent \ + vxlan_udp_port \ + "4789" + crudini --set $core_cfg \ + DEFAULT \ + network_device_mtu \ + "1450" +fi + +crudini --set $ml2_cfg \ + l2pop \ + agent_boot_time \ + "180" +crudini --set $ml2_cfg \ + securitygroup \ + enable_security_group \ + "True" +crudini --set $ml2_cfg \ + securitygroup \ + enable_ipset \ + "True" + +if [[ ${MECHANISM_DRIVERS} =~ linuxbridge ]]; then + firewall_driver="neutron.agent.linux.iptables_firewall.IptablesFirewallDriver" +elif [[ ${MECHANISM_DRIVERS} == "openvswitch" ]]; then + firewall_driver="neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver" +fi + + crudini --set $ml2_cfg \ + securitygroup \ + firewall_driver \ + "$firewall_driver" + +cat > /openrc <<EOF +export OS_AUTH_URL="http://${KEYSTONE_PUBLIC_SERVICE_HOST}:${KEYSTONE_PUBLIC_SERVICE_PORT}/v2.0" +export OS_USERNAME="${NEUTRON_KEYSTONE_USER}" +export OS_PASSWORD="${NEUTRON_KEYSTONE_PASSWORD}" +export OS_TENANT_NAME="${ADMIN_TENANT_NAME}" +EOF diff --git a/docker/centos/binary/neutron/neutron-server/Dockerfile b/docker/centos/binary/neutron/neutron-server/Dockerfile new file mode 100644 index 000000000..8d59dd04a --- /dev/null +++ b/docker/centos/binary/neutron/neutron-server/Dockerfile @@ -0,0 +1,13 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%neutron-base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +#Install required packages +RUN yum install -y openstack-neutron \ + python-neutronclient \ + which \ + && yum clean all + +ADD ./start.sh /start.sh +ADD ./check.sh /check.sh + +CMD ["/start.sh"] diff --git a/docker/centos/binary/neutron/neutron-server/build b/docker/centos/binary/neutron/neutron-server/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/neutron/neutron-server/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/neutron/neutron-server/check.sh b/docker/centos/binary/neutron/neutron-server/check.sh new file mode 100755 index 000000000..4e9aa623c --- /dev/null +++ b/docker/centos/binary/neutron/neutron-server/check.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +RES=0 + +. /openrc +if ! keystone token-get > /dev/null; then + echo "ERROR: keystone token-get failed" >&2 + RES=1 +else + if ! neutron ext-list > /dev/null; then + echo "ERROR: neutron ext-list failed" >&2 + RES=1 + fi +fi + +exit $RES + diff --git a/docker/centos/binary/neutron/neutron-server/start.sh b/docker/centos/binary/neutron/neutron-server/start.sh new file mode 100755 index 000000000..aaaa7a994 --- /dev/null +++ b/docker/centos/binary/neutron/neutron-server/start.sh @@ -0,0 +1,98 @@ +#!/bin/bash + +set -e + +. /opt/kolla/config-neutron.sh + +: ${NEUTRON_FLAT_NETWORK_NAME:=physnet1} +: ${NEUTRON_FLAT_NETWORK_INTERFACE:=eth1} + +check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \ + KEYSTONE_AUTH_PROTOCOL NOVA_API_SERVICE_HOST \ + NOVA_KEYSTONE_USER NOVA_KEYSTONE_PASSWORD \ + NEUTRON_DB_NAME NEUTRON_DB_USER NEUTRON_DB_PASSWORD \ + NEUTRON_KEYSTONE_USER NEUTRON_KEYSTONE_PASSWORD \ + ADMIN_TENANT_NAME NEUTRON_SERVER_SERVICE_HOST \ + PUBLIC_IP NEUTRON_DB_PASSWORD +fail_unless_os_service_running keystone +fail_unless_db + +mysql -h ${MARIADB_SERVICE_HOST} -u root -p${DB_ROOT_PASSWORD} mysql <<EOF +CREATE DATABASE IF NOT EXISTS ${NEUTRON_DB_NAME} DEFAULT CHARACTER SET utf8; +GRANT ALL PRIVILEGES ON ${NEUTRON_DB_NAME}.* TO + '${NEUTRON_DB_USER}'@'%' IDENTIFIED BY '${NEUTRON_DB_PASSWORD}' + +EOF + +export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}" +export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:${KEYSTONE_ADMIN_SERVICE_PORT}/v2.0" + +# Configure Keystone Service Catalog +crux user-create -n "${NEUTRON_KEYSTONE_USER}" \ + -p "${NEUTRON_KEYSTONE_PASSWORD}" \ + -t "${ADMIN_TENANT_NAME}" \ + -r admin + +crux endpoint-create -n neutron -t network \ + -I "${KEYSTONE_AUTH_PROTOCOL}://${NEUTRON_SERVER_SERVICE_HOST}:${NEUTRON_SERVER_SERVICE_PORT}" \ + -P "${KEYSTONE_AUTH_PROTOCOL}://${NEUTRON_SERVER_SERVICE_HOST}:${NEUTRON_SERVER_SERVICE_PORT}" \ + -A "${KEYSTONE_AUTH_PROTOCOL}://${NEUTRON_SERVER_SERVICE_HOST}:${NEUTRON_SERVER_SERVICE_PORT}" + +core_cfg=/etc/neutron/neutron.conf +ml2_cfg=/etc/neutron/plugins/ml2/ml2_conf.ini + +# Logging +crudini --set /etc/neutron/neutron.conf \ + DEFAULT \ + log_file \ + "${NEUTRON_SERVER_LOG_FILE}" + +# Database +crudini --set $core_cfg \ + database \ + connection \ + "mysql://${NEUTRON_DB_USER}:${NEUTRON_DB_PASSWORD}@${MARIADB_SERVICE_HOST}/${NEUTRON_DB_NAME}" +# Nova +crudini --set $core_cfg \ + DEFAULT \ + notify_nova_on_port_status_changes \ + "True" +crudini --set $core_cfg \ + DEFAULT \ + notify_nova_on_port_data_changes \ + "True" +crudini --set $core_cfg \ + DEFAULT \ + nova_url \ + "http://${NOVA_API_SERVICE_HOST}:${NOVA_API_SERVICE_PORT}/v2" +crudini --set $core_cfg \ + DEFAULT \ + nova_admin_auth_url \ + "${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:${KEYSTONE_ADMIN_SERVICE_PORT}/v2.0" +crudini --set $core_cfg \ + DEFAULT \ + nova_region_name \ + "${KEYSTONE_REGION}" +crudini --set $core_cfg \ + DEFAULT \ + nova_admin_username \ + "${NOVA_KEYSTONE_USER}" +crudini --set $core_cfg \ + DEFAULT \ + nova_admin_tenant_id \ + "$(keystone tenant-list | grep $ADMIN_TENANT_NAME | awk '{print $2;}')" +crudini --set $core_cfg \ + DEFAULT \ + nova_admin_password \ + "${NOVA_KEYSTONE_PASSWORD}" + +if [[ ${MECHANISM_DRIVERS} =~ linuxbridge ]]; then + crudini --set $ml2_cfg \ + linux_bridge \ + physical_interface_mappings \ + "${NEUTRON_FLAT_NETWORK_NAME}:${NEUTRON_FLAT_NETWORK_INTERFACE}" +fi + +su -s /bin/bash -c "neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron + +exec /usr/bin/neutron-server --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini diff --git a/docker/centos/binary/nova-base/Dockerfile b/docker/centos/binary/nova-base/Dockerfile new file mode 100644 index 000000000..d116ac973 --- /dev/null +++ b/docker/centos/binary/nova-base/Dockerfile @@ -0,0 +1,11 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +RUN yum -y install openstack-nova-common \ + python-keystoneclient \ + python-cinderclient \ + python-nova \ + bridge-utils && yum clean all + +ADD config-nova.sh /opt/kolla/config-nova.sh + diff --git a/docker/centos/binary/nova-base/build b/docker/centos/binary/nova-base/build new file mode 120000 index 000000000..8d652f7ee --- /dev/null +++ b/docker/centos/binary/nova-base/build @@ -0,0 +1 @@ +../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/nova-base/config-nova.sh b/docker/centos/binary/nova-base/config-nova.sh new file mode 100755 index 000000000..b5172ee80 --- /dev/null +++ b/docker/centos/binary/nova-base/config-nova.sh @@ -0,0 +1,137 @@ +#!/bin/bash + +. /opt/kolla/kolla-common.sh + +: ${NOVA_DB_USER:=nova} +: ${NOVA_DB_NAME:=nova} +: ${NOVA_KEYSTONE_USER:=admin} +: ${NOVA_KEYSTONE_PASSWORD:=kolla} +: ${ADMIN_TENANT_NAME:=admin} +: ${RABBIT_USERID:=guest} +: ${RABBIT_PASSWORD:=guest} +: ${NETWORK_MANAGER:=nova} +: ${FLAT_NETWORK:=eth1} +: ${PUBLIC_NETWORK:=eth0} +: ${ENABLED_APIS:=ec2,osapi_compute,metadata} +: ${METADATA_HOST:=$PUBLIC_IP} +: ${NEUTRON_SHARED_SECRET:=sharedsecret} + +check_required_vars KEYSTONE_ADMIN_TOKEN NOVA_DB_PASSWORD \ + RABBITMQ_SERVICE_HOST GLANCE_API_SERVICE_HOST \ + KEYSTONE_PUBLIC_SERVICE_HOST PUBLIC_IP \ + PUBLIC_INTERFACE FLAT_INTERFACE DEBUG_LOGGING \ + VERBOSE_LOGGING + +cfg=/etc/nova/nova.conf + +crudini --set $cfg DEFAULT amqp_durable_queues False +crudini --set $cfg DEFAULT rabbit_host ${RABBITMQ_SERVICE_HOST} +crudini --set $cfg DEFAULT rabbit_port 5672 +crudini --set $cfg DEFAULT rabbit_hosts ${RABBITMQ_SERVICE_HOST}:5672 +crudini --set $cfg DEFAULT rabbit_use_ssl False +crudini --set $cfg DEFAULT rabbit_userid ${RABBIT_USERID} +crudini --set $cfg DEFAULT rabbit_password "${RABBIT_PASSWORD}" +crudini --set $cfg DEFAULT rabbit_virtual_host / +crudini --set $cfg DEFAULT rabbit_ha_queues False +crudini --set $cfg DEFAULT rpc_backend nova.openstack.common.rpc.impl_kombu +crudini --set $cfg DEFAULT enabled_apis ${ENABLED_APIS} +crudini --set $cfg DEFAULT ec2_listen 0.0.0.0 +crudini --set $cfg DEFAULT osapi_compute_listen 0.0.0.0 +crudini --set $cfg DEFAULT osapi_compute_workers 8 +crudini --set $cfg DEFAULT metadata_host ${METADATA_HOST} +crudini --set $cfg DEFAULT metadata_listen 0.0.0.0 +crudini --set $cfg DEFAULT metadata_workers 8 +crudini --set $cfg DEFAULT service_down_time 60 +crudini --set $cfg DEFAULT rootwrap_config /etc/nova/rootwrap.conf +crudini --set $cfg DEFAULT auth_strategy keystone +crudini --set $cfg DEFAULT use_forwarded_for False +crudini --set $cfg DEFAULT glance_api_servers ${GLANCE_API_SERVICE_HOST}:9292 +crudini --set $cfg DEFAULT cpu_allocation_ratio 16.0 +crudini --set $cfg DEFAULT ram_allocation_ratio 1.5 +crudini --set $cfg DEFAULT scheduler_default_filters RetryFilter,AvailabilityZoneFilter,RamFilter,ComputeFilter,ComputeCapabilitiesFilter,ImagePropertiesFilter,CoreFilter +crudini --set $cfg DEFAULT compute_driver nova.virt.libvirt.LibvirtDriver +crudini --set $cfg DEFAULT vif_plugging_is_fatal True +crudini --set $cfg DEFAULT vif_plugging_timeout 300 +crudini --set $cfg DEFAULT volume_api_class nova.volume.cinder.API +crudini --set $cfg DEFAULT image_service nova.image.glance.GlanceImageService +crudini --set $cfg DEFAULT osapi_volume_listen 0.0.0.0 +crudini --set $cfg DEFAULT instances_path /var/lib/nova/instances +crudini --set $cfg DEFAULT lock_path /var/lib/nova/lock + +# This is not created by openstack-nova packaging +mkdir -p /var/lib/nova/lock + +# configure logging +crudini --set $cfg DEFAULT log_dir "${NOVA_LOG_DIR}" +crudini --set $cfg DEFAULT debug "${DEBUG_LOGGING}" +crudini --set $cfg DEFAULT verbose "${VERBOSE_LOGGING}" + +crudini --set $cfg DEFAULT admin_token "${KEYSTONE_ADMIN_TOKEN}" + +crudini --set $cfg conductor workers 8 + +if [ "${NETWORK_MANAGER}" == "nova" ] ; then + crudini --set $cfg DEFAULT network_manager nova.network.manager.FlatDHCPManager + crudini --set $cfg DEFAULT firewall_driver nova.virt.libvirt.firewall.IptablesFirewallDriver + crudini --set $cfg DEFAULT network_size 254 + crudini --set $cfg DEFAULT allow_same_net_traffic False + crudini --set $cfg DEFAULT multi_host True + crudini --set $cfg DEFAULT send_arp_for_ha True + crudini --set $cfg DEFAULT share_dhcp_address True + crudini --set $cfg DEFAULT force_dhcp_release True + crudini --set $cfg DEFAULT flat_interface $FLAT_INTERFACE + crudini --set $cfg DEFAULT flat_network_bridge br100 + crudini --set $cfg DEFAULT public_interface $PUBLIC_INTERFACE +elif [ "${NETWORK_MANAGER}" == "neutron" ] ; then + check_required_vars NEUTRON_SHARED_SECRET + crudini --set $cfg neutron service_metadata_proxy True + crudini --set $cfg neutron metadata_proxy_shared_secret ${NEUTRON_SHARED_SECRET} + crudini --set $cfg DEFAULT neutron_default_tenant_id default + crudini --set $cfg DEFAULT network_api_class nova.network.neutronv2.api.API + crudini --set $cfg DEFAULT security_group_api neutron + if [[ "${MECHANISM_DRIVERS}" =~ linuxbridge ]] ; then + crudini --set $cfg DEFAULT linuxnet_interface_driver nova.network.linux_net.NeutronLinuxBridgeInterfaceDriver + elif [[ "${MECHANISM_DRIVERS}" =~ openvswitch ]] ; then + crudini --set $cfg DEFAULT linuxnet_interface_driver nova.network.linux_net.LinuxOVSInterfaceDriver + fi + crudini --set $cfg DEFAULT libvirt_vif_driver nova.virt.libvirt.vif.LibvirtGenericVIFDriver + crudini --set $cfg DEFAULT firewall_driver nova.virt.firewall.NoopFirewallDriver + crudini --set $cfg neutron url http://${NEUTRON_SERVER_SERVICE_HOST}:${NEUTRON_SERVER_SERVICE_PORT} + crudini --set $cfg neutron auth_strategy keystone + crudini --set $cfg neutron admin_auth_url ${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:${KEYSTONE_ADMIN_SERVICE_PORT}/v2.0 + crudini --set $cfg neutron admin_tenant_name ${ADMIN_TENANT_NAME} + crudini --set $cfg neutron admin_username ${NEUTRON_KEYSTONE_USER} + crudini --set $cfg neutron admin_password ${NEUTRON_KEYSTONE_PASSWORD} +else + echo "Incorrect NETWORK_MANAGER ${NETWORK_MANAGER}. Supported options are nova and neutron." + exit 1 +fi + +# disabled pending answers to http://lists.openstack.org/pipermail/openstack/2014-October/009997.html +#for option in auth_protocol auth_host auth_port; do +# crudini --del $cfg \ +# keystone_authtoken \ +# $option +#done + +crudini --set $cfg keystone_authtoken auth_uri "http://${KEYSTONE_PUBLIC_SERVICE_HOST}:5000/" +crudini --set $cfg keystone_authtoken auth_protocol http +crudini --set $cfg keystone_authtoken auth_host ${KEYSTONE_PUBLIC_SERVICE_HOST} +crudini --set $cfg keystone_authtoken auth_port 5000 + +crudini --set $cfg keystone_authtoken admin_user ${NOVA_KEYSTONE_USER} +crudini --set $cfg keystone_authtoken admin_password "${NOVA_KEYSTONE_PASSWORD}" +crudini --set $cfg keystone_authtoken admin_tenant_name ${ADMIN_TENANT_NAME} + +cat > /openrc <<EOF +export OS_AUTH_URL="http://${KEYSTONE_PUBLIC_SERVICE_HOST}:5000/v2.0" +export OS_USERNAME="${NOVA_KEYSTONE_USER}" +export OS_PASSWORD="${NOVA_KEYSTONE_PASSWORD}" +export OS_TENANT_NAME="${ADMIN_TENANT_NAME}" +EOF + +# Configure database connection +crudini --set $cfg \ + database \ + connection \ + "mysql://${NOVA_DB_USER}:${NOVA_DB_PASSWORD}@${MARIADB_SERVICE_HOST}/${NOVA_DB_NAME}" diff --git a/docker/centos/binary/nova-compute/nova-compute-data/Dockerfile b/docker/centos/binary/nova-compute/nova-compute-data/Dockerfile new file mode 100644 index 000000000..0af407095 --- /dev/null +++ b/docker/centos/binary/nova-compute/nova-compute-data/Dockerfile @@ -0,0 +1,10 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +VOLUME [ "/var/lib/nova" ] +VOLUME [ "/var/lib/libvirt" ] +VOLUME [ "/etc/libvirt/qemu" ] + +# Command needed to start the data container. +# Note: data containers do not need to be persistent. +CMD ["/bin/true"] diff --git a/docker/centos/binary/nova-compute/nova-compute-data/build b/docker/centos/binary/nova-compute/nova-compute-data/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/nova-compute/nova-compute-data/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/nova-compute/nova-compute/Dockerfile b/docker/centos/binary/nova-compute/nova-compute/Dockerfile new file mode 100644 index 000000000..d23b86e5f --- /dev/null +++ b/docker/centos/binary/nova-compute/nova-compute/Dockerfile @@ -0,0 +1,13 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%nova-base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +RUN yum -y install openstack-nova-compute \ + sysfsutils && yum clean all + +ADD config-nova-compute.sh /opt/kolla/config-nova-compute.sh + +ADD ./start.sh /start.sh + +VOLUME [ "/sys/fs/cgroup" ] + +CMD ["/start.sh"] diff --git a/docker/centos/binary/nova-compute/nova-compute/build b/docker/centos/binary/nova-compute/nova-compute/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/nova-compute/nova-compute/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/nova-compute/nova-compute/config-nova-compute.sh b/docker/centos/binary/nova-compute/nova-compute/config-nova-compute.sh new file mode 100755 index 000000000..81a2e3fe3 --- /dev/null +++ b/docker/centos/binary/nova-compute/nova-compute/config-nova-compute.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +. /opt/kolla/kolla-common.sh +. /opt/kolla/config-nova.sh + +cfg=/etc/nova/nova.conf + +check_required_vars NOVA_VNCSERVER_PROXYCLIENT_ADDRESS NOVA_NOVNC_PROXY_PORT \ + NOVA_NOVNC_BASE_ADDRESS + +# Configures novnc to listen on all interfaces and instructs nova-compute to +# announce PROXYCLIENT_IP to the nova-vncproxy. Clients like Horizon will +# connect with this address. +# As such, NOVA_VNCSERVER_PROXYCLIENT_ADDRESS is unique per compute node. +crudini --set $cfg DEFAULT vnc_enabled "True" +crudini --set $cfg DEFAULT vncserver_listen "0.0.0.0" +crudini --set $cfg DEFAULT vncserver_proxyclient_address "${NOVA_VNCSERVER_PROXYCLIENT_ADDRESS}" +crudini --set $cfg DEFAULT novncproxy_base_url "http://${NOVA_NOVNC_BASE_ADDRESS}:${NOVA_NOVNC_PROXY_PORT}/vnc_auto.html" + +# configure logging +crudini --set $cfg DEFAULT log_file "${NOVA_COMPUTE_LOG_FILE}" + +# set qmeu emulation if no hardware acceleration found +if [[ `egrep -c '(vmx|svm)' /proc/cpuinfo` == 0 ]] +then + crudini --set $cfg libvirt virt_type qemu +fi + +mkdir -p /var/lib/nova/instances diff --git a/docker/centos/binary/nova-compute/nova-compute/start.sh b/docker/centos/binary/nova-compute/nova-compute/start.sh new file mode 100755 index 000000000..ce3d0c0c3 --- /dev/null +++ b/docker/centos/binary/nova-compute/nova-compute/start.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +set -e + +. /opt/kolla/config-nova-compute.sh + +sleep 6 + +echo "Starting nova-compute." +exec /usr/bin/nova-compute --config-file /etc/nova/nova.conf diff --git a/docker/centos/binary/nova-compute/nova-libvirt/Dockerfile b/docker/centos/binary/nova-compute/nova-libvirt/Dockerfile new file mode 100644 index 000000000..980940615 --- /dev/null +++ b/docker/centos/binary/nova-compute/nova-libvirt/Dockerfile @@ -0,0 +1,16 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +RUN yum -y install libvirt-daemon \ + libguestfs \ + qemu-system-x86 \ + libvirt-daemon-driver-nwfilter \ + libvirt-daemon-config-nwfilter \ + libvirt-daemon-driver-lxc \ + && yum clean all + +VOLUME [ "/sys/fs/cgroup" ] + +ADD ./start.sh /start.sh + +CMD ["/start.sh"] diff --git a/docker/centos/binary/nova-compute/nova-libvirt/build b/docker/centos/binary/nova-compute/nova-libvirt/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/nova-compute/nova-libvirt/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/nova-compute/nova-libvirt/start.sh b/docker/centos/binary/nova-compute/nova-libvirt/start.sh new file mode 100755 index 000000000..47a09399b --- /dev/null +++ b/docker/centos/binary/nova-compute/nova-libvirt/start.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +if [[ $(cat /proc/cpuinfo | grep vmx) ]]; then + modprobe kvm_intel +elif [[ $(cat /proc/cpuinfo | grep svm) ]]; then + modprobe kvm_amd +else + echo "WARNING: Your hardware does not support hardware virtualization -" \ + "using qemu software virtualization instead" +fi + +modprobe ip6_tables ip_tables ebtable_nat + +# If libvirt is not installed on the host permissions need to be set +# If running in qemu, we don't need to set anything as /dev/kvm won't exist +if [[ -c /dev/kvm ]]; then + chmod 660 /dev/kvm + chown root:kvm /dev/kvm +fi + +echo "Starting libvirtd." +exec /usr/sbin/libvirtd diff --git a/docker/centos/binary/nova-compute/nova-network/Dockerfile b/docker/centos/binary/nova-compute/nova-network/Dockerfile new file mode 100644 index 000000000..2434dbdf0 --- /dev/null +++ b/docker/centos/binary/nova-compute/nova-network/Dockerfile @@ -0,0 +1,10 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%nova-base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +RUN yum -y install openstack-nova-network \ + bridge-utils initscripts && yum clean all + +ADD config-nova-network.sh /opt/kolla/config-nova-network.sh +ADD ./start.sh /start.sh + +CMD ["/start.sh"] diff --git a/docker/centos/binary/nova-compute/nova-network/build b/docker/centos/binary/nova-compute/nova-network/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/nova-compute/nova-network/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/nova-compute/nova-network/config-nova-network.sh b/docker/centos/binary/nova-compute/nova-network/config-nova-network.sh new file mode 100755 index 000000000..6976d3a20 --- /dev/null +++ b/docker/centos/binary/nova-compute/nova-network/config-nova-network.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +. /opt/kolla/config-nova.sh + +cfg=/etc/nova/nova.conf + +# configure logging +crudini --set $cfg DEFAULT log_file "${NOVA_NETWORK_LOG_FILE}" + +# Configure eth1 as a physcial interface for nova flat network +cat > /etc/sysconfig/network-scripts/ifcfg-$FLAT_INTERFACE <<EOF +DEVICE="$FLAT_INTERFACE" +BOOTPROTO="none" +ONBOOT="yes" +TYPE="Ethernet" +EOF + +/usr/sbin/ifup $FLAT_INTERFACE + +cfg=/etc/nova/nova.conf + +crudini --set $cfg DEFAULT network_manager nova.network.manager.FlatDHCPManager +crudini --set $cfg DEFAULT firewall_driver nova.virt.libvirt.firewall.IptablesFirewallDriver +crudini --set $cfg DEFAULT network_size 254 +crudini --set $cfg DEFAULT allow_same_net_traffic False +crudini --set $cfg DEFAULT multi_host True +crudini --set $cfg DEFAULT send_arp_for_ha True +crudini --set $cfg DEFAULT share_dhcp_address True +crudini --set $cfg DEFAULT force_dhcp_release True +crudini --set $cfg DEFAULT flat_network_bridge br100 diff --git a/docker/centos/binary/nova-compute/nova-network/start.sh b/docker/centos/binary/nova-compute/nova-network/start.sh new file mode 100755 index 000000000..92381b720 --- /dev/null +++ b/docker/centos/binary/nova-compute/nova-network/start.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +set -e + +. /opt/kolla/config-nova-network.sh + +# Start nova-network +exec /usr/bin/nova-network --config-file /etc/nova/nova.conf diff --git a/docker/centos/binary/nova-controller/nova-api/Dockerfile b/docker/centos/binary/nova-controller/nova-api/Dockerfile new file mode 100644 index 000000000..7abd32087 --- /dev/null +++ b/docker/centos/binary/nova-controller/nova-api/Dockerfile @@ -0,0 +1,10 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%nova-base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +RUN yum -y install \ + openstack-nova-api && yum clean all + +ADD ./start.sh /start.sh +ADD ./check.sh /check.sh + +CMD ["/start.sh"] diff --git a/docker/centos/binary/nova-controller/nova-api/build b/docker/centos/binary/nova-controller/nova-api/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/nova-controller/nova-api/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/nova-controller/nova-api/check.sh b/docker/centos/binary/nova-controller/nova-api/check.sh new file mode 100755 index 000000000..b250682d8 --- /dev/null +++ b/docker/centos/binary/nova-controller/nova-api/check.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +RES=0 + +. /openrc +if ! keystone token-get > /dev/null; then + echo "ERROR: keystone token-get failed" >&2 + RES=1 +else + if ! nova list > /dev/null; then + echo "ERROR: nova list failed" >&2 + RES=1 + fi +fi + +exit $RES + diff --git a/docker/centos/binary/nova-controller/nova-api/start.sh b/docker/centos/binary/nova-controller/nova-api/start.sh new file mode 100755 index 000000000..7928370a4 --- /dev/null +++ b/docker/centos/binary/nova-controller/nova-api/start.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +set -e + +. /opt/kolla/config-nova.sh + +check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \ + NOVA_KEYSTONE_USER NOVA_KEYSTONE_PASSWORD \ + ADMIN_TENANT_NAME NOVA_API_SERVICE_HOST \ + NOVA_EC2_API_SERVICE_HOST PUBLIC_IP NOVA_DB_NAME +fail_unless_os_service_running keystone +fail_unless_db $NOVA_DB_NAME + +export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}" +export SERVICE_ENDPOINT="http://${KEYSTONE_ADMIN_SERVICE_HOST}:35357/v2.0" + +cfg=/etc/nova/nova.conf + +# configure logging +crudini --set $cfg DEFAULT log_file "${NOVA_API_LOG_FILE}" + +crux user-create --update \ + -n "${NOVA_KEYSTONE_USER}" \ + -p "${NOVA_KEYSTONE_PASSWORD}" \ + -t "${ADMIN_TENANT_NAME}" \ + -r admin + +crux endpoint-create --remove-all \ + -n ec2 -t ec2 \ + -I "http://${NOVA_EC2_API_SERVICE_HOST}:8773/services/Cloud" \ + -P "http://${PUBLIC_IP}:8773/services/Cloud" \ + -A "http://${NOVA_EC2_API_SERVICE_HOST}:8773/services/Admin" + +crux endpoint-create --remove-all \ + -n nova -t compute \ + -I "http://${NOVA_API_SERVICE_HOST}:8774/v2/\$(tenant_id)s" \ + -P "http://${PUBLIC_IP}:8774/v2/\$(tenant_id)s" \ + -A "http://${NOVA_API_SERVICE_HOST}:8774/v2/\$(tenant_id)s" + +crux endpoint-create --remove-all \ + -n novav3 -t computev3 \ + -I "http://${NOVA_API_SERVICE_HOST}:8774/v3" \ + -P "http://${PUBLIC_IP}:8774/v3" \ + -A "http://${NOVA_API_SERVICE_HOST}:8774/v3" + +exec /usr/bin/nova-api --config-file /etc/nova/nova.conf diff --git a/docker/centos/binary/nova-controller/nova-conductor/Dockerfile b/docker/centos/binary/nova-controller/nova-conductor/Dockerfile new file mode 100644 index 000000000..f91113bad --- /dev/null +++ b/docker/centos/binary/nova-controller/nova-conductor/Dockerfile @@ -0,0 +1,8 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%nova-base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +RUN yum -y install \ + openstack-nova-conductor && yum clean all + +ADD ./start.sh /start.sh +CMD ["/start.sh"] diff --git a/docker/centos/binary/nova-controller/nova-conductor/build b/docker/centos/binary/nova-controller/nova-conductor/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/nova-controller/nova-conductor/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/nova-controller/nova-conductor/start.sh b/docker/centos/binary/nova-controller/nova-conductor/start.sh new file mode 100755 index 000000000..5e01b7f30 --- /dev/null +++ b/docker/centos/binary/nova-controller/nova-conductor/start.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +set -e + +. /opt/kolla/config-nova.sh + +check_required_vars NOVA_DB_NAME NOVA_DB_USER NOVA_DB_PASSWORD +fail_unless_db + +cfg=/etc/nova/nova.conf + +# configure logging +crudini --set $cfg DEFAULT log_file "${NOVA_CONDUCTOR_LOG_FILE}" + +mysql -h ${MARIADB_SERVICE_HOST} -u root \ + -p${DB_ROOT_PASSWORD} mysql <<EOF +CREATE DATABASE IF NOT EXISTS ${NOVA_DB_NAME}; +GRANT ALL PRIVILEGES ON ${NOVA_DB_NAME}.* TO + '${NOVA_DB_USER}'@'%' IDENTIFIED BY '${NOVA_DB_PASSWORD}' +EOF + +nova-manage db sync + +exec /usr/bin/nova-conductor --config-file /etc/nova/nova.conf diff --git a/docker/centos/binary/nova-controller/nova-consoleauth/Dockerfile b/docker/centos/binary/nova-controller/nova-consoleauth/Dockerfile new file mode 100644 index 000000000..576c91b5a --- /dev/null +++ b/docker/centos/binary/nova-controller/nova-consoleauth/Dockerfile @@ -0,0 +1,8 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%nova-base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +RUN yum -y install openstack-nova-console && yum clean all + +ADD start.sh /start.sh + +CMD ["/start.sh"] diff --git a/docker/centos/binary/nova-controller/nova-consoleauth/build b/docker/centos/binary/nova-controller/nova-consoleauth/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/nova-controller/nova-consoleauth/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/nova-controller/nova-consoleauth/start.sh b/docker/centos/binary/nova-controller/nova-consoleauth/start.sh new file mode 100755 index 000000000..a1b0864ac --- /dev/null +++ b/docker/centos/binary/nova-controller/nova-consoleauth/start.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -e + +. /opt/kolla/config-nova.sh + +cfg=/etc/nova/nova.conf + +crudini --set $cfg DEFAULT log_file "${NOVA_CONSOLEAUTH_LOG_FILE}" + +echo Starting nova-consoleauth +exec /usr/bin/nova-consoleauth diff --git a/docker/centos/binary/nova-controller/nova-novncproxy/Dockerfile b/docker/centos/binary/nova-controller/nova-novncproxy/Dockerfile new file mode 100644 index 000000000..682625853 --- /dev/null +++ b/docker/centos/binary/nova-controller/nova-novncproxy/Dockerfile @@ -0,0 +1,10 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%nova-base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +RUN yum -y install \ + novnc openstack-nova-novncproxy && \ + yum clean all + +ADD start.sh /start.sh + +CMD ["/start.sh"] diff --git a/docker/centos/binary/nova-controller/nova-novncproxy/build b/docker/centos/binary/nova-controller/nova-novncproxy/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/nova-controller/nova-novncproxy/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/nova-controller/nova-novncproxy/start.sh b/docker/centos/binary/nova-controller/nova-novncproxy/start.sh new file mode 100755 index 000000000..9edafbca3 --- /dev/null +++ b/docker/centos/binary/nova-controller/nova-novncproxy/start.sh @@ -0,0 +1,22 @@ +#!/bin/bash +set -e +. /opt/kolla/kolla-common.sh + +cfg=/etc/nova/nova.conf + +check_required_vars PUBLIC_IP NOVA_NOVNC_PROXY_SERVICE_HOST NOVA_NOVNC_PROXY_PORT \ + NOVA_NOVNC_BASE_ADDRESS NOVA_VNCSERVER_LISTEN_ADDRESS \ + NOVA_VNCSERVER_PROXYCLIENT_ADDRESS + +crudini --set $cfg DEFAULT log_file "${NOVA_NOVNCPROXY_LOG_FILE}" + +# Listen on all interfaces on port $NOVA_NOVNC_PROXY_PORT for incoming novnc +# requests. +# The base_url is given to clients to connect to, like Horizon, so this could +# very well be fancy DNS name. +echo Configuring VNC... +crudini --set $cfg DEFAULT vncserver_listen "${NOVA_VNCSERVER_LISTEN_ADDRESS}" +crudini --set $cfg DEFAULT vncserver_proxyclient_address "${NOVA_VNCSERVER_PROXYCLIENT_ADDRESS}" + +echo Starting nova-novncproxy +exec /usr/bin/nova-novncproxy diff --git a/docker/centos/binary/nova-controller/nova-scheduler/Dockerfile b/docker/centos/binary/nova-controller/nova-scheduler/Dockerfile new file mode 100644 index 000000000..2eec47554 --- /dev/null +++ b/docker/centos/binary/nova-controller/nova-scheduler/Dockerfile @@ -0,0 +1,8 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%nova-base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +RUN yum -y install \ + openstack-nova-scheduler && yum clean all + +ADD ./start.sh /start.sh +CMD ["/start.sh"] diff --git a/docker/centos/binary/nova-controller/nova-scheduler/build b/docker/centos/binary/nova-controller/nova-scheduler/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/nova-controller/nova-scheduler/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/nova-controller/nova-scheduler/start.sh b/docker/centos/binary/nova-controller/nova-scheduler/start.sh new file mode 100755 index 000000000..504c049ed --- /dev/null +++ b/docker/centos/binary/nova-controller/nova-scheduler/start.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -e + +. /opt/kolla/config-nova.sh + +check_required_vars NOVA_DB_NAME +fail_unless_db $NOVA_DB_NAME + +cfg=/etc/nova/nova.conf + +# configure logging +crudini --set $cfg DEFAULT log_file "${NOVA_SCHEDULER_LOG_FILE}" + +exec /usr/bin/nova-scheduler --config-file /etc/nova/nova.conf diff --git a/docker/centos/binary/rabbitmq/Dockerfile b/docker/centos/binary/rabbitmq/Dockerfile new file mode 100644 index 000000000..9212d15eb --- /dev/null +++ b/docker/centos/binary/rabbitmq/Dockerfile @@ -0,0 +1,18 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +# Install required packages +RUN yum -y install rabbitmq-server hostname && yum clean all + +# Run the management plugin +RUN /usr/lib/rabbitmq/bin/rabbitmq-plugins enable rabbitmq_management + +# Copy Rabbit conf files +ADD rabbitmq.config /etc/rabbitmq/ +ADD rabbitmq-env.conf /etc/rabbitmq/ + +# Copy start-up script +ADD start.sh /start.sh + +# Start Rabbit through the start script +CMD ["/start.sh"] diff --git a/docker/centos/binary/rabbitmq/build b/docker/centos/binary/rabbitmq/build new file mode 120000 index 000000000..8d652f7ee --- /dev/null +++ b/docker/centos/binary/rabbitmq/build @@ -0,0 +1 @@ +../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/rabbitmq/rabbitmq-env.conf b/docker/centos/binary/rabbitmq/rabbitmq-env.conf new file mode 100644 index 000000000..e76f18f0b --- /dev/null +++ b/docker/centos/binary/rabbitmq/rabbitmq-env.conf @@ -0,0 +1,2 @@ +RABBITMQ_NODENAME=@RABBITMQ_NODENAME@ +RABBITMQ_LOG_BASE=@RABBITMQ_LOG_BASE@ diff --git a/docker/centos/binary/rabbitmq/rabbitmq.config b/docker/centos/binary/rabbitmq/rabbitmq.config new file mode 100644 index 000000000..15a47eba1 --- /dev/null +++ b/docker/centos/binary/rabbitmq/rabbitmq.config @@ -0,0 +1,11 @@ +[ + {rabbit, [ + {default_user, <<"@RABBITMQ_USER@">>}, + {default_pass, <<"@RABBITMQ_PASS@">>} + ]}, + {kernel, [ + + ]} +]. +% EOF + diff --git a/docker/centos/binary/rabbitmq/start.sh b/docker/centos/binary/rabbitmq/start.sh new file mode 100755 index 000000000..3284368f3 --- /dev/null +++ b/docker/centos/binary/rabbitmq/start.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +set -e + +: ${RABBITMQ_USER:=guest} +: ${RABBITMQ_PASS:=guest} +: ${RABBITMQ_NODENAME:=rabbit} +: ${RABBITMQ_LOG_BASE:=/var/log/rabbitmq} + +sed -i ' + s|@RABBITMQ_USER@|'"$RABBITMQ_USER"'|g + s|@RABBITMQ_PASS@|'"$RABBITMQ_PASS"'|g +' /etc/rabbitmq/rabbitmq.config + +sed -i ' + s|@RABBITMQ_NODENAME@|'"$RABBITMQ_NODENAME"'|g + s|@RABBITMQ_LOG_BASE@|'"$RABBITMQ_LOG_BASE"'|g +' /etc/rabbitmq/rabbitmq-env.conf + +# work around: +# https://bugs.launchpad.net/ubuntu/+source/rabbitmq-server/+bug/653405 +echo "${RABBITMQ_SERVICE_HOST} `/usr/bin/hostname -s`" > /etc/hosts + +exec /usr/sbin/rabbitmq-server diff --git a/docker/centos/binary/rhel-osp-base/Dockerfile b/docker/centos/binary/rhel-osp-base/Dockerfile new file mode 100644 index 000000000..422875dd6 --- /dev/null +++ b/docker/centos/binary/rhel-osp-base/Dockerfile @@ -0,0 +1,92 @@ +FROM rhel7 +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +RUN yum install -y \ + mariadb-libs \ + openstack-utils \ + pyparsing \ + python-alembic \ + python-amqp \ + python-amqplib \ + python-anyjson \ + python-boto \ + python-ceilometerclient \ + python-cheetah \ + python-cinderclient \ + python-cliff \ + python-cmd2 \ + python-croniter \ + python-crypto \ + python-d2to1 \ + python-docutils \ + python-dogpile-cache \ + python-dogpile-core \ + python-empy \ + python-eventlet \ + python-flask \ + python-futures \ + python-glanceclient \ + python-greenlet \ + python-heatclient \ + python-httplib2 \ + python-iso8601 \ + python-itsdangerous \ + python-jinja2 \ + python-jsonpatch \ + python-jsonpath-rw \ + python-jsonpointer \ + python-jsonschema \ + python-keyring \ + python-keystoneclient \ + python-kombu \ + python-lesscpy \ + python-lockfile \ + python-lxml \ + python-markdown \ + python-memcached \ + python-ldap \ + python-migrate \ + python-msgpack \ + python-netifaces \ + python-networkx \ + python-neutronclient \ + python-novaclient \ + python-oauthlib \ + python-openstackclient \ + python-oslo-config \ + python-oslo-messaging \ + python-oslo-rootwrap \ + python-oslo-vmware \ + python-paramiko \ + python-passlib \ + python-paste-deploy \ + python-pbr \ + python-pecan \ + python-ply \ + python-prettytable \ + python-psutil \ + python-pycadf \ + python-pygments \ + python-pymongo \ + python-qpid \ + python-repoze-lru \ + python-requests \ + python-routes \ + python-saharaclient \ + python-simplegeneric \ + python-simplejson \ + python-singledispatch \ + python-six \ + python-sqlalchemy \ + python-stevedore \ + python-swiftclient \ + python-taskflow \ + python-troveclient \ + python-versiontools \ + python-warlock \ + python-webob \ + python-websockify \ + python-webtest \ + python-werkzeug \ + python-wsme \ + && yum clean all diff --git a/docker/centos/binary/rhel-osp-base/build b/docker/centos/binary/rhel-osp-base/build new file mode 120000 index 000000000..8d652f7ee --- /dev/null +++ b/docker/centos/binary/rhel-osp-base/build @@ -0,0 +1 @@ +../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/swift/swift-account/Dockerfile b/docker/centos/binary/swift/swift-account/Dockerfile new file mode 100644 index 000000000..2c26802e3 --- /dev/null +++ b/docker/centos/binary/swift/swift-account/Dockerfile @@ -0,0 +1,6 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%swift-base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +ADD ./start.sh /start.sh +CMD ["/start.sh"] + diff --git a/docker/centos/binary/swift/swift-account/build b/docker/centos/binary/swift/swift-account/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/swift/swift-account/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/swift/swift-account/start.sh b/docker/centos/binary/swift/swift-account/start.sh new file mode 100644 index 000000000..f634f6e54 --- /dev/null +++ b/docker/centos/binary/swift/swift-account/start.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +: ${SWIFT_DB_USER:=swift} +: ${SWIFT_DB_NAME:=swift} +: ${KEYSTONE_AUTH_PROTOCOL:=http} +: ${SWIFT_KEYSTONE_USER:=swift} +: ${ADMIN_TENANT_NAME:=admin} + +check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \ + SWIFT_ADMIN_PASSWORD +fail_unless_db +fail_unless_os_service_running keystone + +if ! [ "$SWIFT_DB_PASSWORD" ]; then + SWIFT_DB_PASSWORD=$(openssl rand -hex 15) + export SWIFT_DB_PASSWORD +fi + +sh /opt/swift/config-swift.sh account-server + +mysql -h ${MARIADB_SERVICE_HOST} -u root \ + -p${DB_ROOT_PASSWORD} mysql <<EOF +CREATE DATABASE IF NOT EXISTS ${SWIFT_DB_NAME}; +GRANT ALL PRIVILEGES ON swift* TO + '${SWIFT_DB_USER}'@'%' IDENTIFIED BY '${SWIFT_DB_PASSWORD}' +EOF + +export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}" +export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:35357/v2.0" + +/bin/keystone user-create --name ${SWIFT_KEYSTONE_USER} --pass ${SWIFT_ADMIN_PASSWORD} +/bin/keystone role-create --name ${SWIFT_KEYSTONE_USER} +/bin/keystone user-role-add --user ${SWIFT_KEYSTONE_USER} --role admin --tenant ${ADMIN_TENANT_NAME} + +exec /usr/bin/swift-engine diff --git a/docker/centos/binary/swift/swift-base/24q124 b/docker/centos/binary/swift/swift-base/24q124 new file mode 100644 index 000000000..99e00593e --- /dev/null +++ b/docker/centos/binary/swift/swift-base/24q124 @@ -0,0 +1,8 @@ +FROM fedora-rdo-base +MAINTAINER Steven Dake <sdake@redhat.com> + +RUN yum -y install openstack-utils openstack-swift && yum clean all + +# These will come after we sort out start time config +RUN mkdir /opt/swift +#COPY config-swift.sh /opt/swift/config-swift.sh diff --git a/docker/centos/binary/swift/swift-base/Dockerfile b/docker/centos/binary/swift/swift-base/Dockerfile new file mode 100644 index 000000000..59600a23d --- /dev/null +++ b/docker/centos/binary/swift/swift-base/Dockerfile @@ -0,0 +1,8 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +RUN yum -y install openstack-utils openstack-swift && yum clean all + +# These will come after we sort out start time config +RUN mkdir /opt/swift +config-swift.sh /opt/swift/config-swift.sh diff --git a/docker/centos/binary/swift/swift-base/build b/docker/centos/binary/swift/swift-base/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/swift/swift-base/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/swift/swift-container/Dockerfile b/docker/centos/binary/swift/swift-container/Dockerfile new file mode 100644 index 000000000..2c26802e3 --- /dev/null +++ b/docker/centos/binary/swift/swift-container/Dockerfile @@ -0,0 +1,6 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%swift-base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +ADD ./start.sh /start.sh +CMD ["/start.sh"] + diff --git a/docker/centos/binary/swift/swift-container/build b/docker/centos/binary/swift/swift-container/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/swift/swift-container/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/swift/swift-container/start.sh b/docker/centos/binary/swift/swift-container/start.sh new file mode 100644 index 000000000..6e303872b --- /dev/null +++ b/docker/centos/binary/swift/swift-container/start.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +: ${SWIFT_DB_USER:=swift} +: ${SWIFT_DB_NAME:=swift} +: ${KEYSTONE_AUTH_PROTOCOL:=http} +: ${SWIFT_KEYSTONE_USER:=swift} +: ${ADMIN_TENANT_NAME:=admin} + +check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \ + SWIFT_ADMIN_PASSWORD +fail_unless_db +fail_unless_os_service_running keystone + +if ! [ "$SWIFT_DB_PASSWORD" ]; then + SWIFT_DB_PASSWORD=$(openssl rand -hex 15) + export SWIFT_DB_PASSWORD +fi + +sh /opt/swift/config-swift.sh container + +mysql -h ${MARIADB_SERVICE_HOST} -u root \ + -p${DB_ROOT_PASSWORD} mysql <<EOF +CREATE DATABASE IF NOT EXISTS ${SWIFT_DB_NAME}; +GRANT ALL PRIVILEGES ON swift* TO + '${SWIFT_DB_USER}'@'%' IDENTIFIED BY '${SWIFT_DB_PASSWORD}' +EOF + +export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}" +export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:35357/v2.0" + +/bin/keystone user-create --name ${SWIFT_KEYSTONE_USER} --pass ${SWIFT_ADMIN_PASSWORD} +/bin/keystone role-create --name ${SWIFT_KEYSTONE_USER} +/bin/keystone user-role-add --user ${SWIFT_KEYSTONE_USER} --role admin --tenant ${ADMIN_TENANT_NAME} + +exec /usr/bin/swift-container-server diff --git a/docker/centos/binary/swift/swift-object/Dockerfile b/docker/centos/binary/swift/swift-object/Dockerfile new file mode 100644 index 000000000..2c26802e3 --- /dev/null +++ b/docker/centos/binary/swift/swift-object/Dockerfile @@ -0,0 +1,6 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%swift-base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +ADD ./start.sh /start.sh +CMD ["/start.sh"] + diff --git a/docker/centos/binary/swift/swift-object/build b/docker/centos/binary/swift/swift-object/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/swift/swift-object/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/swift/swift-object/start.sh b/docker/centos/binary/swift/swift-object/start.sh new file mode 100644 index 000000000..8626e7678 --- /dev/null +++ b/docker/centos/binary/swift/swift-object/start.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +: ${SWIFT_DB_USER:=swift} +: ${SWIFT_DB_NAME:=swift} +: ${KEYSTONE_AUTH_PROTOCOL:=http} +: ${SWIFT_KEYSTONE_USER:=swift} +: ${ADMIN_TENANT_NAME:=admin} + +check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \ + SWIFT_ADMIN_PASSWORD +fail_unless_db +fail_unless_os_service_running keystone + +if ! [ "$SWIFT_DB_PASSWORD" ]; then + SWIFT_DB_PASSWORD=$(openssl rand -hex 15) + export SWIFT_DB_PASSWORD +fi + +sh /opt/swift/config-swift.sh engine + +mysql -h ${MARIADB_SERVICE_HOST} -u root \ + -p${DB_ROOT_PASSWORD} mysql <<EOF +CREATE DATABASE IF NOT EXISTS ${SWIFT_DB_NAME}; +GRANT ALL PRIVILEGES ON swift* TO + '${SWIFT_DB_USER}'@'%' IDENTIFIED BY '${SWIFT_DB_PASSWORD}' +EOF + +export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}" +export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:35357/v2.0" + +/bin/keystone user-create --name ${SWIFT_KEYSTONE_USER} --pass ${SWIFT_ADMIN_PASSWORD} +/bin/keystone role-create --name ${SWIFT_KEYSTONE_USER} +/bin/keystone user-role-add --user ${SWIFT_KEYSTONE_USER} --role admin --tenant ${ADMIN_TENANT_NAME} + +exec /usr/bin/swift-object-server diff --git a/docker/centos/binary/swift/swift-proxy-server/Dockerfile b/docker/centos/binary/swift/swift-proxy-server/Dockerfile new file mode 100644 index 000000000..2c26802e3 --- /dev/null +++ b/docker/centos/binary/swift/swift-proxy-server/Dockerfile @@ -0,0 +1,6 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%swift-base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +ADD ./start.sh /start.sh +CMD ["/start.sh"] + diff --git a/docker/centos/binary/swift/swift-proxy-server/build b/docker/centos/binary/swift/swift-proxy-server/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/swift/swift-proxy-server/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/swift/swift-proxy-server/start.sh b/docker/centos/binary/swift/swift-proxy-server/start.sh new file mode 100644 index 000000000..3f387d187 --- /dev/null +++ b/docker/centos/binary/swift/swift-proxy-server/start.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +sh /opt/swift/config-swift.sh proxy + +exec /usr/bin/swift-proxy-server diff --git a/docker/centos/binary/zaqar/Dockerfile b/docker/centos/binary/zaqar/Dockerfile new file mode 100644 index 000000000..956f90825 --- /dev/null +++ b/docker/centos/binary/zaqar/Dockerfile @@ -0,0 +1,9 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +RUN yum -y install openstack-zaqar && yum clean all + +ADD ./start.sh /start.sh +ADD ./check.sh /check.sh + +CMD ["/start.sh"] diff --git a/docker/centos/binary/zaqar/build b/docker/centos/binary/zaqar/build new file mode 120000 index 000000000..8d652f7ee --- /dev/null +++ b/docker/centos/binary/zaqar/build @@ -0,0 +1 @@ +../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/zaqar/check.sh b/docker/centos/binary/zaqar/check.sh new file mode 100755 index 000000000..4b3cdbb46 --- /dev/null +++ b/docker/centos/binary/zaqar/check.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +status=$(curl -s -w "%{http_code}" -o /dev/null http://localhost:8888/v1/queues) + +if [[ $status -ne 200 && $status -ne 204 ]]; then + echo "ERROR($status): queue list failed" + exit $status +fi + +exit 0 diff --git a/docker/centos/binary/zaqar/start.sh b/docker/centos/binary/zaqar/start.sh new file mode 100755 index 000000000..6c68fccf2 --- /dev/null +++ b/docker/centos/binary/zaqar/start.sh @@ -0,0 +1,64 @@ +#!/bin/sh + +set -e + +. /opt/kolla/kolla-common.sh + +: ${ADMIN_TENANT_NAME:=admin} +: ${ZAQAR_KEYSTONE_USER:=zaqar} +: ${KEYSTONE_AUTH_PROTOCOL:=http} + +check_required_vars ZAQAR_KEYSTONE_PASSWORD ZAQAR_SERVER_SERVICE_HOST \ + KEYSTONE_ADMIN_SERVICE_HOST KEYSTONE_ADMIN_TOKEN \ + PUBLIC_IP +dump_vars + +#check_for_mongodb +check_for_keystone + +cat > /openrc <<EOF +export OS_AUTH_URL="http://${KEYSTONE_PUBLIC_SERVICE_HOST}:5000/v2.0" +export OS_USERNAME="${ZAQAR_KEYSTONE_USER}" +export OS_PASSWORD="${ZAQAR_KEYSTONE_PASSWORD}" +export OS_TENANT_NAME="${ADMIN_TENANT_NAME}" +EOF + +cfg=/etc/zaqar/zaqar.conf + +crudini --set $cfg DEFAULT log_file \ + "" +crudini --set $cfg DEFAULT use_stderr \ + true + +crudini --set $cfg drivers storage \ + sqlite + +crudini --set $cfg keystone_authtoken admin_password \ + "${ZAQAR_KEYSTONE_PASSWORD}" +crudini --set $cfg keystone_authtoken admin_user \ + "${ZAQAR_KEYSTONE_USER}" +crudini --set $cfg keystone_authtoken admin_tenant_name \ + "${ADMIN_TENANT_NAME}" +crudini --set $cfg keystone_authtoken auth_uri \ + "${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_PUBLIC_SERVICE_HOST}:5000/v2.0" +crudini --set $cfg keystone_authtoken auth_protocol \ + "${KEYSTONE_AUTH_PROTOCOL}" +crudini --set $cfg keystone_authtoken auth_host \ + "${KEYSTONE_PUBLIC_SERVICE_HOST}" +crudini --set $cfg keystone_authtoken auth_port \ + 5000 + + +export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}" +export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:35357/v2.0" +crux user-create -n ${ZAQAR_KEYSTONE_USER} \ + -p ${ZAQAR_KEYSTONE_PASSWORD} \ + -t ${ADMIN_TENANT_NAME} \ + -r admin + +crux endpoint-create --remove-all -n ${ZAQAR_KEYSTONE_USER} -t messaging \ + -I "${KEYSTONE_AUTH_PROTOCOL}://${ZAQAR_SERVER_SERVICE_HOST}:8888" \ + -P "${KEYSTONE_AUTH_PROTOCOL}://${PUBLIC_IP}:8888" \ + -A "${KEYSTONE_AUTH_PROTOCOL}://${ZAQAR_SERVER_SERVICE_HOST}:8888" + +exec /usr/bin/zaqar-server |
