51 lines
1.4 KiB
Bash
Executable File
51 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_PYTHON=./$VENV/lib/python2.7/site-packages
|
|
|
|
PATH=/opt/uwsgi:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/etc/$PKG:$PATH
|
|
PKG_DIR=/etc/$PKG
|
|
CONF_FILE=$PKG_DIR/barbican-api.ini
|
|
PASTE_FILE=$PKG_DIR/barbican-api-paste.ini
|
|
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
|
|
CONF_FILE=./etc/$PKG/barbican-api.ini
|
|
PYTHONPATH=$VENV_PYTHON:$PYTHONPATH
|
|
PASTE_FILE=$PWD/etc/$PKG/barbican-api-paste.ini
|
|
OPTS='-H ./'$VENV
|
|
|
|
# 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-api uwsgi process, using init file here: ' $CONF_FILE
|
|
uwsgi --paste config:$PASTE_FILE --ini $CONF_FILE $OPTS
|