Adjust monasca-api installation

Adjust monasca-api Python installation with changes:
- start/stop of monasca-api proces handles through run_process
  and stop_process and no service files
- setting up environment with devstack function
- use USE_VENV for monasca-api
- installing monasca-api dependencies from git
- remove configuration file from devstack/files/monasca-api/python
- setup up configuration files with iniset

Change-Id: I2faf48d17fb5e958e1d7ad2383c125ade3faaaf0
This commit is contained in:
Artur Basiak 2017-05-31 12:22:10 +02:00
parent 36b0bad632
commit 41cf335127
7 changed files with 176 additions and 401 deletions

View File

@ -1,130 +0,0 @@
[DEFAULT]
log_config_append=/etc/monasca/api-logging.conf
# Identifies the region that the Monasca API is running in.
region = useast
# Dispatchers to be loaded to serve restful APIs
[dispatcher]
versions = monasca_api.v2.reference.versions:Versions
version_2_0 = monasca_api.v2.reference.version_2_0:Version2
metrics = monasca_api.v2.reference.metrics:Metrics
metrics_measurements = monasca_api.v2.reference.metrics:MetricsMeasurements
metrics_statistics = monasca_api.v2.reference.metrics:MetricsStatistics
metrics_names = monasca_api.v2.reference.metrics:MetricsNames
alarm_definitions = monasca_api.v2.reference.alarm_definitions:AlarmDefinitions
alarms = monasca_api.v2.reference.alarms:Alarms
alarms_count = monasca_api.v2.reference.alarms:AlarmsCount
alarms_state_history = monasca_api.v2.reference.alarms:AlarmsStateHistory
notification_methods = monasca_api.v2.reference.notifications:Notifications
dimension_values = monasca_api.v2.reference.metrics:DimensionValues
dimension_names = monasca_api.v2.reference.metrics:DimensionNames
notification_method_types = monasca_api.v2.reference.notificationstype:NotificationsType
healthchecks = monasca_api.healthchecks:HealthChecks
[security]
# The roles that are allowed full access to the API.
default_authorized_roles = user, domainuser, domainadmin, monasca-user
# The roles that are allowed to only POST metrics to the API. This role would be used by the Monasca Agent.
agent_authorized_roles = monasca-agent
# The roles that are allowed to only GET metrics from the API.
read_only_authorized_roles = monasca-read-only-user
# The roles that are allowed to access the API on behalf of another tenant.
# For example, a service can POST metrics to another tenant if they are a member of the "delegate" role.
delegate_authorized_roles = admin
[messaging]
# The message queue driver to use
driver = monasca_api.common.messaging.kafka_publisher:KafkaPublisher
[repositories]
# The driver to use for the metrics repository
# Available options:
# - InfluxDB => monasca_api.common.repositories.influxdb.metrics_repository:MetricsRepository
# - Cassandra => monasca_api.common.repositories.cassandra.metrics_repository:MetricsRepository
metrics_driver = %MONASCA_METRIC_DATABASE_DRIVER%
# The driver to use for the alarm definitions repository
alarm_definitions_driver = monasca_api.common.repositories.sqla.alarm_definitions_repository:AlarmDefinitionsRepository
# The driver to use for the alarms repository
alarms_driver = monasca_api.common.repositories.sqla.alarms_repository:AlarmsRepository
# The driver to use for the notifications repository
notifications_driver = monasca_api.common.repositories.sqla.notifications_repository:NotificationsRepository
# The driver to use for the notification method type repository
notification_method_type_driver = monasca_api.common.repositories.sqla.notification_method_type_repository:NotificationMethodTypeRepository
[dispatcher]
driver = v2_reference
[kafka]
# The endpoint to the kafka server
uri = %KAFKA_HOST%:9092
# The topic that metrics will be published too
metrics_topic = metrics
# The topic that events will be published too
events_topic = events
# The topic that alarm state will be published too
alarm_state_transitions_topic = alarm-state-transitions
# consumer group name
group = api
# how many times to try when error occurs
max_retry = 1
# wait time between tries when kafka goes down
wait_time = 1
# use synchronous or asynchronous connection to kafka
async = False
# send messages in bulk or send messages one by one.
compact = False
# How many partitions this connection should listen messages on, this
# parameter is for reading from kafka. If listens on multiple partitions,
# For example, if the client should listen on partitions 1 and 3, then the
# configuration should look like the following:
# partitions = 1
# partitions = 3
# default to listen on partition 0.
partitions = 0
[influxdb]
# Only needed if Influxdb database is used for backend.
# The IP address of the InfluxDB service.
ip_address = %INFLUXDB_HOST%
# The port number that the InfluxDB service is listening on.
port = %INFLUXDB_PORT%
# The username to authenticate with.
user = mon_api
# The password to authenticate with.
password = password
# The name of the InfluxDB database to use.
database_name = mon
[cassandra]
# Only needed if Cassandra database is used for backend.
# Comma separated list of Cassandra node IP addresses. No spaces.
cluster_ip_addresses: %CASSANDRA_HOST%
keyspace: monasca
[database]
connection = "%MONASCA_API_DATABASE_URL%"
# keystone_auth_token is set from devstack utility
# https://github.com/openstack-dev/devstack/blob/master/lib/keystone#L430

