Install sticks, client and dashboard with devstack
Installation of sticks, python-sticksclient and sticks-dashboard if sticks-api and sticks-agent are put in local file of devstack Change-Id: Iea3254b635e3e6a10c96cac8908d665deed3cfc8
This commit is contained in:
parent
6827bdb48d
commit
09d39f34e3
0
contrib/devstack/README.rst
Normal file
0
contrib/devstack/README.rst
Normal file
39
contrib/devstack/extras.d/60-sticks.sh
Normal file
39
contrib/devstack/extras.d/60-sticks.sh
Normal file
@ -0,0 +1,39 @@
|
||||
# sticks.sh - Devstack extras script to install Sticks
|
||||
|
||||
if is_service_enabled sticks-api sticks-agent; then
|
||||
if [[ "$1" == "source" ]]; then
|
||||
# Initial source
|
||||
source $TOP_DIR/lib/sticks
|
||||
elif [[ "$1" == "stack" && "$2" == "install" ]]; then
|
||||
echo_summary "Installing Sticks"
|
||||
install_sticks
|
||||
install_sticksclient
|
||||
|
||||
if is_service_enabled sticks-dashboard; then
|
||||
install_sticksdashboard
|
||||
fi
|
||||
cleanup_sticks
|
||||
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
|
||||
echo_summary "Configuring Sticks"
|
||||
configure_sticks
|
||||
if is_service_enabled sticks-dashboard; then
|
||||
configure_sticksdashboard
|
||||
fi
|
||||
if is_service_enabled key; then
|
||||
create_sticks_accounts
|
||||
fi
|
||||
|
||||
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
|
||||
# Initialize sticks
|
||||
echo_summary "Initializing Sticks"
|
||||
init_sticks
|
||||
|
||||
# Start the Sticks API and Sticks agent components
|
||||
echo_summary "Starting Sticks"
|
||||
start_sticks
|
||||
fi
|
||||
|
||||
if [[ "$1" == "unstack" ]]; then
|
||||
stop_sticks
|
||||
fi
|
||||
fi
|
222
contrib/devstack/lib/sticks
Normal file
222
contrib/devstack/lib/sticks
Normal file
@ -0,0 +1,222 @@
|
||||
# lib/sticks
|
||||
# Install and start **Sticks** service
|
||||
|
||||
# To enable a minimal set of Sticks services:
|
||||
# - add the following to localrc:
|
||||
#
|
||||
# enable_service sticks-api sticks-agent
|
||||
#
|
||||
# Dependencies:
|
||||
# - functions
|
||||
# - OS_AUTH_URL for auth in api
|
||||
# - DEST, HORIZON_DIR, DATA_DIR set to the destination directory
|
||||
# - SERVICE_PASSWORD, SERVICE_TENANT_NAME for auth in api
|
||||
# - IDENTITY_API_VERSION for the version of Keystone
|
||||
# - STACK_USER service user
|
||||
|
||||
# stack.sh
|
||||
# ---------
|
||||
# install_sticks
|
||||
# install_sticksclient
|
||||
# configure_sticks
|
||||
# init_sticks
|
||||
# start_sticks
|
||||
# stop_sticks
|
||||
# cleanup_sticks
|
||||
|
||||
# Save trace setting
|
||||
XTRACE=$(set +o | grep xtrace)
|
||||
set +o xtrace
|
||||
|
||||
|
||||
# Defaults
|
||||
# --------
|
||||
|
||||
# Set up default directories
|
||||
STICKS_DIR=$DEST/sticks
|
||||
STICKS_CONF_DIR=/etc/sticks
|
||||
STICKS_CONF=$STICKS_CONF_DIR/sticks.conf
|
||||
STICKS_POLICY=$STICKS_CONF_DIR/policy.json
|
||||
STICKS_API_LOG_DIR=/var/log/sticks
|
||||
STICKS_AUTH_CACHE_DIR=${STICKS_AUTH_CACHE_DIR:-/var/cache/sticks}
|
||||
STICKS_REPORTS_DIR=${DATA_DIR}/sticks/reports
|
||||
STICKS_CLIENT_DIR=$DEST/python-sticksclient
|
||||
STICKS_DASHBOARD_DIR=$DEST/sticks-dashboard
|
||||
|
||||
# Support potential entry-points console scripts
|
||||
if [[ -d $STICKS_DIR/bin ]]; then
|
||||
STICKS_BIN_DIR=$STICKS_DIR/bin
|
||||
else
|
||||
STICKS_BIN_DIR=$(get_python_exec_prefix)
|
||||
fi
|
||||
|
||||
# Set up database backend
|
||||
STICKS_BACKEND=${STICKS_BACKEND:-sqlite}
|
||||
|
||||
# Set sticks repository
|
||||
STICKS_REPO=${STICKS_REPO:-https://github.com/stackforge/sticks.git}
|
||||
STICKS_BRANCH=${STICKS_BRANCH:-master}
|
||||
STICKS_CLIENT_REPO=${STICKS_CLIENT_REPO:-https://github.com/stackforge/python-sticksclient.git}
|
||||
STICKS_CLIENT_BRANCH=${STICKS_CLIENT_BRANCH:-master}
|
||||
STICKS_DASHBOARD_REPO=${STICKS_DASHBOARD_REPO:-https://github.com/stackforge/sticks-dashboard.git}
|
||||
STICKS_DASHBOARD_BRANCH=${STICKS_DASHBOARD_BRANCH:-master}
|
||||
|
||||
# Set Sticks connection info
|
||||
STICKS_SERVICE_HOST=${STICKS_SERVICE_HOST:-$SERVICE_HOST}
|
||||
STICKS_SERVICE_PORT=${STICKS_SERVICE_PORT:-8888}
|
||||
STICKS_SERVICE_HOSTPORT="$STICKS_SERVICE_HOST:$STICKS_SERVICE_PORT"
|
||||
STICKS_SERVICE_PROTOCOL=${STICKS_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL}
|
||||
|
||||
# Set Sticks auth info
|
||||
STICKS_ADMIN_USER=${STICKS_ADMIN_USER:-"admin"}
|
||||
STICKS_ADMIN_PASSWORD=${STICKS_ADMIN_PASSWORD:-$ADMIN_PASSWORD}
|
||||
STICKS_ADMIN_TENANT=${STICKS_ADMIN_TENANT:-"admin"}
|
||||
|
||||
# Tell Tempest this project is present
|
||||
TEMPEST_SERVICES+=,sticks
|
||||
|
||||
|
||||
# Functions
|
||||
# ---------
|
||||
|
||||
# create_sticks_accounts() - Set up common required sticks accounts
|
||||
|
||||
# Tenant User Roles
|
||||
# ------------------------------------------------------------------
|
||||
# service sticks admin # if enabled
|
||||
function create_sticks_accounts {
|
||||
|
||||
SERVICE_TENANT=$(openstack project list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }")
|
||||
ADMIN_ROLE=$(openstack role list | awk "/ admin / { print \$2 }")
|
||||
|
||||
# Sticks
|
||||
if [[ "$ENABLED_SERVICES" =~ "sticks-api" ]]; then
|
||||
STICKS_USER=$(openstack user create \
|
||||
sticks \
|
||||
--password "$SERVICE_PASSWORD" \
|
||||
--project $SERVICE_TENANT \
|
||||
--email sticks@example.com \
|
||||
| grep " id " | get_field 2)
|
||||
openstack role add \
|
||||
$ADMIN_ROLE \
|
||||
--project $SERVICE_TENANT \
|
||||
--user $STICKS_USER
|
||||
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
|
||||
STICKS_SERVICE=$(openstack service create \
|
||||
sticks \
|
||||
--type=helpdesk \
|
||||
--description="Helpdesk service" \
|
||||
| grep " id " | get_field 2)
|
||||
openstack endpoint create \
|
||||
$STICKS_SERVICE \
|
||||
--region RegionOne \
|
||||
--publicurl "$STICKS_SERVICE_PROTOCOL://$STICKS_SERVICE_HOSTPORT" \
|
||||
--adminurl "$STICKS_SERVICE_PROTOCOL://$STICKS_SERVICE_HOSTPORT" \
|
||||
--internalurl "$STICKS_SERVICE_PROTOCOL://$STICKS_SERVICE_HOSTPORT"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Test if any Sticks services are enabled
|
||||
# is_sticks_enabled
|
||||
function is_sticks_enabled {
|
||||
[[ ,${ENABLED_SERVICES} =~ ,"sticks-" ]] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
# cleanup_sticks() - Remove residual data files, anything left over from previous
|
||||
# runs that a clean run would need to clean up
|
||||
function cleanup_sticks {
|
||||
# Clean up dirs
|
||||
rm -rf $STICKS_AUTH_CACHE_DIR/*
|
||||
rm -rf $STICKS_CONF_DIR/*
|
||||
}
|
||||
|
||||
# configure_sticks() - Set config files, create data dirs, etc
|
||||
function configure_sticks {
|
||||
setup_develop $STICKS_DIR
|
||||
|
||||
sudo mkdir -m 755 -p $STICKS_CONF_DIR
|
||||
sudo chown $STACK_USER $STICKS_CONF_DIR
|
||||
|
||||
sudo mkdir -m 755 -p $STICKS_API_LOG_DIR
|
||||
sudo chown $STACK_USER $STICKS_API_LOG_DIR
|
||||
|
||||
cp $STICKS_DIR$STICKS_CONF.sample $STICKS_CONF
|
||||
cp $STICKS_DIR$STICKS_POLICY $STICKS_POLICY
|
||||
|
||||
# Default
|
||||
iniset $STICKS_CONF DEFAULT verbose True
|
||||
iniset $STICKS_CONF DEFAULT debug "$ENABLE_DEBUG_LOG_LEVEL"
|
||||
iniset $STICKS_CONF DEFAULT sql_connection `database_connection_url sticks`
|
||||
|
||||
# auth
|
||||
iniset $STICKS_CONF keystone_authtoken auth_uri "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:5000/v2.0/"
|
||||
iniset $STICKS_CONF keystone_authtoken admin_user sticks
|
||||
iniset $STICKS_CONF keystone_authtoken admin_password $SERVICE_PASSWORD
|
||||
iniset $STICKS_CONF keystone_authtoken admin_tenant_name $SERVICE_TENANT_NAME
|
||||
iniset $STICKS_CONF keystone_authtoken region $REGION_NAME
|
||||
iniset $STICKS_CONF keystone_authtoken auth_host $KEYSTONE_AUTH_HOST
|
||||
iniset $STICKS_CONF keystone_authtoken auth_protocol $KEYSTONE_AUTH_PROTOCOL
|
||||
iniset $STICKS_CONF keystone_authtoken auth_port $KEYSTONE_AUTH_PORT
|
||||
iniset $STICKS_CONF keystone_authtoken signing_dir $STICKS_AUTH_CACHE_DIR
|
||||
}
|
||||
|
||||
# configure_sticksdashboard()
|
||||
function configure_sticksdashboard {
|
||||
ln -s $STICKS_DASHBOARD_DIR/_sticks.py.example $HORIZON_DIR/openstack_dashboard/local/enabled/_60_sticks.py
|
||||
}
|
||||
|
||||
# init_sticks() - Initialize Sticks database
|
||||
function init_sticks {
|
||||
# Delete existing cache
|
||||
sudo rm -rf $STICKS_AUTH_CACHE_DIR
|
||||
sudo mkdir -p $STICKS_AUTH_CACHE_DIR
|
||||
sudo chown $STACK_USER $STICKS_AUTH_CACHE_DIR
|
||||
}
|
||||
|
||||
# install_sticks() - Collect source and prepare
|
||||
function install_sticks {
|
||||
git_clone $STICKS_REPO $STICKS_DIR $STICKS_BRANCH
|
||||
setup_develop $STICKS_DIR
|
||||
}
|
||||
|
||||
# install_sticksclient() - Collect source and prepare
|
||||
function install_sticksclient {
|
||||
git_clone $STICKS_CLIENT_REPO $STICKS_CLIENT_DIR $STICKS_CLIENT_BRANCH
|
||||
setup_develop $STICKS_CLIENT_DIR
|
||||
}
|
||||
|
||||
# install_sticksdashboard() - Collect source and prepare
|
||||
function install_sticksdashboard {
|
||||
git_clone $STICKS_DASHBOARD_REPO $STICKS_DASHBOARD_DIR $STICKS_DASHBOARD_BRANCH
|
||||
setup_develop $STICKS_DASHBOARD_DIR
|
||||
}
|
||||
|
||||
|
||||
# start_sticks() - Start running processes, including screen
|
||||
function start_sticks {
|
||||
screen_it sticks-agent "cd $STICKS_DIR; $STICKS_BIN_DIR/sticks-agent --config-file=$STICKS_CONF"
|
||||
screen_it sticks-api "cd $STICKS_DIR; $STICKS_BIN_DIR/sticks-api --config-file=$STICKS_CONF"
|
||||
echo "Waiting for sticks-api ($STICKS_SERVICE_HOST:$STICKS_SERVICE_PORT) to start..."
|
||||
if ! timeout $SERVICE_TIMEOUT sh -c "while ! curl --noproxy '*' -s http://$STICKS_SERVICE_HOST:$STICKS_SERVICE_PORT/v1/ >/dev/null; do sleep 1; done"; then
|
||||
die $LINENO "sticks-api did not start"
|
||||
fi
|
||||
}
|
||||
|
||||
# stop_sticks() - Stop running processes
|
||||
function stop_sticks {
|
||||
# Kill the sticks screen windows
|
||||
for serv in sticks-api sticks-agent; do
|
||||
screen_stop $serv
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
# Restore xtrace
|
||||
$XTRACE
|
||||
|
||||
# Local variables:
|
||||
# mode: shell-script
|
||||
# End:
|
@ -47,5 +47,9 @@ mapping_file = babel.cfg
|
||||
output_file = sticks/locale/sticks.pot
|
||||
|
||||
[entry_points]
|
||||
console_scripts =
|
||||
sticks-api = sticks.cli.api:main
|
||||
sticks-agent = sticks.cli.agent:main
|
||||
|
||||
sticks.tracking=
|
||||
redmine = sticks.tracking.redmine_tracking:RedmineTracking
|
||||
redmine = sticks.tracking.redmine_tracking:RedmineTracking
|
||||
|
Loading…
x
Reference in New Issue
Block a user