Skip to content
Snippets Groups Projects
Commit ed0ae76a authored by ale's avatar ale
Browse files

use gunicorn for the login service

parent d4f71167
No related branches found
No related tags found
No related merge requests found
...@@ -6,14 +6,18 @@ ...@@ -6,14 +6,18 @@
# Required-Stop: $local_fs $remote_fs $syslog $network # Required-Stop: $local_fs $remote_fs $syslog $network
# Default-Start: 2 3 4 5 # Default-Start: 2 3 4 5
# Default-Stop: 0 1 6 # 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 ### 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 RUNDIR=/var/run/sso
LOGDIR=/var/log/sso LOGDIR=/var/log/sso
PIDFILE=${RUNDIR}/sso_server.pid PIDFILE=${RUNDIR}/${NAME}.pid
SSO_PORT=5002 SSO_PORT=5002
USER=ai-sso USER=ai-sso
NO_START=1 NO_START=1
...@@ -25,29 +29,50 @@ check_dirs() { ...@@ -25,29 +29,50 @@ check_dirs() {
chown -R ${USER} ${LOGDIR} 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 -e /etc/default/ai-sso-server && . /etc/default/ai-sso-server
test -x ${DAEMON} || exit 0 . /lib/lsb/init-functions
test ${NO_START} -eq 1 && exit 0
GUNICORN_OPTS="
--bind 127.0.0.1:${SSO_PORT}
--worker-class gevent
--daemon --pid ${PIDFILE}
--name ${NAME}
${GUNICORN_OPTS}
"
case "$1" in case "$1" in
start) start)
echo -n "Starting SSO Server... " log_daemon_msg "Starting SSO server"
check_dirs check_dirs
start-stop-daemon --start --pidfile ${PIDFILE} --make-pidfile \ start-stop-daemon --start --oknodo \
--background --chuid ${USER} --exec ${DAEMON} -- --port=${SSO_PORT} --pidfile ${PIDFILE} \
echo "ok" --chuid ${USER} \
--exec ${GUNICORN} -- ${GUNICORN_OPTS} ${GUNICORN_APP}
if [ $? -eq 0 ]; then
log_success_msg
else
log_failure_msg
exit 1
fi
;; ;;
stop) stop)
echo -n "Stopping SSO Server... " log_daemon_msg "Stopping SSO server"
start-stop-daemon --stop \ start-stop-daemon --stop --oknodo --user ${USER} --pidfile ${PIDFILE}
--pidfile ${PIDFILE} && rm -f ${PIDFILE} if [ $? -eq 0 ]; then
echo "ok" log_success_msg
else
log_failure_msg
fi
rm -f ${PIDFILE} 2>/dev/null
;; ;;
reload) reload)
echo -n "Reloading SSO Server... " log_daemon_msg "Reloading SSO server"
kill -HUP `cat ${PIDFILE}` kill -HUP `cat ${PIDFILE}`
echo "ok" log_success_msg
;; ;;
restart) restart)
$0 stop $0 stop
...@@ -55,7 +80,8 @@ restart) ...@@ -55,7 +80,8 @@ restart)
$0 start $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 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 ai-sso (2.0) unstable; urgency=low
* Source upgraded to version 2.0. * Source upgraded to version 2.0.
......
...@@ -21,7 +21,8 @@ Description: A/I SSO Python modules. ...@@ -21,7 +21,8 @@ Description: A/I SSO Python modules.
Package: ai-sso-server Package: ai-sso-server
Architecture: all 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. Description: A/I SSO Server.
The login server for the A/I SSO service. The login server for the A/I SSO service.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment