Devstack: Add devstack plugin for higgins
The goal is to enable higgins-api and higgins-conductor service Currently swift service in devstack repo using "-s" to test swift service is enable or not, "higgins-*" will be known as swift service, devstack will then install swift too, swift team is woking on fix that in devstack. BTW, higgins-api port chosed as '9517'. Test passed locally. Change-Id: Ie12cab26a4916c4232b92c04e53098fc450a0a44
This commit is contained in:
parent
1db55ad269
commit
b58a8b87a1
1
.gitignore
vendored
1
.gitignore
vendored
@ -15,7 +15,6 @@ var
|
||||
sdist
|
||||
develop-eggs
|
||||
.installed.cfg
|
||||
lib
|
||||
lib64
|
||||
|
||||
# Installer logs
|
||||
|
22
devstack/README.rst
Normal file
22
devstack/README.rst
Normal file
@ -0,0 +1,22 @@
|
||||
====================
|
||||
DevStack Integration
|
||||
====================
|
||||
|
||||
This directory contains the files necessary to integrate higgins with devstack.
|
||||
|
||||
Refer the quickstart guide at
|
||||
http://docs.openstack.org/developer/higgins/dev/dev-quickstart.html
|
||||
for more information on using devstack and higgins.
|
||||
|
||||
To install higgins into devstack, add the following settings to enable the
|
||||
higgins plugin::
|
||||
|
||||
cat > /opt/stack/devstack/local.conf << END
|
||||
[[local|localrc]]
|
||||
enable_plugin higgins https://git.openstack.org/openstack/higgins master
|
||||
END
|
||||
|
||||
Then run devstack normally::
|
||||
|
||||
cd /opt/stack/devstack
|
||||
./stack.sh
|
268
devstack/lib/higgins
Normal file
268
devstack/lib/higgins
Normal file
@ -0,0 +1,268 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# lib/higgins
|
||||
# Functions to control the configuration and operation of the **higgins** service
|
||||
|
||||
# Dependencies:
|
||||
#
|
||||
# - ``functions`` file
|
||||
# - ``DEST``, ``DATA_DIR``, ``STACK_USER`` must be defined
|
||||
# - ``SERVICE_{TENANT_NAME|PASSWORD}`` must be defined
|
||||
|
||||
# ``stack.sh`` calls the entry points in this order:
|
||||
#
|
||||
# - install_higgins
|
||||
# - configure_higgins
|
||||
# - create_higgins_conf
|
||||
# - create_higgins_accounts
|
||||
# - init_higgins
|
||||
# - start_higgins
|
||||
# - stop_higgins
|
||||
# - cleanup_higgins
|
||||
|
||||
# Save trace setting
|
||||
XTRACE=$(set +o | grep xtrace)
|
||||
set +o xtrace
|
||||
|
||||
|
||||
# Defaults
|
||||
# --------
|
||||
|
||||
# Set up default directories
|
||||
HIGGINS_REPO=${HIGGINS_REPO:-${GIT_BASE}/openstack/higgins.git}
|
||||
HIGGINS_BRANCH=${HIGGINS_BRANCH:-master}
|
||||
HIGGINS_DIR=$DEST/HIGGINS
|
||||
|
||||
HIGGINS_STATE_PATH=${HIGGINS_STATE_PATH:=$DATA_DIR/higgins}
|
||||
HIGGINS_AUTH_CACHE_DIR=${HIGGINS_AUTH_CACHE_DIR:-/var/cache/higgins}
|
||||
|
||||
HIGGINS_CONF_DIR=/etc/higgins
|
||||
HIGGINS_CONF=$HIGGINS_CONF_DIR/higgins.conf
|
||||
HIGGINS_POLICY_JSON=$HIGGINS_CONF_DIR/policy.json
|
||||
HIGGINS_API_PASTE=$HIGGINS_CONF_DIR/api-paste.ini
|
||||
|
||||
if is_ssl_enabled_service "higgins" || is_service_enabled tls-proxy; then
|
||||
HIGGINS_SERVICE_PROTOCOL="https"
|
||||
fi
|
||||
|
||||
# Public facing bits
|
||||
HIGGINS_SERVICE_HOST=${HIGGINS_SERVICE_HOST:-$HOST_IP}
|
||||
HIGGINS_SERVICE_PORT=${HIGGINS_SERVICE_PORT:-9517}
|
||||
HIGGINS_SERVICE_PORT_INT=${HIGGINS_SERVICE_PORT_INT:-19517}
|
||||
HIGGINS_SERVICE_PROTOCOL=${HIGGINS_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL}
|
||||
|
||||
HIGGINS_TRUSTEE_DOMAIN_ADMIN_PASSWORD=${HIGGINS_TRUSTEE_DOMAIN_ADMIN_PASSWORD:-secret}
|
||||
|
||||
# Support entry points installation of console scripts
|
||||
if [[ -d $HIGGINS_DIR/bin ]]; then
|
||||
HIGGINS_BIN_DIR=$HIGGINS_DIR/bin
|
||||
else
|
||||
HIGGINS_BIN_DIR=$(get_python_exec_prefix)
|
||||
fi
|
||||
|
||||
# Functions
|
||||
# ---------
|
||||
|
||||
# Test if any higgins services are enabled
|
||||
# is_higgins_enabled
|
||||
function is_higgins_enabled {
|
||||
[[ ,${ENABLED_SERVICES} =~ ,"higgins-" ]] && return 0
|
||||
return 1
|
||||
}
|
||||
# cleanup_higgins() - Remove residual data files, anything left over from previous
|
||||
# runs that a clean run would need to clean up
|
||||
function cleanup_higgins {
|
||||
sudo rm -rf $HIGGINS_STATE_PATH $HIGGINS_AUTH_CACHE_DIR
|
||||
}
|
||||
|
||||
# configure_higgins() - Set config files, create data dirs, etc
|
||||
function configure_higgins {
|
||||
# Put config files in ``/etc/higgins`` for everyone to find
|
||||
if [[ ! -d $HIGGINS_CONF_DIR ]]; then
|
||||
sudo mkdir -p $HIGGINS_CONF_DIR
|
||||
sudo chown $STACK_USER $HIGGINS_CONF_DIR
|
||||
fi
|
||||
|
||||
install_default_policy higgins
|
||||
# Rebuild the config file from scratch
|
||||
create_higgins_conf
|
||||
|
||||
create_api_paste_conf
|
||||
|
||||
}
|
||||
|
||||
# create_higgins_accounts() - Set up common required HIGGINS accounts
|
||||
#
|
||||
# Project User Roles
|
||||
# ------------------------------------------------------------------
|
||||
# SERVICE_PROJECT_NAME higgins service
|
||||
function create_higgins_accounts {
|
||||
|
||||
create_service_user "higgins" "admin"
|
||||
|
||||
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
|
||||
|
||||
local higgins_service=$(get_or_create_service "HIGGINS" \
|
||||
"container" "Container As Service")
|
||||
get_or_create_endpoint $higgins_service \
|
||||
"$REGION_NAME" \
|
||||
"$HIGGINS_SERVICE_PROTOCOL://$HIGGINS_SERVICE_HOST:$HIGGINS_SERVICE_PORT/v1" \
|
||||
"$HIGGINS_SERVICE_PROTOCOL://$HIGGINS_SERVICE_HOST:$HIGGINS_SERVICE_PORT/v1" \
|
||||
"$HIGGINS_SERVICE_PROTOCOL://$HIGGINS_SERVICE_HOST:$HIGGINS_SERVICE_PORT/v1"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
# create_higgins_conf() - Create a new higgins.conf file
|
||||
function create_higgins_conf {
|
||||
|
||||
# (Re)create ``higgins.conf``
|
||||
rm -f $HIGGINS_CONF
|
||||
iniset $HIGGINS_CONF DEFAULT debug "$ENABLE_DEBUG_LOG_LEVEL"
|
||||
iniset $HIGGINS_CONF oslo_messaging_rabbit rabbit_userid $RABBIT_USERID
|
||||
iniset $HIGGINS_CONF oslo_messaging_rabbit rabbit_password $RABBIT_PASSWORD
|
||||
iniset $HIGGINS_CONF oslo_messaging_rabbit rabbit_host $RABBIT_HOST
|
||||
|
||||
iniset $HIGGINS_CONF database connection `database_connection_url higgins`
|
||||
iniset $HIGGINS_CONF api host "$HIGGINS_SERVICE_HOST"
|
||||
iniset $HIGGINS_CONF api port "$HIGGINS_SERVICE_PORT"
|
||||
|
||||
iniset $HIGGINS_CONF oslo_policy policy_file $HIGGINS_POLICY_JSON
|
||||
|
||||
iniset $HIGGINS_CONF keystone_auth auth_type password
|
||||
iniset $HIGGINS_CONF keystone_auth username higgins
|
||||
iniset $HIGGINS_CONF keystone_auth password $SERVICE_PASSWORD
|
||||
iniset $HIGGINS_CONF keystone_auth project_name $SERVICE_PROJECT_NAME
|
||||
iniset $HIGGINS_CONF keystone_auth project_domain_id default
|
||||
iniset $HIGGINS_CONF keystone_auth user_domain_id default
|
||||
|
||||
# FIXME(pauloewerton): keystone_authtoken section is deprecated. Remove it
|
||||
# after deprecation period.
|
||||
iniset $HIGGINS_CONF keystone_authtoken admin_user higgins
|
||||
iniset $HIGGINS_CONF keystone_authtoken admin_password $SERVICE_PASSWORD
|
||||
iniset $HIGGINS_CONF keystone_authtoken admin_tenant_name $SERVICE_PROJECT_NAME
|
||||
|
||||
configure_auth_token_middleware $HIGGINS_CONF higgins $HIGGINS_AUTH_CACHE_DIR
|
||||
|
||||
iniset $HIGGINS_CONF keystone_auth auth_url $KEYSTONE_SERVICE_URI/v3
|
||||
iniset $HIGGINS_CONF keystone_authtoken auth_uri \
|
||||
${KEYSTONE_SERVICE_PROTOCOL}://${HOST_IP}:${KEYSTONE_SERVICE_PORT}/v3
|
||||
iniset $HIGGINS_CONF keystone_authtoken auth_version v3
|
||||
|
||||
if is_fedora || is_suse; then
|
||||
# higgins defaults to /usr/local/bin, but fedora and suse pip like to
|
||||
# install things in /usr/bin
|
||||
iniset $HIGGINS_CONF DEFAULT bindir "/usr/bin"
|
||||
fi
|
||||
|
||||
if [ -n "$HIGGINS_STATE_PATH" ]; then
|
||||
iniset $HIGGINS_CONF DEFAULT state_path "$HIGGINS_STATE_PATH"
|
||||
iniset $HIGGINS_CONF oslo_concurrency lock_path "$HIGGINS_STATE_PATH"
|
||||
fi
|
||||
|
||||
if [ "$SYSLOG" != "False" ]; then
|
||||
iniset $HIGGINS_CONF DEFAULT use_syslog "True"
|
||||
fi
|
||||
|
||||
# Format logging
|
||||
if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then
|
||||
setup_colorized_logging $HIGGINS_CONF DEFAULT
|
||||
else
|
||||
# Show user_name and project_name instead of user_id and project_id
|
||||
iniset $HIGGINS_CONF DEFAULT logging_context_format_string "%(asctime)s.%(msecs)03d %(levelname)s %(name)s [%(request_id)s %(user_name)s %(project_name)s] %(instance)s%(message)s"
|
||||
fi
|
||||
|
||||
# Register SSL certificates if provided
|
||||
if is_ssl_enabled_service higgins; then
|
||||
ensure_certificates higgins
|
||||
|
||||
iniset $HIGGINS_CONF DEFAULT ssl_cert_file "$HIGGINS_SSL_CERT"
|
||||
iniset $HIGGINS_CONF DEFAULT ssl_key_file "$HIGGINS_SSL_KEY"
|
||||
|
||||
iniset $HIGGINS_CONF DEFAULT enabled_ssl_apis "$HIGGINS_ENABLED_APIS"
|
||||
fi
|
||||
}
|
||||
|
||||
function create_api_paste_conf {
|
||||
# copy api_paste.ini
|
||||
cp $HIGGINS_DIR/etc/higgins/api-paste.ini $HIGGINS_API_PASTE
|
||||
}
|
||||
|
||||
# create_higgins_cache_dir() - Part of the init_HIGGINS() process
|
||||
function create_higgins_cache_dir {
|
||||
# Create cache dir
|
||||
sudo mkdir -p $HIGGINS_AUTH_CACHE_DIR
|
||||
sudo chown $STACK_USER $HIGGINS_AUTH_CACHE_DIR
|
||||
rm -f $HIGGINS_AUTH_CACHE_DIR/*
|
||||
}
|
||||
|
||||
|
||||
# init_higgins() - Initialize databases, etc.
|
||||
function init_higgins {
|
||||
# Only do this step once on the API node for an entire cluster.
|
||||
if is_service_enabled $DATABASE_BACKENDS && is_service_enabled higgins-api; then
|
||||
# (Re)create higgins database
|
||||
recreate_database higgins
|
||||
|
||||
# Migrate higgins database
|
||||
# $HIGGINS_BIN_DIR/higgins-db-manage upgrade
|
||||
fi
|
||||
create_higgins_cache_dir
|
||||
}
|
||||
|
||||
# install_higginsclient() - Collect source and prepare
|
||||
function install_higginsclient {
|
||||
if use_library_from_git "python-higginsclient"; then
|
||||
echo "we don't have CLI yet.."
|
||||
#git_clone_by_name "python-higginsclient"
|
||||
#setup_dev_lib "python-higginsclient"
|
||||
fi
|
||||
}
|
||||
|
||||
# install_higgins() - Collect source and prepare
|
||||
function install_higgins {
|
||||
git_clone $HIGGINS_REPO $HIGGINS_DIR $HIGGINS_BRANCH
|
||||
setup_develop $HIGGINS_DIR
|
||||
}
|
||||
|
||||
# start_higgins_api() - Start the API process ahead of other things
|
||||
function start_higgins_api {
|
||||
# Get right service port for testing
|
||||
local service_port=$HIGGINS_SERVICE_PORT
|
||||
local service_protocol=$HIGGINS_SERVICE_PROTOCOL
|
||||
if is_service_enabled tls-proxy; then
|
||||
service_port=$HIGGINS_SERVICE_PORT_INT
|
||||
service_protocol="http"
|
||||
fi
|
||||
|
||||
run_process higgins-api "$HIGGINS_BIN_DIR/higgins-api"
|
||||
echo "Waiting for higgins-api to start..."
|
||||
if ! wait_for_service $SERVICE_TIMEOUT $service_protocol://$HIGGINS_SERVICE_HOST:$service_port; then
|
||||
die $LINENO "higgins-api did not start"
|
||||
fi
|
||||
|
||||
# Start proxies if enabled
|
||||
if is_service_enabled tls-proxy; then
|
||||
start_tls_proxy '*' $HIGGINS_SERVICE_PORT $HIGGINS_SERVICE_HOST $HIGGINS_SERVICE_PORT_INT &
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# start_higgins() - Start running processes, including screen
|
||||
function start_higgins {
|
||||
|
||||
# ``run_process`` checks ``is_service_enabled``, it is not needed here
|
||||
start_higgins_api
|
||||
run_process higgins-conductor "$HIGGINS_BIN_DIR/higgins-conductor"
|
||||
}
|
||||
|
||||
# stop_higgins() - Stop running processes (non-screen)
|
||||
function stop_higgins {
|
||||
for serv in higgins-api higgins-conductor; do
|
||||
stop_process $serv
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
# Restore xtrace
|
||||
$XTRACE
|
49
devstack/plugin.sh
Executable file
49
devstack/plugin.sh
Executable file
@ -0,0 +1,49 @@
|
||||
# higgins - Devstack extras script to install higgins
|
||||
|
||||
# Save trace setting
|
||||
XTRACE=$(set +o | grep xtrace)
|
||||
set -o xtrace
|
||||
|
||||
echo_summary "higgins's plugin.sh was called..."
|
||||
source $DEST/higgins/devstack/lib/higgins
|
||||
(set -o posix; set)
|
||||
|
||||
if is_service_enabled higgins-api higgins-conductor; then
|
||||
if [[ "$1" == "stack" && "$2" == "install" ]]; then
|
||||
echo_summary "Installing higgins"
|
||||
install_higgins
|
||||
|
||||
# TODO
|
||||
# LIBS_FROM_GIT="${LIBS_FROM_GIT},python-higginsclient"
|
||||
# install_higginsclient
|
||||
|
||||
cleanup_higgins
|
||||
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
|
||||
echo_summary "Configuring higgins"
|
||||
configure_higgins
|
||||
|
||||
if is_service_enabled key; then
|
||||
create_higgins_accounts
|
||||
fi
|
||||
|
||||
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
|
||||
# Initialize higgins
|
||||
init_higgins
|
||||
|
||||
# Start the higgins API and higgins conductor
|
||||
echo_summary "Starting higgins"
|
||||
start_higgins
|
||||
|
||||
fi
|
||||
|
||||
if [[ "$1" == "unstack" ]]; then
|
||||
stop_higgins
|
||||
fi
|
||||
|
||||
if [[ "$1" == "clean" ]]; then
|
||||
cleanup_higgins
|
||||
fi
|
||||
fi
|
||||
|
||||
# Restore xtrace
|
||||
$XTRACE
|
20
devstack/settings
Normal file
20
devstack/settings
Normal file
@ -0,0 +1,20 @@
|
||||
# Devstack settings
|
||||
|
||||
## Modify to your environment
|
||||
# FLOATING_RANGE=192.168.1.224/27
|
||||
# PUBLIC_NETWORK_GATEWAY=192.168.1.225
|
||||
# PUBLIC_INTERFACE=em1
|
||||
# FIXED_RANGE=10.0.0.0/24
|
||||
## Log all output to files
|
||||
# LOGFILE=$HOME/devstack.log
|
||||
# SCREEN_LOGDIR=$HOME/logs
|
||||
## Neutron settings
|
||||
# Q_USE_SECGROUP=True
|
||||
# ENABLE_TENANT_VLANS=True
|
||||
# TENANT_VLAN_RANGE=
|
||||
# PHYSICAL_NETWORK=public
|
||||
# OVS_PHYSICAL_BRIDGE=br-ex
|
||||
|
||||
# Enable Higgins services
|
||||
enable_service higgins-api
|
||||
enable_service higgins-cond
|
Loading…
x
Reference in New Issue
Block a user