diff --git a/MANIFEST.in b/MANIFEST.in index d54488f41..e17f95995 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -13,4 +13,5 @@ include openstack-common.conf include muranoapi/db/migrate_repo/README include muranoapi/db/migrate_repo/migrate.cfg include muranoapi/db/migrate_repo/versions/*.sql +recursive-include etc * global-exclude *.pyc diff --git a/etc/init.d/murano-api-el6 b/etc/init.d/murano-api-el6 new file mode 100755 index 000000000..582daeb6f --- /dev/null +++ b/etc/init.d/murano-api-el6 @@ -0,0 +1,102 @@ +#!/bin/sh +# Copyright (c) 2013 Mirantis, 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. +# Author: Igor Yozhikov +# +### BEGIN INIT INFO +# Provides: murano-api +# Required-Start: $network $local_fs $remote_fs $syslog +# Required-Stop: $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: OpenStack Murano API Server +# Description: This startup script launches murano-api service daemon. +### END INIT INFO +# chkconfig: 3 90 10 +# description: This startup script launches murano-api service daemon. +# config: /etc/murano/murano-api.conf, /etc/murano/murano-api-paste.ini +# +PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin +DESC="murano-api" +NAME=murano-api +DAEMON=$(which murano-api) +PIDFILE=/var/run/murano/$NAME.pid +SCRIPTNAME=/etc/init.d/openstack-$NAME +SYSTEM_USER=murano +CONFIG_FILE=/etc/murano/murano-api.conf +LOCKFILE=/var/lock/subsys/$NAME +# Exit if the package is not installed +[ -x $DAEMON ] || exit 5 + +# source function library +. /etc/init.d/functions + +RETVAL=0 + + +start() { + if [ ! -d "/var/run/murano" ]; then + mkdir -p /var/run/murano + chown -R $SYSTEM_USER /var/run/murano + fi + echo -n "Starting $NAME: " + daemon --user $SYSTEM_USER "$DAEMON --config-file=$CONFIG_FILE &>/dev/null & echo \$! > $PIDFILE" + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch $LOCKFILE + return $RETVAL +} + +stop() { + echo -n "Stopping $NAME: " + #killproc $DAEMON -TERM + killproc -p $PIDFILE $DAEMON + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && rm -f $LOCKFILE + return $RETVAL +} + +restart() { + stop + start +} + +rh_status() { + # run checks to determine if the service is running or use generic status + status $DAEMON +} + + +case "$1" in + start) + start + ;; + + stop) + stop + ;; + + restart) + restart + ;; + + status) + rh_status + ;; + *) + echo $"Usage: $0 {start|stop|status|restart}" + exit 2 +esac +exit $? diff --git a/etc/murano-api-paste.ini b/etc/murano/murano-api-paste.ini similarity index 100% rename from etc/murano-api-paste.ini rename to etc/murano/murano-api-paste.ini diff --git a/etc/murano-api.conf b/etc/murano/murano-api.conf similarity index 91% rename from etc/murano-api.conf rename to etc/murano/murano-api.conf index 06d38c9c5..835033f7f 100644 --- a/etc/murano-api.conf +++ b/etc/murano/murano-api.conf @@ -1,9 +1,9 @@ [DEFAULT] # Show more verbose log output (sets INFO log level output) -verbose = True +verbose = False # Show debugging output in logs (sets DEBUG log level output) -debug = True +debug = False # Address to bind the server to bind_host = 0.0.0.0 @@ -11,8 +11,10 @@ bind_host = 0.0.0.0 # Port the bind the server to bind_port = 8082 -# Log to this file. Make sure the user has permissions to write to this file! +# Set up logging. Make sure the user has permissions to write to this file! To use syslog just set use_syslog parameter value to 'True'. log_file = /tmp/murano-api.log +use_syslog=False +syslog-log-facility=LOG_LOCAL0 [database] #A valid SQLAlchemy connection string for the metadata database diff --git a/requirements.txt b/requirements.txt index feef8c7f4..b7c6a9cb4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,7 +15,7 @@ kombu>=2.4.8 pycrypto>=2.6 iso8601>=0.1.8 six>=1.4.1 -netaddr>=0.7.6 +netaddr # Note you will need gcc buildtools installed and must # have installed libxml headers for lxml to be successfully @@ -28,7 +28,6 @@ Paste passlib jsonschema>=1.3.0,!=1.4.0 -python-keystoneclient>=0.4.1 +python-keystoneclient>=0.3.2 oslo.config>=1.2.0 -# Please, revert to murano-common>=x.x.x before release -http://tarballs.openstack.org/murano-common/murano-common-master.tar.gz#egg=muranocommon-0.4 +murano-common==0.4 diff --git a/setup-centos.sh b/setup-centos.sh index 3b417cc7a..02f65e29b 100644 --- a/setup-centos.sh +++ b/setup-centos.sh @@ -25,6 +25,7 @@ GIT_CLONE_DIR=`echo $SERVICE_CONTENT_DIRECTORY | sed -e "s/$SERVICE_SRV_NAME//"` #ETC_CFG_DIR="/etc/$SERVICE_SRV_NAME" ETC_CFG_DIR="/etc/murano" LOG_DIR="/var/log/murano/" +DB_DIR="/var/db/murano/" SERVICE_CONFIG_FILE_PATH="$ETC_CFG_DIR/murano-api.conf" # Functions @@ -164,10 +165,18 @@ CLONE_FROM_GIT=$1 fi # making smaple configs log "Making sample configuration files at \"$ETC_CFG_DIR\"" - for file in `ls $SERVICE_CONTENT_DIRECTORY/etc` + for file in `ls $SERVICE_CONTENT_DIRECTORY/etc/murano` do - cp -f "$SERVICE_CONTENT_DIRECTORY/etc/$file" "$ETC_CFG_DIR/$file.sample" + cp -f "$SERVICE_CONTENT_DIRECTORY/etc/murano/$file" "$ETC_CFG_DIR/$file.sample" done + log "Creating $DB_DIR" + if [ ! -d "$DB_DIR" ]; then + mkdir -p $DB_DIR + if [ $? -ne 0 ];then + log "Can't create \"$DB_DIR\", exiting!!!" + exit 1 + fi + fi } # searching for service executable in path diff --git a/setup.cfg b/setup.cfg index 39274a50e..b9cad108b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -15,14 +15,14 @@ [metadata] name = murano-api -version = 0.3 +version = 0.4 summary = Murano API description-file = README.rst license = Apache License, Version 2.0 author = Mirantis, Inc. author-email = murano-all@lists.openstack.org -home-page = htts://launchpad.net/murano +home-page = https://launchpad.net/murano classifier = Development Status :: 5 - Production/Stable Environment :: OpenStack diff --git a/setup.sh b/setup.sh index bd3e9429d..3e055be85 100644 --- a/setup.sh +++ b/setup.sh @@ -23,6 +23,7 @@ GIT_CLONE_DIR=`echo $SERVICE_CONTENT_DIRECTORY | sed -e "s/$SERVICE_SRV_NAME//"` #ETC_CFG_DIR="/etc/$SERVICE_SRV_NAME" ETC_CFG_DIR="/etc/murano" LOG_DIR="/var/log/murano/" +DB_DIR="/var/db/murano/" SERVICE_CONFIG_FILE_PATH="$ETC_CFG_DIR/murano-api.conf" # Functions @@ -142,10 +143,18 @@ CLONE_FROM_GIT=$1 fi # making sample configs log "Making sample configuration files at \"$ETC_CFG_DIR\"" - for file in $(ls $SERVICE_CONTENT_DIRECTORY/etc) + for file in $(ls $SERVICE_CONTENT_DIRECTORY/etc/murano) do - cp -f "$SERVICE_CONTENT_DIRECTORY/etc/$file" "$ETC_CFG_DIR/$file.sample" + cp -f "$SERVICE_CONTENT_DIRECTORY/etc/murano/$file" "$ETC_CFG_DIR/$file.sample" done + log "Creating $DB_DIR" + if [ ! -d "$DB_DIR" ]; then + mkdir -p $DB_DIR + if [ $? -ne 0 ];then + log "Can't create \"$DB_DIR\", exiting!!!" + exit 1 + fi + fi } # searching for service executable in path diff --git a/test-requirements.txt b/test-requirements.txt index 1160c1bc2..b98be228e 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -10,7 +10,7 @@ nose-exclude openstack.nose_plugin>=0.7 nosehtmloutput>=0.0.3 pep8==1.3.3 -sphinx>=1.1.2 +sphinx>=1.1.2,<1.2 requests>=1.1 testtools>=0.9.32 mock>=1.0