Commit ed0ae76a authored by ale's avatar ale

use gunicorn for the login service

parent d4f71167
......@@ -6,14 +6,18 @@
# Required-Stop: $local_fs $remote_fs $syslog $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop the A/I Single-Sign-On server
# Short-Description: A/I Single-Sign-On Server
# Description: Starts and stops the A/I Single-Sign-On server.
### END INIT INFO
DAEMON=/usr/sbin/sso_server
NAME=sso_server
GUNICORN=/usr/bin/gunicorn
GUNICORN_APP="sso_server.wsgi:app"
GUNICORN_OPTS=
RUNDIR=/var/run/sso
LOGDIR=/var/log/sso
PIDFILE=${RUNDIR}/sso_server.pid
PIDFILE=${RUNDIR}/${NAME}.pid
SSO_PORT=5002
USER=ai-sso
NO_START=1
......@@ -25,29 +29,50 @@ check_dirs() {
chown -R ${USER} ${LOGDIR}
}
test -x ${GUNICORN} || exit 0
test ${NO_START} -eq 1 && exit 0
test -e /etc/default/ai-sso-server && . /etc/default/ai-sso-server
test -x ${DAEMON} || exit 0
test ${NO_START} -eq 1 && exit 0
. /lib/lsb/init-functions
GUNICORN_OPTS="
--bind 127.0.0.1:${SSO_PORT}
--worker-class gevent
--daemon --pid ${PIDFILE}
--name ${NAME}
${GUNICORN_OPTS}
"
case "$1" in
start)
echo -n "Starting SSO Server... "
log_daemon_msg "Starting SSO server"
check_dirs
start-stop-daemon --start --pidfile ${PIDFILE} --make-pidfile \
--background --chuid ${USER} --exec ${DAEMON} -- --port=${SSO_PORT}
echo "ok"
start-stop-daemon --start --oknodo \
--pidfile ${PIDFILE} \
--chuid ${USER} \
--exec ${GUNICORN} -- ${GUNICORN_OPTS} ${GUNICORN_APP}
if [ $? -eq 0 ]; then
log_success_msg
else
log_failure_msg
exit 1
fi
;;
stop)
echo -n "Stopping SSO Server... "
start-stop-daemon --stop \
--pidfile ${PIDFILE} && rm -f ${PIDFILE}
echo "ok"
log_daemon_msg "Stopping SSO server"
start-stop-daemon --stop --oknodo --user ${USER} --pidfile ${PIDFILE}
if [ $? -eq 0 ]; then
log_success_msg
else
log_failure_msg
fi
rm -f ${PIDFILE} 2>/dev/null
;;
reload)
echo -n "Reloading SSO Server... "
log_daemon_msg "Reloading SSO server"
kill -HUP `cat ${PIDFILE}`
echo "ok"
log_success_msg
;;
restart)
$0 stop
......@@ -55,7 +80,8 @@ restart)
$0 start
;;
*)
echo -e "Only [start|stop|reload|restart] operation are allowed\n"
echo "Usage: /etc/init.d/ai-sso-server {start|stop|reload|restart}" 1>&2
exit 1
;;
esac
......
ai-sso (2.0.1) unstable; urgency=low
* OTP support.
* Use 'gunicorn' for serving.
-- Autistici/Inventati <debian@autistici.org> Sun, 30 Mar 2014 11:35:20 +0100
ai-sso (2.0) unstable; urgency=low
* Source upgraded to version 2.0.
......
......@@ -21,7 +21,8 @@ Description: A/I SSO Python modules.
Package: ai-sso-server
Architecture: all
Depends: ai-sso, ai-sso-python, python-flask, ${python:Depends}
Depends: ai-sso, ai-sso-python, python-flask, gunicorn,
python-setproctitle, lsb-base, adduser, ${python:Depends}
Description: A/I SSO Server.
The login server for the A/I SSO service.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment