Add monasca persister
Change-Id: I7c77714d8468044eb489fcbda0ae042d1db902da
This commit is contained in:
parent
5db00ef74e
commit
66b2d677a7
|
@ -0,0 +1,53 @@
|
|||
ARG COMMON_REPO=https://review.opendev.org/openstack/monasca-common
|
||||
ARG COMMON_VERSION=3.1.0
|
||||
ARG REPO_VERSION=stable/ussuri
|
||||
ARG CONSTRAINTS_BRANCH=master
|
||||
ARG CONSTRAINTS_FILE=https://opendev.org/openstack/requirements/raw/branch/stable/ussuri/upper-constraints.txt
|
||||
|
||||
ARG DOCKER_IMAGE=monasca/persister
|
||||
ARG APP_REPO=https://opendev.org/openstack/monasca-persister
|
||||
ARG EXTRA_DEPS="influxdb"
|
||||
|
||||
FROM monasca/base:ussuri as monasca-persister
|
||||
|
||||
# Environment variables used for our service or wait scripts.
|
||||
ENV \
|
||||
DEBUG=false \
|
||||
VERBOSE=true \
|
||||
LOG_LEVEL=WARNING \
|
||||
LOG_LEVEL_KAFKA=WARNING \
|
||||
LOG_LEVEL_INFLUXDB=WARNING \
|
||||
LOG_LEVEL_CASSANDRA=WARNING \
|
||||
ZOOKEEPER_URI=zookeeper:2181 \
|
||||
KAFKA_URI=kafka:9092 \
|
||||
KAFKA_ALARM_HISTORY_BATCH_SIZE=1000 \
|
||||
KAFKA_ALARM_HISTORY_GROUP_ID=1_events \
|
||||
KAFKA_ALARM_HISTORY_PROCESSORS=1 \
|
||||
KAFKA_ALARM_HISTORY_WAIT_TIME=15 \
|
||||
KAFKA_EVENTS_ENABLE="false" \
|
||||
KAFKA_LEGACY_CLIENT_ENABLED=true \
|
||||
KAFKA_METRICS_BATCH_SIZE=1000 \
|
||||
KAFKA_METRICS_GROUP_ID=1_metrics \
|
||||
KAFKA_METRICS_PROCESSORS=1 \
|
||||
KAFKA_METRICS_WAIT_TIME=15 \
|
||||
KAFKA_WAIT_FOR_TOPICS=alarm-state-transitions,metrics \
|
||||
DATABASE_BACKEND=influxdb \
|
||||
INFLUX_HOST=influxdb \
|
||||
INFLUX_PORT=8086 \
|
||||
INFLUX_USER=mon_persister \
|
||||
INFLUX_PASSWORD=password \
|
||||
INFLUX_DB=mon \
|
||||
INFLUX_IGNORE_PARSE_POINT_ERROR="false" \
|
||||
CASSANDRA_HOSTS=cassandra \
|
||||
CASSANDRA_PORT=8086 \
|
||||
CASSANDRA_USER=mon_persister \
|
||||
CASSANDRA_PASSWORD=password \
|
||||
CASSANDRA_KEY_SPACE=monasca \
|
||||
CASSANDRA_CONNECTION_TIMEOUT=5 \
|
||||
CASSANDRA_MAX_CACHE_SIZE=20000000 \
|
||||
CASSANDRA_RETENTION_POLICY=45 \
|
||||
STAY_ALIVE_ON_FAILURE="false"
|
||||
|
||||
COPY monasca-persister.conf.j2 persister-logging.conf.j2 /etc/monasca/
|
||||
|
||||
CMD ["/start.sh"]
|
|
@ -0,0 +1,91 @@
|
|||
==================================
|
||||
Docker image for Monasca persister
|
||||
==================================
|
||||
The Monasca persister image is based on the monasca-base image.
|
||||
|
||||
|
||||
Building monasca-base image
|
||||
===========================
|
||||
See https://github.com/openstack/monasca-common/tree/master/docker/README.rst
|
||||
|
||||
|
||||
Building Docker image
|
||||
=====================
|
||||
|
||||
Example:
|
||||
$ ./build_image.sh <repository_version> <upper_constrains_branch> <common_version>
|
||||
|
||||
Everything after ``./build_image.sh`` is optional and by default configured
|
||||
to get versions from ``Dockerfile``. ``./build_image.sh`` also contain more
|
||||
detailed build description.
|
||||
|
||||
Environment variables
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
=============================== ================= ================================================
|
||||
Variable Default Description
|
||||
=============================== ================= ================================================
|
||||
DEBUG false If true, enable debug logging
|
||||
VERBOSE true If true, enable info logging
|
||||
ZOOKEEPER_URI zookeeper:2181 The host and port for zookeeper
|
||||
KAFKA_URI kafka:9092 The host and port for kafka
|
||||
KAFKA_ALARM_HISTORY_BATCH_SIZE 1000 Kafka consumer takes messages in a batch
|
||||
KAFKA_ALARM_HISTORY_GROUP_ID 1_events Kafka Group from which persister get alarm history
|
||||
KAFKA_ALARM_HISTORY_PROCESSORS 1 Number of processes for alarm history topic
|
||||
KAFKA_ALARM_HISTORY_WAIT_TIME 15 Seconds to wait if the batch size is not reached
|
||||
KAFKA_EVENTS_ENABLE false Enable events persister
|
||||
KAFKA_LEGACY_CLIENT_ENABLED true Enable legacy Kafka client
|
||||
KAFKA_METRICS_BATCH_SIZE 1000 Kafka consumer takes messages in a batch
|
||||
KAFKA_METRICS_GROUP_ID 1_metrics Kafka Group from which persister get metrics
|
||||
KAFKA_METRICS_PROCESSORS 1 Number of processes for metrics topic
|
||||
KAFKA_METRICS_WAIT_TIME 15 Seconds to wait if the batch size is not reached
|
||||
DATABASE_BACKEND influxdb Select for backend database
|
||||
INFLUX_HOST influxdb The host for influxdb
|
||||
INFLUX_PORT 8086 The port for influxdb
|
||||
INFLUX_USER mon_persister The influx username
|
||||
INFLUX_PASSWORD password The influx password
|
||||
INFLUX_DB mon The influx database name
|
||||
INFLUX_IGNORE_PARSE_POINT_ERROR false Don't exit on InfluxDB parse point errors
|
||||
CASSANDRA_HOSTS cassandra Cassandra node addresses
|
||||
CASSANDRA_PORT 8086 Cassandra port number
|
||||
CASSANDRA_USER mon_persister Cassandra user name
|
||||
CASSANDRA_PASSWORD password Cassandra password
|
||||
CASSANDRA_KEY_SPACE monasca Keyspace name where metrics are stored
|
||||
CASSANDRA_CONNECTION_TIMEOUT 5 Cassandra timeout in seconds
|
||||
CASSANDRA_MAX_CACHE_SIZE 20000000 Maximum number of cached metric definition entries in memory
|
||||
CASSANDRA_RETENTION_POLICY 45 Data retention period in days
|
||||
STAY_ALIVE_ON_FAILURE false If true, container runs 2 hours even start fails
|
||||
=============================== ================= ================================================
|
||||
|
||||
Wait scripts environment variables
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
======================= ================================ =========================================
|
||||
Variable Default Description
|
||||
======================= ================================ =========================================
|
||||
KAFKA_URI kafka:9092 URI to Apache Kafka (distributed
|
||||
streaming platform)
|
||||
KAFKA_WAIT_FOR_TOPICS alarm-state-transitions,metrics The topics where metric-api streams
|
||||
the metric messages and alarm-states
|
||||
KAFKA_WAIT_RETRIES 24 Number of kafka connect attempts
|
||||
KAFKA_WAIT_DELAY 5 Seconds to wait between attempts
|
||||
======================= ================================ =========================================
|
||||
|
||||
Scripts
|
||||
~~~~~~~
|
||||
start.sh
|
||||
In this starting script provide all steps that lead to the proper service
|
||||
start. Including usage of wait scripts and templating of configuration
|
||||
files. You also could provide the ability to allow running container after
|
||||
service died for easier debugging.
|
||||
|
||||
build_image.sh
|
||||
Please read detailed build description inside the script.
|
||||
|
||||
Provide Configuration templates
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* monasca-persister.conf.j2
|
||||
* persister-logging.conf.j2
|
||||
|
||||
|
||||
Links
|
||||
~~~~~
|
||||
https://github.com/openstack/monasca-persister/tree/master/monasca_persister
|
|
@ -0,0 +1,150 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
# TODO(Dobroslaw): move this script to monasca-common/docker folder
|
||||
# and leave here small script to download it and execute using env variables
|
||||
# to minimize code duplication.
|
||||
|
||||
set -x # Print each script step.
|
||||
set -eo pipefail # Exit the script if any statement returns error.
|
||||
|
||||
# This script is used for building Docker image with proper labels
|
||||
# and proper version of monasca-common.
|
||||
#
|
||||
# Example usage:
|
||||
# $ ./build_image.sh <repository_version> <upper_constains_branch> <common_version>
|
||||
#
|
||||
# Everything after `./build_image.sh` is optional and by default configured
|
||||
# to get versions from `Dockerfile`.
|
||||
#
|
||||
# To build from master branch (default):
|
||||
# $ ./build_image.sh
|
||||
# To build specific version run this script in the following way:
|
||||
# $ ./build_image.sh stable/queens
|
||||
# Building from specific commit:
|
||||
# $ ./build_image.sh cb7f226
|
||||
# When building from a tag monasca-common will be used in version available
|
||||
# in upper constraint file:
|
||||
# $ ./build_image.sh 2.5.0
|
||||
# To build image from Gerrit patch sets that is targeting branch stable/queens:
|
||||
# $ ./build_image.sh refs/changes/51/558751/1 stable/queens
|
||||
#
|
||||
# If you want to build image with custom monasca-common version you need
|
||||
# to provide it as in the following example:
|
||||
# $ ./build_image.sh master master refs/changes/19/595719/3
|
||||
|
||||
# Go to folder with Docker files.
|
||||
REAL_PATH=$(python -c "import os,sys; print(os.path.realpath('$0'))")
|
||||
cd "$(dirname "$REAL_PATH")/../docker/"
|
||||
|
||||
[ -z "$DOCKER_IMAGE" ] && \
|
||||
DOCKER_IMAGE=$(\grep DOCKER_IMAGE Dockerfile | cut -f2 -d"=")
|
||||
|
||||
: "${REPO_VERSION:=$1}"
|
||||
[ -z "$REPO_VERSION" ] && \
|
||||
REPO_VERSION=$(\grep REPO_VERSION Dockerfile | cut -f2 -d"=")
|
||||
# Let's stick to more readable version and disable SC2001 here.
|
||||
# shellcheck disable=SC2001
|
||||
REPO_VERSION_CLEAN=$(echo "$REPO_VERSION" | sed 's|/|-|g')
|
||||
|
||||
[ -z "$APP_REPO" ] && APP_REPO=$(\grep APP_REPO Dockerfile | cut -f2 -d"=")
|
||||
GITHUB_REPO=$(echo "$APP_REPO" | sed 's/review.opendev.org/github.com/' | \
|
||||
sed 's/ssh:/https:/')
|
||||
|
||||
if [ -z "$CONSTRAINTS_FILE" ]; then
|
||||
CONSTRAINTS_FILE=$(\grep CONSTRAINTS_FILE Dockerfile | cut -f2 -d"=") || true
|
||||
: "${CONSTRAINTS_FILE:=https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt}"
|
||||
fi
|
||||
|
||||
: "${CONSTRAINTS_BRANCH:=$2}"
|
||||
[ -z "$CONSTRAINTS_BRANCH" ] && \
|
||||
CONSTRAINTS_BRANCH=$(\grep CONSTRAINTS_BRANCH Dockerfile | cut -f2 -d"=")
|
||||
|
||||
# When using stable version of repository use same stable constraints file.
|
||||
case "$REPO_VERSION" in
|
||||
*stable*)
|
||||
CONSTRAINTS_BRANCH_CLEAN="$REPO_VERSION"
|
||||
CONSTRAINTS_FILE=${CONSTRAINTS_FILE/master/$CONSTRAINTS_BRANCH_CLEAN}
|
||||
# Get monasca-common version from stable upper constraints file.
|
||||
CONSTRAINTS_TMP_FILE=$(mktemp)
|
||||
wget --output-document "$CONSTRAINTS_TMP_FILE" \
|
||||
$CONSTRAINTS_FILE
|
||||
UPPER_COMMON=$(\grep 'monasca-common' "$CONSTRAINTS_TMP_FILE")
|
||||
# Get only version part from monasca-common.
|
||||
UPPER_COMMON_VERSION="${UPPER_COMMON##*===}"
|
||||
rm -rf "$CONSTRAINTS_TMP_FILE"
|
||||
;;
|
||||
*)
|
||||
CONSTRAINTS_BRANCH_CLEAN="$CONSTRAINTS_BRANCH"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Monasca-common variables.
|
||||
if [ -z "$COMMON_REPO" ]; then
|
||||
COMMON_REPO=$(\grep COMMON_REPO Dockerfile | cut -f2 -d"=") || true
|
||||
: "${COMMON_REPO:=https://review.opendev.org/openstack/monasca-common}"
|
||||
fi
|
||||
: "${COMMON_VERSION:=$3}"
|
||||
if [ -z "$COMMON_VERSION" ]; then
|
||||
COMMON_VERSION=$(\grep COMMON_VERSION Dockerfile | cut -f2 -d"=") || true
|
||||
if [ "$UPPER_COMMON_VERSION" ]; then
|
||||
# Common from upper constraints file.
|
||||
COMMON_VERSION="$UPPER_COMMON_VERSION"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Clone project to temporary directory for getting proper commit number from
|
||||
# branches and tags. We need this for setting proper image labels.
|
||||
# Docker does not allow to get any data from inside of system when building
|
||||
# image.
|
||||
TMP_DIR=$(mktemp -d)
|
||||
(
|
||||
cd "$TMP_DIR"
|
||||
# This many steps are needed to support gerrit patch sets.
|
||||
git init
|
||||
git remote add origin "$APP_REPO"
|
||||
git fetch origin "$REPO_VERSION"
|
||||
git reset --hard FETCH_HEAD
|
||||
)
|
||||
GIT_COMMIT=$(git -C "$TMP_DIR" rev-parse HEAD)
|
||||
[ -z "${GIT_COMMIT}" ] && echo "No git commit hash found" && exit 1
|
||||
rm -rf "$TMP_DIR"
|
||||
|
||||
# Do the same for monasca-common.
|
||||
COMMON_TMP_DIR=$(mktemp -d)
|
||||
(
|
||||
cd "$COMMON_TMP_DIR"
|
||||
# This many steps are needed to support gerrit patch sets.
|
||||
git init
|
||||
git remote add origin "$COMMON_REPO"
|
||||
git fetch origin "$COMMON_VERSION"
|
||||
git reset --hard FETCH_HEAD
|
||||
)
|
||||
COMMON_GIT_COMMIT=$(git -C "$COMMON_TMP_DIR" rev-parse HEAD)
|
||||
[ -z "${COMMON_GIT_COMMIT}" ] && echo "No git commit hash found" && exit 1
|
||||
rm -rf "$COMMON_TMP_DIR"
|
||||
|
||||
CREATION_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
||||
|
||||
docker build --no-cache \
|
||||
--build-arg CREATION_TIME="$CREATION_TIME" \
|
||||
--build-arg GITHUB_REPO="$GITHUB_REPO" \
|
||||
--build-arg APP_REPO="$APP_REPO" \
|
||||
--build-arg REPO_VERSION="$REPO_VERSION" \
|
||||
--build-arg GIT_COMMIT="$GIT_COMMIT" \
|
||||
--build-arg CONSTRAINTS_FILE="$CONSTRAINTS_FILE" \
|
||||
--build-arg COMMON_REPO="$COMMON_REPO" \
|
||||
--build-arg COMMON_VERSION="$COMMON_VERSION" \
|
||||
--build-arg COMMON_GIT_COMMIT="$COMMON_GIT_COMMIT" \
|
||||
--tag "$DOCKER_IMAGE":"$REPO_VERSION_CLEAN" .
|
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env python
|
||||
# coding=utf-8
|
||||
|
||||
# (C) Copyright 2018 FUJITSU LIMITED
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""Health check will returns 0 when service is working properly."""
|
||||
|
||||
def main():
|
||||
"""health check for Monasca-persister"""
|
||||
# TODO(Christian Brandstetter) wait for health check endpoint ...
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -0,0 +1,96 @@
|
|||
[DEFAULT]
|
||||
# Provide logging configuration
|
||||
log_config_append = /etc/monasca/persister-logging.conf
|
||||
|
||||
# Show debugging output in logs (sets DEBUG log level output)
|
||||
debug = {{ DEBUG }}
|
||||
# Show more verbose log output (sets INFO log level output) if debug is False
|
||||
verbose = {{ VERBOSE }}
|
||||
|
||||
[repositories]
|
||||
{% if DATABASE_BACKEND | lower == 'cassandra' %}
|
||||
# The cassandra driver to use for the metrics repository
|
||||
metrics_driver = monasca_persister.repositories.cassandra.metrics_repository:MetricCassandraRepository
|
||||
|
||||
# The cassandra driver to use for the alarm state history repository
|
||||
alarm_state_history_driver = monasca_persister.repositories.cassandra.alarm_state_history_repository:AlarmStateHistCassandraRepository
|
||||
{% else %}
|
||||
# The influxdb driver to use for the metrics repository
|
||||
metrics_driver = monasca_persister.repositories.influxdb.metrics_repository:MetricInfluxdbRepository
|
||||
|
||||
# The influxdb driver to use for the alarm state history repository
|
||||
alarm_state_history_driver = monasca_persister.repositories.influxdb.alarm_state_history_repository:AlarmStateHistInfluxdbRepository
|
||||
|
||||
# Don't exit on InfluxDB parse point errors
|
||||
ignore_parse_point_error = {{ INFLUX_IGNORE_PARSE_POINT_ERROR }}
|
||||
{% endif %}
|
||||
|
||||
[zookeeper]
|
||||
# Comma separated list of host:port
|
||||
uri = {{ ZOOKEEPER_URI }}
|
||||
partition_interval_recheck_seconds = 15
|
||||
|
||||
[kafka_alarm_history]
|
||||
# Comma separated list of Kafka broker host:port.
|
||||
uri = {{ KAFKA_URI }}
|
||||
group_id = {{ KAFKA_ALARM_HISTORY_GROUP_ID }}
|
||||
topic = alarm-state-transitions
|
||||
consumer_id = 1
|
||||
client_id = 1
|
||||
batch_size = {{ KAFKA_ALARM_HISTORY_BATCH_SIZE }}
|
||||
max_wait_time_seconds = {{ KAFKA_ALARM_HISTORY_WAIT_TIME }}
|
||||
# The following 3 values are set to the kakfa-python defaults
|
||||
fetch_size_bytes = 4096
|
||||
buffer_size = 4096
|
||||
# 8 times buffer size
|
||||
max_buffer_size = 32768
|
||||
# Path in zookeeper for kafka consumer group partitioning algo
|
||||
zookeeper_path = /persister_partitions/alarm-state-transitions
|
||||
num_processors = {{ KAFKA_ALARM_HISTORY_PROCESSORS | default(1) }}
|
||||
legacy_kafka_client_enabled= {{ KAFKA_LEGACY_CLIENT_ENABLED | default(true) }}
|
||||
|
||||
[kafka_events]
|
||||
# Comma separated list of Kafka broker host:port.
|
||||
uri = {{ KAFKA_URI }}
|
||||
enabled = {{ KAFKA_EVENTS_ENABLE | default(false) }}
|
||||
group_id = 1_events
|
||||
topic = monevents
|
||||
batch_size = 1
|
||||
|
||||
[kafka_metrics]
|
||||
# Comma separated list of Kafka broker host:port
|
||||
uri = {{ KAFKA_URI }}
|
||||
group_id = {{ KAFKA_METRICS_GROUP_ID }}
|
||||
topic = metrics
|
||||
consumer_id = 1
|
||||
client_id = 1
|
||||
batch_size = {{ KAFKA_METRICS_BATCH_SIZE }}
|
||||
max_wait_time_seconds = {{ KAFKA_METRICS_WAIT_TIME }}
|
||||
# The following 3 values are set to the kakfa-python defaults
|
||||
fetch_size_bytes = 4096
|
||||
buffer_size = 4096
|
||||
# 8 times buffer size
|
||||
max_buffer_size = 32768
|
||||
# Path in zookeeper for kafka consumer group partitioning algo
|
||||
zookeeper_path = /persister_partitions/metrics
|
||||
num_processors = {{ KAFKA_METRICS_PROCESSORS | default(1) }}
|
||||
legacy_kafka_client_enabled= {{ KAFKA_LEGACY_CLIENT_ENABLED | default(true) }}
|
||||
|
||||
{% if DATABASE_BACKEND | lower == 'cassandra' %}
|
||||
[cassandra]
|
||||
contact_points = {{ CASSANDRA_HOSTS }}
|
||||
port = {{ CASSANDRA_PORT }}
|
||||
keyspace = {{ CASSANDRA_KEY_SPACE }}
|
||||
user = {{ CASSANDRA_USER }}
|
||||
password = {{ CASSANDRA_PASSWORD }}
|
||||
connection_timeout = {{ CASSANDRA_CONNECTION_TIMEOUT }}
|
||||
max_definition_cache_size = {{ CASSANDRA_MAX_CACHE_SIZE }}
|
||||
retention_policy = {{ CASSANDRA_RETENTION_POLICY }}
|
||||
{% else %}
|
||||
[influxdb]
|
||||
database_name = {{ INFLUX_DB }}
|
||||
ip_address = {{ INFLUX_HOST }}
|
||||
port = {{ INFLUX_PORT }}
|
||||
user = {{ INFLUX_USER }}
|
||||
password = {{ INFLUX_PASSWORD }}
|
||||
{% endif %}
|
|
@ -0,0 +1,43 @@
|
|||
[loggers]
|
||||
keys = root, kafka, influxdb, cassandra
|
||||
|
||||
[handlers]
|
||||
keys = console
|
||||
|
||||
[formatters]
|
||||
keys = generic
|
||||
|
||||
[logger_root]
|
||||
level = {{ LOG_LEVEL }}
|
||||
formatter = default
|
||||
handlers = console
|
||||
|
||||
[logger_kafka]
|
||||
qualname = kafka
|
||||
level = {{ LOG_LEVEL_KAFKA }}
|
||||
formatter = default
|
||||
handlers = console
|
||||
propagate = 0
|
||||
|
||||
[logger_influxdb]
|
||||
qualname = influxdb
|
||||
level = {{ LOG_LEVEL_INFLUXDB }}
|
||||
formatter = default
|
||||
handlers = console
|
||||
propagate = 0
|
||||
|
||||
[logger_cassandra]
|
||||
qualname = cassandra
|
||||
level = {{ LOG_LEVEL_CASSANDRA }}
|
||||
formatter = default
|
||||
handlers = console
|
||||
propagate = 0
|
||||
|
||||
[handler_console]
|
||||
class = logging.StreamHandler
|
||||
args = (sys.stderr,)
|
||||
level = DEBUG
|
||||
formatter = generic
|
||||
|
||||
[formatter_generic]
|
||||
format = %(asctime)s %(levelname)s [%(name)s][%(threadName)s] %(message)s
|
|
@ -0,0 +1,42 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
# Starting script.
|
||||
# All checks and configuration templating you need to do before service
|
||||
# could be safely started should be added in this file.
|
||||
|
||||
set -eo pipefail # Exit the script if any statement returns error.
|
||||
|
||||
# Test services we need before starting our service.
|
||||
echo "Start script: waiting for needed services"
|
||||
python3 /kafka_wait_for_topics.py
|
||||
|
||||
# Template all config files before start, it will use env variables.
|
||||
# Read usage examples: https://pypi.org/project/Templer/
|
||||
echo "Start script: creating config files from templates"
|
||||
templer -v -f /etc/monasca/monasca-persister.conf.j2 /etc/monasca/monasca-persister.conf
|
||||
templer -v -f /etc/monasca/persister-logging.conf.j2 /etc/monasca/persister-logging.conf
|
||||
|
||||
# Start our service.
|
||||
# gunicorn --args
|
||||
echo "Start script: starting container"
|
||||
monasca-persister --config-file /etc/monasca/monasca-persister.conf
|
||||
|
||||
# Allow server to stay alive in case of failure for 2 hours for debugging.
|
||||
RESULT=$?
|
||||
if [ $RESULT != 0 ] && [ "$STAY_ALIVE_ON_FAILURE" = "true" ]; then
|
||||
echo "Service died, waiting 120 min before exiting"
|
||||
sleep 7200
|
||||
fi
|
||||
exit $RESULT
|
|
@ -0,0 +1,85 @@
|
|||
---
|
||||
# Copyright 2020 VEXXHOST, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
apiVersion: apps/v1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: monasca-persister
|
||||
namespace: openstack
|
||||
labels:
|
||||
{{ labels("monasca", component="persister") | indent(4) }}
|
||||
spec:
|
||||
updateStrategy:
|
||||
rollingUpdate:
|
||||
maxUnavailable: 1
|
||||
type: RollingUpdate
|
||||
selector:
|
||||
matchLabels:
|
||||
{{ labels("monasca", component="persister") | indent(6) }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{ labels("monasca", component="persister") | indent(8) }}
|
||||
annotations:
|
||||
checksum/config: "{{ config_hash }}"
|
||||
spec:
|
||||
automountServiceAccountToken: false
|
||||
containers:
|
||||
- name: monasca-persister
|
||||
image: vexxhost/monasca-persister:latest
|
||||
imagePullPolicy: Always
|
||||
{% if env is defined and env|length %}
|
||||
env:
|
||||
{% if 'sentryDSN' in spec %}
|
||||
- name: SENTRY_DSN
|
||||
value: {{ spec.sentryDSN }}
|
||||
{% endif %}
|
||||
{% for v in env %}
|
||||
- name: "{{ v.name }}"
|
||||
value: "{{ v.value }}"
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
lifecycle:
|
||||
preStop:
|
||||
exec:
|
||||
command: ["/bin/sleep", "5"]
|
||||
securityContext:
|
||||
runAsUser: 65534
|
||||
runAsGroup: 65534
|
||||
volumeMounts:
|
||||
- mountPath: /etc/monasca
|
||||
name: config
|
||||
- name: uwsgi-config
|
||||
mountPath: /etc/uwsgi
|
||||
volumes:
|
||||
- name: config
|
||||
secret:
|
||||
secretName: monasca-config
|
||||
- name: uwsgi-config
|
||||
configMap:
|
||||
defaultMode: 420
|
||||
name: uwsgi-default
|
||||
{% if 'nodeSelector' in spec %}
|
||||
nodeSelector:
|
||||
{{ spec.nodeSelector | to_yaml | indent(8) }}
|
||||
{% endif %}
|
||||
{% if 'tolerations' in spec %}
|
||||
tolerations:
|
||||
{{ spec.tolerations | to_yaml | indent(8) }}
|
||||
{% endif %}
|
||||
{% if 'hostAliases' in spec %}
|
||||
hostAliases:
|
||||
{{ spec.hostAliases | to_yaml | indent(8) }}
|
||||
{% endif %}
|
|
@ -101,6 +101,8 @@
|
|||
soft: true
|
||||
- name: openstack-operator:images:build:cinder
|
||||
soft: true
|
||||
- name: openstack-operator:images:build:monasca-persister
|
||||
soft: true
|
||||
- name: openstack-operator:images:build:nova
|
||||
soft: true
|
||||
- openstack-operator:images:build:openstack-operator
|
||||
|
@ -142,6 +144,8 @@
|
|||
soft: true
|
||||
- name: openstack-operator:images:upload:cinder
|
||||
soft: true
|
||||
- name: openstack-operator:images:upload:monasca-persister
|
||||
soft: true
|
||||
- name: openstack-operator:images:upload:nova
|
||||
soft: true
|
||||
- openstack-operator:images:upload:openstack-operator
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
- job:
|
||||
name: openstack-operator:images:build:monasca-persister
|
||||
parent: vexxhost-build-docker-image
|
||||
provides: openstack-operator:image:monasca-persister
|
||||
nodeset: &id001
|
||||
nodes:
|
||||
- name: ubuntu-bionic
|
||||
label: ubuntu-bionic-vexxhost
|
||||
vars: &id002
|
||||
docker_images:
|
||||
- context: images/monasca-persister
|
||||
repository: vexxhost/monasca-persister
|
||||
target: monasca-persister
|
||||
dependencies:
|
||||
- openstack-operator:images:build:openstack-operator
|
||||
files: &id003
|
||||
- ^images/monasca-persister/.*
|
||||
- job:
|
||||
name: openstack-operator:images:upload:monasca-persister
|
||||
parent: vexxhost-upload-docker-image
|
||||
provides: openstack-operator:image:monasca-persister
|
||||
nodeset: *id001
|
||||
vars: *id002
|
||||
dependencies:
|
||||
- openstack-operator:images:upload:openstack-operator
|
||||
files: *id003
|
||||
- job:
|
||||
name: openstack-operator:images:promote:monasca-persister
|
||||
parent: vexxhost-promote-docker-image
|
||||
nodeset: *id001
|
||||
vars: *id002
|
||||
files: *id003
|
||||
- project:
|
||||
check:
|
||||
jobs:
|
||||
- openstack-operator:images:build:monasca-persister
|
||||
gate:
|
||||
jobs:
|
||||
- openstack-operator:images:upload:monasca-persister
|
||||
promote:
|
||||
jobs:
|
||||
- openstack-operator:images:promote:monasca-persister
|
Loading…
Reference in New Issue