From: Roland Mas Date: Wed, 7 Nov 2012 11:11:26 +0000 (+0100) Subject: Start using Loggerhead as WSGI rather than as a daemon X-Git-Tag: v5.3-rc1~1788 X-Git-Url: https://scm.fusionforge.org/anonscm/gitweb?p=fusionforge%2Ffusionforge.git;a=commitdiff_plain;h=23670e26a31baf300199da94105a3e99cdc4717e Start using Loggerhead as WSGI rather than as a daemon --- diff --git a/src/debian/dsf-in/plugin-scmbzr.init.d b/src/debian/dsf-in/plugin-scmbzr.init.d deleted file mode 100644 index 358c16a5a4..0000000000 --- a/src/debian/dsf-in/plugin-scmbzr.init.d +++ /dev/null @@ -1,66 +0,0 @@ -#! /bin/sh -### BEGIN INIT INFO -# Provides: @OLDPACKAGE@-plugin-scmbzr -# Required-Start: $local_fs $remote_fs $network -# Required-Stop: $local_fs $remote_fs $network -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -### END INIT INFO -# -# Init script for @OLDPACKAGE@-plugin-scmbzr Debian package. -# Based on the script provided by loggerhead. - -PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin -DESC="Loggerhead Bazaar Branch Browser for @FORGENAME@" -NAME=@OLDPACKAGE@-plugin-scmbzr -PIDFILE=/var/run/$NAME.pid -SCRIPTNAME=/etc/init.d/$NAME - -# Gracefully exit if the package has been removed. -[ -x /usr/bin/serve-branches ] || exit 0 - -# Check if configuration file is present -[ ! -f @CONFIG_PATH@/plugins/scmbzr/serve-branches.conf ] && exit 0 - -. @CONFIG_PATH@/plugins/scmbzr/serve-branches.conf - -# -# Function that starts the daemon/service. -# -d_start() { - start-stop-daemon -p $PIDFILE -S --startas /usr/bin/serve-branches --chuid loggerhead --make-pidfile --background --chdir $served_branches -- --prefix=$prefix --port=$port --log-folder /var/log/loggerhead 2>/dev/null -} - -# -# Function that stops the daemon/service. -# -d_stop() { - start-stop-daemon -p $PIDFILE -K -} - - -case "$1" in - start) - echo -n "Starting $DESC: $NAME" - d_start - echo "." - ;; - stop) - echo -n "Stopping $DESC: $NAME" - d_stop - echo "." - ;; - restart|force-reload) - echo -n "Restarting $DESC: $NAME" - d_stop - sleep 1 - d_start - echo "." - ;; - *) - echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 - exit 1 - ;; -esac - -exit 0 diff --git a/src/etc/httpd.conf.d/50-wsgi-scmbzr.conf b/src/etc/httpd.conf.d/50-wsgi-scmbzr.conf new file mode 100644 index 0000000000..74eaaf62d3 --- /dev/null +++ b/src/etc/httpd.conf.d/50-wsgi-scmbzr.conf @@ -0,0 +1,3 @@ + + WSGIDaemonProcess fusionforge-plugin-scmbzr user=gforge group=gforge processes=4 maximum-requests=1000 display-name=fusionforge-plugin-scmbzr + diff --git a/src/etc/httpd.conf.d/plugin-scmbzr.inc b/src/etc/httpd.conf.d/plugin-scmbzr.inc index b2bc8b3eab..dabfc6220d 100644 --- a/src/etc/httpd.conf.d/plugin-scmbzr.inc +++ b/src/etc/httpd.conf.d/plugin-scmbzr.inc @@ -1,8 +1,11 @@ - - Allow from all - +Alias {core/url_prefix}/scm/loggerhead/static /usr/share/loggerhead/static +RewriteEngine On +RewriteRule ^{core/url_prefix}/scm/loggerhead$ {core/url_prefix}/scm/loggerhead/ [R] - - ProxyPass http://127.0.0.1:8081/ - ProxyPassReverse http://127.0.0.1:8081/ +WSGIScriptAlias {core/url_prefix}/scm/loggerhead /usr/bin/loggerhead.wsgi + + + WSGIProcessGroup fusionforge-plugin-scmbzr + Order deny,allow + Allow from all diff --git a/src/plugins/scmbzr/bin/install.sh b/src/plugins/scmbzr/bin/install.sh new file mode 100644 index 0000000000..b33b7aa22a --- /dev/null +++ b/src/plugins/scmbzr/bin/install.sh @@ -0,0 +1,53 @@ +#! /bin/sh +# +# Configure Loggerhead for FusionForge +# Roland Mas + +PATH=/usr/share/gforge/bin:/usr/share/fusionforge/bin:$PATH +source_path=`forge_get_config source_path` +log_path=`forge_get_config log_path` +data_path=`forge_get_config data_path` +repos_path=$(forge_get_config repos_path scmbzr) +web_host=$(forge_get_config web_host) +url_prefix=$(forge_get_config url_prefix) + + +set -e + +if [ `id -u` != 0 ] ; then + echo "You must be root to run this, please enter passwd" + exec su -c "$0 $1" +fi + +configfile=~gforge/.bazaar/bazaar.conf +cachedir=/var/cache/gforge/loggerhead + +case "$1" in + configure) + if [ ! -e $configfile ] ; then + mkdir -p $(dirname $configfile) + cat > $configfile <= 1.19~bzr477~) Provides: @PACKAGE@-plugin-scm, @OLDPACKAGE@-plugin-scmbzr Conflicts: @OLDPACKAGE@-plugin-scmbzr Replaces: @OLDPACKAGE@-plugin-scmbzr diff --git a/src/plugins/scmbzr/packaging/install/plugin-scmbzr b/src/plugins/scmbzr/packaging/install/plugin-scmbzr index 283e4dad9b..798cfc1578 100644 --- a/src/plugins/scmbzr/packaging/install/plugin-scmbzr +++ b/src/plugins/scmbzr/packaging/install/plugin-scmbzr @@ -1,3 +1,4 @@ +plugins/scmbzr/bin/* @PLUGIN_PATH@/scmbzr/bin/ plugins/scmbzr/common/* @PLUGIN_PATH@/scmbzr/common/ plugins/scmbzr/etc/plugins/scmbzr/* etc/gforge/plugins/scmbzr/ plugins/scmbzr/etc/*.ini etc/@PACKAGE@/config.ini.d/