Merge "Handle uwsgi on systemd properly"
This commit is contained in:
commit
602e2e93b6
@ -1482,6 +1482,32 @@ function write_user_unit_file {
|
|||||||
$SYSTEMCTL daemon-reload
|
$SYSTEMCTL daemon-reload
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function write_uwsgi_user_unit_file {
|
||||||
|
local service=$1
|
||||||
|
local command="$2"
|
||||||
|
local group=$3
|
||||||
|
local user=$4
|
||||||
|
local unitfile="$SYSTEMD_DIR/$service"
|
||||||
|
mkdir -p $SYSTEMD_DIR
|
||||||
|
|
||||||
|
iniset -sudo $unitfile "Unit" "Description" "Devstack $service"
|
||||||
|
iniset -sudo $unitfile "Service" "User" "$user"
|
||||||
|
iniset -sudo $unitfile "Service" "ExecStart" "$command"
|
||||||
|
iniset -sudo $unitfile "Service" "Type" "notify"
|
||||||
|
iniset -sudo $unitfile "Service" "KillSignal" "SIGQUIT"
|
||||||
|
iniset -sudo $unitfile "Service" "Restart" "Always"
|
||||||
|
iniset -sudo $unitfile "Service" "NotifyAccess" "all"
|
||||||
|
iniset -sudo $unitfile "Service" "RestartForceExitStatus" "100"
|
||||||
|
|
||||||
|
if [[ -n "$group" ]]; then
|
||||||
|
iniset -sudo $unitfile "Service" "Group" "$group"
|
||||||
|
fi
|
||||||
|
iniset -sudo $unitfile "Install" "WantedBy" "multi-user.target"
|
||||||
|
|
||||||
|
# changes to existing units sometimes need a refresh
|
||||||
|
$SYSTEMCTL daemon-reload
|
||||||
|
}
|
||||||
|
|
||||||
function _run_under_systemd {
|
function _run_under_systemd {
|
||||||
local service=$1
|
local service=$1
|
||||||
local command="$2"
|
local command="$2"
|
||||||
@ -1489,7 +1515,11 @@ function _run_under_systemd {
|
|||||||
local systemd_service="devstack@$service.service"
|
local systemd_service="devstack@$service.service"
|
||||||
local group=$3
|
local group=$3
|
||||||
local user=${4:-$STACK_USER}
|
local user=${4:-$STACK_USER}
|
||||||
|
if [[ "$command" =~ "uwsgi" ]] ; then
|
||||||
|
write_uwsgi_user_unit_file $systemd_service "$cmd" "$group" "$user"
|
||||||
|
else
|
||||||
write_user_unit_file $systemd_service "$cmd" "$group" "$user"
|
write_user_unit_file $systemd_service "$cmd" "$group" "$user"
|
||||||
|
fi
|
||||||
|
|
||||||
$SYSTEMCTL enable $systemd_service
|
$SYSTEMCTL enable $systemd_service
|
||||||
$SYSTEMCTL start $systemd_service
|
$SYSTEMCTL start $systemd_service
|
||||||
|
@ -604,8 +604,8 @@ function start_keystone {
|
|||||||
# TODO(sdague): we should really get down to a single keystone here
|
# TODO(sdague): we should really get down to a single keystone here
|
||||||
enable_service key-p
|
enable_service key-p
|
||||||
enable_service key-a
|
enable_service key-a
|
||||||
run_process key-p "$KEYSTONE_BIN_DIR/uwsgi $KEYSTONE_PUBLIC_UWSGI_FILE" ""
|
run_process key-p "$KEYSTONE_BIN_DIR/uwsgi --ini $KEYSTONE_PUBLIC_UWSGI_FILE" ""
|
||||||
run_process key-a "$KEYSTONE_BIN_DIR/uwsgi $KEYSTONE_ADMIN_UWSGI_FILE" ""
|
run_process key-a "$KEYSTONE_BIN_DIR/uwsgi --ini $KEYSTONE_ADMIN_UWSGI_FILE" ""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Waiting for keystone to start..."
|
echo "Waiting for keystone to start..."
|
||||||
@ -638,6 +638,9 @@ function stop_keystone {
|
|||||||
if [ "$KEYSTONE_DEPLOY" == "mod_wsgi" ]; then
|
if [ "$KEYSTONE_DEPLOY" == "mod_wsgi" ]; then
|
||||||
disable_apache_site keystone
|
disable_apache_site keystone
|
||||||
restart_apache_server
|
restart_apache_server
|
||||||
|
else
|
||||||
|
stop_process key-p
|
||||||
|
stop_process key-a
|
||||||
fi
|
fi
|
||||||
# Kill the Keystone screen window
|
# Kill the Keystone screen window
|
||||||
stop_process key
|
stop_process key
|
||||||
|
Loading…
Reference in New Issue
Block a user