View File

@ -1,23 +0,0 @@
[DEFAULT]
name = monasca_api
[pipeline:main]
pipeline = request_id auth api
[app:api]
paste.app_factory = monasca_api.api.server:launch
[filter:auth]
paste.filter_factory = monasca_api.healthcheck.keystone_protocol:filter_factory
[filter:request_id]
paste.filter_factory = oslo_middleware.request_id:RequestId.factory
[server:main]
use = egg:gunicorn#main
host = %MONASCA_API_SERVICE_HOST%
port = %MONASCA_API_SERVICE_PORT%
workers = %API_WORKERS%
worker-connections = 2000
backlog = 1000
proc_name = monasca_api

View File

@ -1,43 +0,0 @@
[loggers]
keys = root, sqlalchemy, kafka
[handlers]
keys = console, file
[formatters]
keys = context
[logger_root]
level = DEBUG
handlers = console, file
[logger_sqlalchemy]
qualname = sqlalchemy.engine
# "level = INFO" logs SQL queries.
# "level = DEBUG" logs SQL queries and results.
# "level = WARN" logs neither. (Recommended for production systems.)
level = DEBUG
handlers = console, file
propagate=0
[logger_kafka]
qualname = kafka
level = DEBUG
handlers = console, file
propagate = 0
[handler_console]
class = logging.StreamHandler
args = (sys.stderr,)
level = DEBUG
formatter = context
[handler_file]
class = logging.handlers.RotatingFileHandler
level = DEBUG
formatter = context
# store up to 5*100MB of logs
args = ('/var/log/monasca/api/monasca-api.log', 'a', 104857600, 5)
[formatter_context]
class = oslo_log.formatters.ContextFormatter

View File

@ -1,29 +0,0 @@
# 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.
#
# Startup script for the Monasca API
[Unit]
Description=Monasca API Python app
Requires=network.target
After=network.target kafka.service influxdb.service mysql.service
[Service]
User=mon-api
Group=monasca
ExecStart=/opt/monasca-api/bin/gunicorn -n monasca-api -k eventlet --worker-connections=2000 --backlog=1000 --paste /etc/monasca/api-config.ini -w 9
Restart=on-failure
[Install]
WantedBy=multi-user.target

View File

