barbican/bin/barbican-all
jfwood 2f874cda58 Fix spelling error, and add uWSGI stats server support.
Nick Bimpasis found a spelling error with our README.md file, which this
change request fixes. I've also added support the the uWSGI stats server,
which is required to provide New Relic support for uWSGI monitoring.

Change-Id: Ie545581f9aa7c5a277336c71e56c5350fc47493f
2013-10-23 18:33:44 -05:00

53 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# barbican-api - Script run Cloudkeep's Barbican API app.
PKG=barbican
# For local development, set VENV_PYTHON equal to the path to your virtual environment's site-packages location
VENV=${VENV:-.venv}
VENV_HOME=${VENV_HOME:-$PWD}
VENV_PYTHON=$VENV_HOME/$VENV/lib/python2.7/site-packages
PKG_DIR=/etc/$PKG
CONF_FILE=$PKG_DIR/barbican-api.conf
POLICY_FILE=$PKG_DIR/policy.json
SIGNING_DIR=$PKG_DIR/cache/
OPTS='--daemonize /var/log/barbican/uwsgi.log'
# Configure for a local deployment environment:
if [ ! -f $CONF_FILE ];
then
echo 'Running locally...'
PKG_DIR=$PWD/etc/$PKG
CONF_FILE=./etc/$PKG/barbican-api.conf
PYTHONPATH=$VENV_PYTHON:$PYTHONPATH
OPTS='-H '$VENV_HOME/$VENV' --stats :9314'
# Copy conf file to home directory so oslo.config can find it
LOCAL_CONF_FILE=~/barbican-api.conf
if [ ! -f $LOCAL_CONF_FILE ];
then
cp ./etc/$PKG/barbican-api.conf ~
fi
fi
# TODO: This is breaking deployment...need to analyze.
#if [ ! -f $POLICY_FILE ];
#then
# LOCAL_POLICY_FILE=./etc/$PKG/policy.json
# mkdir -p $PKG_DIR
# sudo cp $LOCAL_POLICY_FILE POLICY_FILE
#fi
#
#if [ ! -f $SIGNING_DIR ];
#then
# echo "making "$SIGNING_DIR
# sudo mkdir -p $SIGNING_DIR
#fi
echo 'Running Barbican uWSGI Emperor '$PKG_DIR/vassals
echo 'Executing uwsgi with these options: '$PKG_DIR/vassals' '$OPTS
uwsgi --master --emperor $PKG_DIR/vassals $OPTS