diff options
| author | Swapnil Kulkarni <me@coolsvap.net> | 2015-07-17 06:09:23 +0000 |
|---|---|---|
| committer | Swapnil Kulkarni <me@coolsvap.net> | 2015-07-23 03:43:04 +0000 |
| commit | 870ec615d6c89c04430ba3359449189d2e380659 (patch) | |
| tree | d4560e53213b0265e0d523b9c481453620afca10 /docker | |
| parent | 6d4a55060e13723138facd90dc9786e7f2c3684b (diff) | |
| download | kolla-870ec615d6c89c04430ba3359449189d2e380659.tar.gz kolla-870ec615d6c89c04430ba3359449189d2e380659.zip | |
Add Gnocchi service to kolla
Co-Authored-By: Swapnil Kulkarni <me@coolsvap.net"
Change-Id: I81e5e6bfde3323e6917e3d61e3db760e2fec2019
Implements: blueprint gnocchi-containers
Diffstat (limited to 'docker')
20 files changed, 169 insertions, 0 deletions
diff --git a/docker/centos/binary/gnocchi/gnocchi-api/Dockerfile b/docker/centos/binary/gnocchi/gnocchi-api/Dockerfile new file mode 100644 index 000000000..cd5974a22 --- /dev/null +++ b/docker/centos/binary/gnocchi/gnocchi-api/Dockerfile @@ -0,0 +1,10 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%gnocchi-base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +RUN yum install -y openstack-gnocchi-api \ + openstack-gnocchi-carbonara \ + openstack-gnocchi-indexer-sqlalchemy \ + && yum clean all + +COPY ./start.sh /start.sh +CMD ["/start.sh"] diff --git a/docker/centos/binary/gnocchi/gnocchi-api/build b/docker/centos/binary/gnocchi/gnocchi-api/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/gnocchi/gnocchi-api/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/gnocchi/gnocchi-api/config-external.sh b/docker/centos/binary/gnocchi/gnocchi-api/config-external.sh new file mode 120000 index 000000000..471d03664 --- /dev/null +++ b/docker/centos/binary/gnocchi/gnocchi-api/config-external.sh @@ -0,0 +1 @@ +../../../../common/gnocchi/gnocchi-api/config-external.sh
\ No newline at end of file diff --git a/docker/centos/binary/gnocchi/gnocchi-api/config-internal.sh b/docker/centos/binary/gnocchi/gnocchi-api/config-internal.sh new file mode 120000 index 000000000..79578ce60 --- /dev/null +++ b/docker/centos/binary/gnocchi/gnocchi-api/config-internal.sh @@ -0,0 +1 @@ +../../../../common/gnocchi/gnocchi-api/config-internal.sh
\ No newline at end of file diff --git a/docker/centos/binary/gnocchi/gnocchi-api/start.sh b/docker/centos/binary/gnocchi/gnocchi-api/start.sh new file mode 120000 index 000000000..99320c6d0 --- /dev/null +++ b/docker/centos/binary/gnocchi/gnocchi-api/start.sh @@ -0,0 +1 @@ +../../../../common/gnocchi/gnocchi-api/start.sh
\ No newline at end of file diff --git a/docker/centos/binary/gnocchi/gnocchi-base/Dockerfile b/docker/centos/binary/gnocchi/gnocchi-base/Dockerfile new file mode 100644 index 000000000..e9d67da7c --- /dev/null +++ b/docker/centos/binary/gnocchi/gnocchi-base/Dockerfile @@ -0,0 +1,4 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +COPY config-gnocchi.sh /opt/kolla/config-gnocchi.sh diff --git a/docker/centos/binary/gnocchi/gnocchi-base/build b/docker/centos/binary/gnocchi/gnocchi-base/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/gnocchi/gnocchi-base/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/gnocchi/gnocchi-base/config-gnocchi.sh b/docker/centos/binary/gnocchi/gnocchi-base/config-gnocchi.sh new file mode 120000 index 000000000..75a8a5e10 --- /dev/null +++ b/docker/centos/binary/gnocchi/gnocchi-base/config-gnocchi.sh @@ -0,0 +1 @@ +../../../../common/gnocchi/gnocchi-base/config-gnocchi.sh
\ No newline at end of file diff --git a/docker/centos/binary/gnocchi/gnocchi-statsd/Dockerfile b/docker/centos/binary/gnocchi/gnocchi-statsd/Dockerfile new file mode 100644 index 000000000..7998a3621 --- /dev/null +++ b/docker/centos/binary/gnocchi/gnocchi-statsd/Dockerfile @@ -0,0 +1,7 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%gnocchi-base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +RUN yum install -y openstack-gnocchi-statsd && yum clean all + +COPY ./start.sh /start.sh +CMD ["/start.sh"] diff --git a/docker/centos/binary/gnocchi/gnocchi-statsd/build b/docker/centos/binary/gnocchi/gnocchi-statsd/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/gnocchi/gnocchi-statsd/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/gnocchi/gnocchi-statsd/config-external.sh b/docker/centos/binary/gnocchi/gnocchi-statsd/config-external.sh new file mode 120000 index 000000000..fe516e42c --- /dev/null +++ b/docker/centos/binary/gnocchi/gnocchi-statsd/config-external.sh @@ -0,0 +1 @@ +../../../../common/gnocchi/gnocchi-statsd/config-external.sh
\ No newline at end of file diff --git a/docker/centos/binary/gnocchi/gnocchi-statsd/config-internal.sh b/docker/centos/binary/gnocchi/gnocchi-statsd/config-internal.sh new file mode 120000 index 000000000..9d9ebfa7d --- /dev/null +++ b/docker/centos/binary/gnocchi/gnocchi-statsd/config-internal.sh @@ -0,0 +1 @@ +../../../../common/gnocchi/gnocchi-statsd/config-internal.sh
\ No newline at end of file diff --git a/docker/centos/binary/gnocchi/gnocchi-statsd/start.sh b/docker/centos/binary/gnocchi/gnocchi-statsd/start.sh new file mode 120000 index 000000000..ad961553e --- /dev/null +++ b/docker/centos/binary/gnocchi/gnocchi-statsd/start.sh @@ -0,0 +1 @@ +../../../../common/gnocchi/gnocchi-statsd/start.sh
\ No newline at end of file diff --git a/docker/common/gnocchi/gnocchi-api/config-external.sh b/docker/common/gnocchi/gnocchi-api/config-external.sh new file mode 100755 index 000000000..59639ba63 --- /dev/null +++ b/docker/common/gnocchi/gnocchi-api/config-external.sh @@ -0,0 +1,10 @@ +#!/bin/bash +SOURCE="/opt/kolla/gnocchi-api/gnocchi-api.conf" +TARGET="/etc/gnocchi/gnocchi-api.conf" +OWNER="gnocchi" + +if [[ -f "$SOURCE" ]]; then + cp $SOURCE $TARGET + chown ${OWNER}: $TARGET + chmod 0644 $TARGET +fi diff --git a/docker/common/gnocchi/gnocchi-api/config-internal.sh b/docker/common/gnocchi/gnocchi-api/config-internal.sh new file mode 100755 index 000000000..411e9ae8a --- /dev/null +++ b/docker/common/gnocchi/gnocchi-api/config-internal.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +set -e + +. /opt/kolla/kolla-common.sh +. /opt/kolla/config-gnocchi.sh + +check_required_vars KEYSTONE_ADMIN_TOKEN \ + KEYSTONE_AUTH_PROTOCOL \ + KEYSTONE_ADMIN_SERVICE_HOST \ + KEYSTONE_ADMIN_SERVICE_PORT \ + ADMIN_TENANT_NAME \ + GNOCCHI_DB_NAME \ + GNOCCHI_DB_USER \ + GNOCCHI_DB_PASSWORD \ + GNOCCHI_SERVICE_PROTOCOL \ + GNOCCHI_SERVICE_PORT \ + GNOCCHI_ARCHIVE_POLICY \ + GNOCCHI_STORAGE_BACKEND \ + GNOCCHI_KEYSTONE_USER \ + GNOCCHI_ADMIN_PASSWORD \ + GNOCCHI_API_SERVICE_HOST + +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 ${GNOCCHI_DB_NAME} DEFAULT CHARACTER SET utf8; +GRANT ALL PRIVILEGES ON ${GNOCCHI_DB_NAME}.* TO + '${GNOCCHI_DB_USER}'@'%' IDENTIFIED BY '${GNOCCHI_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 ${GNOCCHI_KEYSTONE_USER} \ + -p ${GNOCCHI_ADMIN_PASSWORD} \ + -t ${ADMIN_TENANT_NAME} \ + -r service + +crux service-create -n ${GNOCCHI_KEYSTONE_USER} -t "metric" \ + -d "OpenStack Metric Service" + +crux endpoint-create i--remove-all -n ${GNOCCHI_KEYSTONE_USER} -t metric \ + -I "${GNOCCHI_SERVICE_PROTOCOL}://${GNOCCHI_API_SERVICE_HOST}:${GNOCCHI_SERVICE_PORT}" \ + -P "${GNOCCHI_SERVICE_PROTOCOL}://${GNOCCHI_API_SERVICE_HOST}:${GNOCCHI_SERVICE_PORT}" \ + -A "${GNOCCHI_SERVICE_PROTOCOL}://${GNOCCHI_API_SERVICE_HOST}:${GNOCCHI_SERVICE_PORT}" + +exec /usr/bin/gnocchi-api diff --git a/docker/common/gnocchi/gnocchi-api/start.sh b/docker/common/gnocchi/gnocchi-api/start.sh new file mode 100755 index 000000000..704183ac8 --- /dev/null +++ b/docker/common/gnocchi/gnocchi-api/start.sh @@ -0,0 +1,21 @@ +#!/bin/bash +set -o errexit + +CMD="/usr/bin/gnocchi-api" +ARGS="" + +# Loading common functions. +source /opt/kolla/kolla-common.sh + +# Config-internal script exec out of this function, it does not return here. +set_configs + +# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases +# of the KOLLA_BOOTSTRAP variable being set, including empty. +if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then + su -s /bin/sh -c "gnocchi-manage db_sync" gnocchi + exit 0 +fi + +exec $CMD $ARGS + diff --git a/docker/common/gnocchi/gnocchi-base/config-gnocchi.sh b/docker/common/gnocchi/gnocchi-base/config-gnocchi.sh new file mode 100755 index 000000000..fb5f5c55c --- /dev/null +++ b/docker/common/gnocchi/gnocchi-base/config-gnocchi.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +set -e +. /opt/kolla/kolla-common.sh + +check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \ + KEYSTONE_ADMIN_SERVICE_PORT KEYSTONE_PUBLIC_SERVICE_HOST \ + GNOCCHI_STORAGE_BACKEND GNOCCHI_DATA_DIR GNOCCHI_SERVICE_PORT +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/gnocchi/gnocchi.conf +crudini --set $cfg \ + storage driver "$GNOCCHI_STORAGE_BACKEND" +crudini --set $cfg \ + storage file_basepath "$GNOCCHI_DATA_DIR" +crudini --set $cfg \ + indexer url "mysql://$GNOCCHI_DB_USER:$GNOCCHI_DB_PASSWORD@$MARIADB_SERVICE_HOST/$GNOCCHI_DB_NAME?charset=utf8" diff --git a/docker/common/gnocchi/gnocchi-statsd/config-external.sh b/docker/common/gnocchi/gnocchi-statsd/config-external.sh new file mode 100755 index 000000000..59639ba63 --- /dev/null +++ b/docker/common/gnocchi/gnocchi-statsd/config-external.sh @@ -0,0 +1,10 @@ +#!/bin/bash +SOURCE="/opt/kolla/gnocchi-api/gnocchi-api.conf" +TARGET="/etc/gnocchi/gnocchi-api.conf" +OWNER="gnocchi" + +if [[ -f "$SOURCE" ]]; then + cp $SOURCE $TARGET + chown ${OWNER}: $TARGET + chmod 0644 $TARGET +fi diff --git a/docker/common/gnocchi/gnocchi-statsd/config-internal.sh b/docker/common/gnocchi/gnocchi-statsd/config-internal.sh new file mode 100755 index 000000000..81a71da16 --- /dev/null +++ b/docker/common/gnocchi/gnocchi-statsd/config-internal.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +set -e + +. /opt/kolla/kolla-common.sh +. /opt/kolla/config-gnocchi.sh + +exec /usr/bin/gnocchi-statsd diff --git a/docker/common/gnocchi/gnocchi-statsd/start.sh b/docker/common/gnocchi/gnocchi-statsd/start.sh new file mode 100755 index 000000000..7e9024f15 --- /dev/null +++ b/docker/common/gnocchi/gnocchi-statsd/start.sh @@ -0,0 +1,14 @@ +#!/bin/bash +set -o errexit + +CMD="/usr/bin/gnocchi-statsd" +ARGS="" + +# Loading common functions. +source /opt/kolla/kolla-common.sh + +# Config-internal script exec out of this function, it does not return here. +set_configs + +exec $CMD $ARGS + |