@ -80,13 +80,23 @@ else
fi
# monasca-api variables
# monasca-api settings
if [[ ${USE_VENV} = True ]]; then
PROJECT_VENV["monasca-api"]=${MONASCA_API_DIR}.venv
MONASCA_API_BIN_DIR=${PROJECT_VENV["monasca-api"]}/bin
else
MONASCA_API_BIN_DIR=$(get_python_exec_prefix)
fi
MONASCA_API_BASE_URI=${MONASCA_API_SERVICE_PROTOCOL}://${MONASCA_API_SERVICE_HOST}:${MONASCA_API_SERVICE_PORT}
MONASCA_API_URI_V2=${MONASCA_API_BASE_URI}/v2.0
# Files inside this directory will be visible in gates log
MON_API_GATE_CONFIGURATION_DIR=/etc/monasca-api
function pre_install_monasca {
echo_summary "Pre-Installing Monasca Components"
find_nearest_apache_mirror
install_gate_config_holder
install_kafka
install_zookeeper
@ -98,15 +108,11 @@ function pre_install_monasca {
install_monasca_$MONASCA_METRICS_DB
}
function find_nearest_apache_mirror {
apache_mirror=`curl -s 'https://www.apache.org/dyn/closer.cgi?as_json=1' | jq --raw-output '.preferred'`
}
function install_monasca {
echo_summary "Installing Monasca"
download_monasca_libraries
install_monasca_common_java
if is_service_enabled monasca-persister; then
install_monasca_persister_$MONASCA_PERSISTER_IMPLEMENTATION_LANG
@ -122,28 +128,31 @@ function install_monasca {
install_monasca_thresh
fi
if is_service_enabled monasca-api; then
install_monasca_api_$MONASCA_API_IMPLEMENTATION_LANG
sudo systemctl enable monasca-api
if [ "$MONASCA_API_IMPLEMENTATION_LANG" == "python" ]; then
stack_install_service monasca-api
else
install_monasca_api_java
sudo systemctl enable monasca-api
fi
fi
install_ui
install_cli_creds
}
function post_config_monasca {
function configure_monasca {
echo_summary "Configuring Monasca"
#(trebskit) Installing should happen in post-config phase
# at this point databases is already configured
install_schema
configure_ui
configure_monasca_api
configure_screen
}
function configure_screen {
if [[ -n ${SCREEN_LOGDIR} ]]; then
sudo ln -sf /var/log/influxdb/influxd.log ${SCREEN_LOGDIR}/screen-influxdb.log || true
sudo ln -sf /var/log/monasca/api/monasca-api.log ${SCREEN_LOGDIR}/screen-monasca-api.log || true
sudo ln -sf /var/log/monasca/persister/persister.log ${SCREEN_LOGDIR}/screen-monasca-persister.log || true
sudo ln -sf /var/log/monasca/notification/notification.log ${SCREEN_LOGDIR}/screen-monasca-notification.log || true
@ -182,7 +191,7 @@ function extra_monasca {
function start_monasca_services {
if is_service_enabled monasca-api; then
start_service monasca-api || restart_service monasca-api
start_monasca_api
fi
if is_service_enabled monasca-persister; then
start_service monasca-persister || restart_service monasca-persister
@ -217,7 +226,7 @@ function unstack_monasca {
stop_service monasca-persister || true
stop_service monasca-api || true
stop_monasca_api
stop_service kafka || true
@ -262,7 +271,7 @@ function clean_monasca {
clean_monasca_api_$MONASCA_API_IMPLEMENTATION_LANG
fi
clean_monasca_common
clean_monasca_common_java
clean_schema
@ -691,25 +700,17 @@ function clean_schema {
}
function download_monasca_libraries {
echo_summary "Download Monasca monasca_common and monasca_statsd"
function install_monasca_common_java {
echo_summary "Install monasca_common Java"
GIT_DEPTH_OLD=$GIT_DEPTH
GIT_DEPTH=0
git_clone $MONASCA_COMMON_REPO $MONASCA_COMMON_DIR $MONASCA_COMMON_BRANCH
git_clone $MONASCA_STATSD_REPO $MONASCA_STATSD_DIR $MONASCA_STATSD_BRANCH
(cd "${MONASCA_COMMON_DIR}"/java ; sudo mvn clean install -DskipTests)
GIT_DEPTH=$GIT_DEPTH_OLD
}
function clean_monasca_common {
function clean_monasca_common_java {
echo_summary "Clean Monasca monasca_common"
(cd "${MONASCA_COMMON_DIR}" ; sudo mvn clean)
}
function install_monasca_api_java {
@ -796,24 +797,14 @@ function install_monasca_api_java {
" -i /etc/monasca/api-config.yml
}
function install_monasca-api {
echo_summary "Install Monasca monasca_api "
function install_monasca_api_python {
echo_summary "Install Monasca monasca_api_python"
sudo mkdir -p /opt/monasca-api
sudo chown $STACK_USER:monasca /opt/monasca-api
(cd /opt/monasca-api; virtualenv .)
PIP_VIRTUAL_ENV=/opt/monasca-api
setup_install $MONASCA_COMMON_DIR
setup_install $MONASCA_STATSD_DIR
git_clone $MONASCA_API_REPO $MONASCA_API_DIR $MONASCA_API_BRANCH
setup_develop $MONASCA_API_DIR
pip_install_gr gunicorn
install_monasca_common
if [[ "${MONASCA_METRICS_DB,,}" == 'influxdb' ]]; then
pip_install_gr influxdb
@ -829,88 +820,95 @@ function install_monasca_api_python {
pip_install_gr PyMySQL
fi
setup_install $MONASCA_API_DIR
install_keystonemiddleware
}
unset PIP_VIRTUAL_ENV
function configure_monasca_api_python {
if is_service_enabled monasca-api; then
echo_summary "Configuring monasca-api python"
sudo install -d -o $STACK_USER $MONASCA_API_CONF_DIR
create_api_cache_dir
sudo useradd --system -g monasca mon-api || true
sudo mkdir -p /var/log/monasca || true
sudo chown $STACK_USER:monasca /var/log/monasca
sudo chmod 0755 /var/log/monasca
sudo mkdir -p /var/log/monasca/api || true
sudo chown $STACK_USER:monasca /var/log/monasca/api
sudo chmod 0775 /var/log/monasca/api
rm -rf $MONASCA_API_CONF $MONASCA_API_PASTE_INI $MONASCA_API_LOGGING_CONF
local dbAlarmUrl
local dbMetricDriver
if [[ "${MONASCA_METRICS_DB,,}" == 'cassandra' ]]; then
dbMetricDriver="monasca_api.common.repositories.cassandra.metrics_repository:MetricsRepository"
else
dbMetricDriver="monasca_api.common.repositories.influxdb.metrics_repository:MetricsRepository"
fi
dbAlarmUrl=`database_connection_url mon`
if [[ "$MONASCA_API_CONF_DIR" != "$MONASCA_API_DIR/etc/monasca" ]]; then
install -m 600 $MONASCA_API_DIR/etc/api-config.conf $MONASCA_API_CONF
install -m 600 $MONASCA_API_DIR/etc/api-logging.conf $MONASCA_API_LOGGING_CONF
install -m 600 $MONASCA_API_DIR/etc/api-config.ini $MONASCA_API_PASTE_INI
fi
iniset "$MONASCA_API_CONF" database connection $dbAlarmUrl
iniset "$MONASCA_API_CONF" repositories metrics_driver $dbMetricDriver
iniset "$MONASCA_API_CONF" cassandra cluster_ip_addresses $SERVICE_HOST
iniset "$MONASCA_API_CONF" influxdb ip_address $SERVICE_HOST
iniset "$MONASCA_API_CONF" influxdb port 8086
iniset "$MONASCA_API_CONF" kafka uri "$SERVICE_HOST:9092"
configure_auth_token_middleware $MONASCA_API_CONF "admin" $MONASCA_API_CACHE_DIR
iniset "$MONASCA_API_CONF" keystone_authtoken region_name $REGION_NAME
iniset "$MONASCA_API_CONF" keystone_authtoken project_name "admin"
iniset "$MONASCA_API_CONF" keystone_authtoken password $ADMIN_PASSWORD
iniset "$MONASCA_API_CONF" keystone_authtoken identity_uri "http://$SERVICE_HOST:35357"
iniset "$MONASCA_API_CONF" keystone_authtoken auth_uri "http://$SERVICE_HOST:5000"
iniset "$MONASCA_API_PASTE_INI" server:main host $MONASCA_API_SERVICE_HOST
iniset "$MONASCA_API_PASTE_INI" server:main port $MONASCA_API_SERVICE_PORT
iniset "$MONASCA_API_PASTE_INI" server:main workers $API_WORKERS
iniset "$MONASCA_API_LOGGING_CONF" handler_file args "('$MONASCA_API_LOG_DIR/monasca-api.log', 'a', 104857600, 5)"
# link configuration for the gate
ln -sf $MONASCA_API_CONF $MON_API_GATE_CONFIGURATION_DIR
ln -sf $MONASCA_API_PASTE_INI $MON_API_GATE_CONFIGURATION_DIR
ln -sf $MONASCA_API_LOGGING_CONF $MON_API_GATE_CONFIGURATION_DIR
sudo cp -f "${MONASCA_API_DIR}"/devstack/files/monasca-api/python/monasca-api.service /etc/systemd/system/monasca-api.service
sudo chown root:root /etc/systemd/system/monasca-api.service
sudo chmod 0644 /etc/systemd/system/monasca-api.service
if [[ "${MONASCA_METRICS_DB,,}" == 'cassandra' ]]; then
sudo sed -i "s/influxdb.service/cassandra.service/g" /etc/systemd/system/monasca-api.service
fi
}
sudo mkdir -p /var/log/monasca || true
function create_api_cache_dir {
sudo install -m 700 -d -o $STACK_USER $MONASCA_API_CACHE_DIR
}
sudo chown root:monasca /var/log/monasca
function start_monasca_api_python {
if is_service_enabled monasca-api; then
echo_summary "Starting monasca-api"
sudo chmod 0755 /var/log/monasca
local service_port=$MONASCA_API_SERVICE_PORT
local service_protocol=$MONASCA_API_SERVICE_PROTOCOL
local gunicorn="$MONASCA_API_BIN_DIR/gunicorn"
sudo mkdir -p /var/log/monasca/api || true
restart_service memcached
run_process "monasca-api" "$gunicorn --paste $MONASCA_API_PASTE_INI"
sudo chown root:monasca /var/log/monasca/api
sudo chmod 0775 /var/log/monasca/api
sudo install -d -o $STACK_USER /etc/monasca
# if monasca devstack would use DATABASE_USER everywhere, following line
# might be replaced with database_connection_url call
local dbAlarmUrl
local dbMetricDriver
if [[ "${MONASCA_METRICS_DB,,}" == 'cassandra' ]]; then
dbMetricDriver="monasca_api.common.repositories.cassandra.metrics_repository:MetricsRepository"
else
dbMetricDriver="monasca_api.common.repositories.influxdb.metrics_repository:MetricsRepository"
echo "Waiting for monasca-api to start..."
if ! wait_for_service $SERVICE_TIMEOUT $service_protocol://$SERVICE_HOST:$service_port; then
die $LINENO "monasca-api did not start"
fi
fi
dbAlarmUrl=`database_connection_url mon`
install -m 600 "${MONASCA_API_DIR}"/devstack/files/monasca-api/python/api-config.conf /etc/monasca/api-config.conf
install -m 600 "${MONASCA_API_DIR}"/devstack/files/monasca-api/python/api-logging.conf /etc/monasca/api-logging.conf
install -m 600 "${MONASCA_API_DIR}"/devstack/files/monasca-api/python/api-config.ini /etc/monasca/api-config.ini
sed -e "
s|%DATABASE_HOST%|$DATABASE_HOST|g;
s|%DATABASE_PASSWORD%|$DATABASE_PASSWORD|g;
s|%DATABASE_USER%|$DATABASE_USER|g;
s|%MONASCA_API_DATABASE_URL%|$dbAlarmUrl|g;
s|%MONASCA_METRIC_DATABASE_DRIVER%|$dbMetricDriver|g;
s|%CASSANDRA_HOST%|$SERVICE_HOST|g;
s|%INFLUXDB_HOST%|$SERVICE_HOST|g;
s|%INFLUXDB_PORT%|8086|g;
s|%KAFKA_HOST%|$SERVICE_HOST|g;
" -i /etc/monasca/api-config.conf
configure_auth_token_middleware "/etc/monasca/api-config.conf" "admin"
iniset /etc/monasca/api-config.conf keystone_authtoken region_name $REGION_NAME
iniset /etc/monasca/api-config.conf keystone_authtoken project_name "admin"
iniset /etc/monasca/api-config.conf keystone_authtoken password $ADMIN_PASSWORD
sed -e "
s|%MONASCA_API_SERVICE_HOST%|$MONASCA_API_SERVICE_HOST|g;
s|%MONASCA_API_SERVICE_PORT%|$MONASCA_API_SERVICE_PORT|g;
s|%API_WORKERS%|$API_WORKERS|g;
" -i /etc/monasca/api-config.ini
sudo chown mon-api:root /etc/monasca/api-config.conf
sudo chmod 0660 /etc/monasca/api-config.conf
sudo ln -sf /etc/monasca/api-config.conf /etc/api-config.conf
sudo chown mon-api:root /etc/monasca/api-logging.conf
sudo chmod 0660 /etc/monasca/api-logging.conf
sudo ln -sf /etc/monasca/api-logging.conf /etc/api-logging.conf
sudo chown mon-api:root /etc/monasca/api-config.ini
sudo chmod 0660 /etc/monasca/api-config.ini
sudo ln -sf /etc/monasca/api-config.ini /etc/api-config.ini
}
function stop_monasca_api_python {
if is_service_enabled monasca-api; then
stop_process "monasca-api" || true
fi
}
function clean_monasca_api_java {
@ -938,29 +936,11 @@ function clean_monasca_api_python {
echo_summary "Clean Monasca monasca_api_python"
sudo systemctl disable monasca-api
sudo rm /etc/systemd/system/monasca-api.service
sudo rm /etc/api-config.conf
sudo rm /etc/monasca/api-config.conf
sudo rm /etc/api-logging.conf
sudo rm /etc/monasca/api-logging.conf
sudo rm /etc/api-config.ini
sudo rm /etc/monasca/api-config.ini
sudo rm -rf /var/log/monasca/api
sudo rm /var/log/upstart/monasca-api.log*
sudo rm -rf /opt/monasca-api
sudo userdel mon-api
sudo rm -rf /etc/monasca/api-config.conf
sudo rm -rf /etc/monasca/api-logging.conf
sudo rm -rf /etc/monasca/api-config.ini
sudo rm -rf $MON_API_GATE_CONFIGURATION_DIR
sudo rm -rf $MONASCA_API_LOG_DIR
if is_service_enabled postgresql; then
apt_get -y purge libpq-dev
@ -970,6 +950,28 @@ function clean_monasca_api_python {
}
function start_monasca_api {
if [[ "${MONASCA_API_IMPLEMENTATION_LANG,,}" == 'java' ]]; then
start_service monasca-api || restart_service monasca-api
elif [[ "${MONASCA_API_IMPLEMENTATION_LANG,,}" == 'python' ]]; then
start_monasca_api_python
fi
}
function stop_monasca_api {
if [[ "${MONASCA_API_IMPLEMENTATION_LANG,,}" == 'java' ]]; then
stop_service monasca-api || true
elif [[ "${MONASCA_API_IMPLEMENTATION_LANG,,}" == 'python' ]]; then
stop_monasca_api_python
fi
}
function configure_monasca_api {
if [[ "${MONASCA_API_IMPLEMENTATION_LANG,,}" == 'python' ]]; then
configure_monasca_api_python
fi
#NOTE(basiaka) Refactor of monasca-api in Java version will be handled in another change
}
function install_monasca_persister_java {
echo_summary "Install Monasca monasca_persister_java"
@ -1047,52 +1049,39 @@ function install_monasca_persister_python {
git_clone $MONASCA_PERSISTER_REPO $MONASCA_PERSISTER_DIR $MONASCA_PERSISTER_BRANCH
sudo mkdir -p /opt/monasca-persister || true
sudo chown $STACK_USER:monasca /opt/monasca-persister
(cd /opt/monasca-persister ; virtualenv .)
PIP_VIRTUAL_ENV=/opt/monasca-persister
setup_install $MONASCA_COMMON_DIR
setup_install $MONASCA_PERSISTER_DIR
install_monasca_common
if [[ "${MONASCA_METRICS_DB,,}" == 'influxdb' ]]; then
pip_install_gr influxdb
elif [[ "${MONASCA_METRICS_DB,,}" == 'cassandra' ]]; then
pip_install_gr cassandra-driver
fi
unset PIP_VIRTUAL_ENV
sudo useradd --system -g monasca mon-persister || true
sudo mkdir -p /var/log/monasca || true
sudo chown root:monasca /var/log/monasca
sudo chmod 0755 /var/log/monasca
sudo mkdir -p /var/log/monasca/persister || true
sudo chown root:monasca /var/log/monasca/persister
sudo chmod 0775 /var/log/monasca/persister
sudo mkdir -p /etc/monasca || true
sudo chown root:monasca /etc/monasca
sudo cp -f "${MONASCA_API_DIR}"/devstack/files/monasca-persister/python/persister.conf /etc/monasca/persister.conf
sudo cp -f "${MONASCA_API_DIR}"/devstack/files/monasca-persister/python/persister-logging.conf /etc/monasca/persister-logging.conf
sudo chown mon-persister:monasca /etc/monasca/persister.conf
sudo chmod 0640 /etc/monasca/persister.conf
if [[ ${SERVICE_HOST} ]]; then
@ -1209,11 +1198,9 @@ function install_monasca_notification {
pip_install_gr sqlalchemy
fi
setup_install $MONASCA_COMMON_DIR
setup_install $MONASCA_STATSD_DIR
setup_install $MONASCA_NOTIFICATION_DIR
install_monasca_common
install_monasca_statsd
unset PIP_VIRTUAL_ENV
@ -1837,25 +1824,23 @@ function download_file {
}
# Allows this script to be called directly outside of
# the devstack infrastructure code. Uncomment to use.
#if [[ $(type -t is_service_enabled) != 'function' ]]; then
#
# function is_service_enabled {
#
# return 0
#
# }
#fi
#if [[ $(type -t echo_summary) != 'function' ]]; then
#
# function echo_summary {
#
# echo "$*"
#
# }
#
#fi
function install_monasca_common {
git_clone $MONASCA_COMMON_REPO $MONASCA_COMMON_DIR $MONASCA_COMMON_BRANCH
setup_dev_lib "monasca-common"
}
function install_monasca_statsd {
git_clone $MONASCA_STATSD_REPO $MONASCA_STATSD_DIR $MONASCA_STATSD_BRANCH
setup_dev_lib "monasca-statsd"
}
function install_gate_config_holder {
sudo install -d -o $STACK_USER $MON_API_GATE_CONFIGURATION_DIR
}
function find_nearest_apache_mirror {
apache_mirror=`curl -s 'https://www.apache.org/dyn/closer.cgi?as_json=1' | jq --raw-output '.preferred'`
}
# check for service enabled
if is_service_enabled monasca; then
@ -1873,7 +1858,7 @@ if is_service_enabled monasca; then
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
# Configure after the other layer 1 and 2 services have been configured
echo_summary "Configuring Monasca"
post_config_monasca
configure_monasca
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
# Initialize and start the Monasca service

View File

@ -156,7 +156,9 @@ GRAFANA_REPO=${GRAFANA_REPO:-"https://github.com/sapcc/grafana.git"}
GRAFANA_BRANCH=${GRAFANA_BRANCH:-"keystone"}
GRAFANA_DIR=${MONASCA_BASE}/grafana
GITDIR["python-monascaclient"]=$MONASCA_CLIENT_DIR
GITDIR["python-monascaclient"]=${MONASCA_CLIENT_DIR}
GITDIR["monasca-common"]=${MONASCA_COMMON_DIR}
GITDIR["monasca-statsd"]=${MONASCA_STATSD_DIR}
# Database settings
MONASCA_DATABASE_USE_ORM=false
@ -175,3 +177,10 @@ MONASCA_API_SERVICE_PORT=${MONASCA_API_SERVICE_PORT:-8070}
MONASCA_API_ADMIN_PORT=${MONASCA_API_ADMIN_PORT:-8081} # for java
MONASCA_API_SERVICE_PROTOCOL=${MONASCA_API_SERVICE_PROTOCOL:-${SERVICE_PROTOCOL}}
MONASCA_API_SERVICE_TIMEOUT=${MONASCA_API_SERVICE_TIMEOUT:-${SERVICE_TIMEOUT}}
MONASCA_API_CONF_DIR=${MONASCA_API_CONF_DIR:-/etc/monasca}
MONASCA_API_CONF=${MONASCA_API_CONF:-$MONASCA_API_CONF_DIR/api-config.conf}
MONASCA_API_PASTE_INI=${MONASCA_API_PASTE_INI:-$MONASCA_API_CONF_DIR/api-config.ini}
MONASCA_API_LOGGING_CONF=${MONASCA_API_LOGGING_CONF:-$MONASCA_API_CONF_DIR/api-logging.conf}
MONASCA_API_CACHE_DIR=${MONASCA_API_CACHE_DIR:-/var/cache/monasca-api}
MONASCA_API_LOG_DIR=${MONASCA_API_LOG_DIR:-/var/log/monasca/api}

View File

@ -16,6 +16,12 @@ paste.filter_factory = oslo_middleware.request_id:RequestId.factory
[server:main]
use = egg:gunicorn#main
host = 127.0.0.1
port = 8082
workers = 1
proc_name = monasca_api
port = 8070
workers = 9
worker-connections = 2000
worker-class = eventlet
timeout = 30
backlog = 2048
keepalive = 2
proc_name = monasca-api
loglevel = DEBUG