[DRE-commits] r1296 - packages-wip/mongrel/trunk/debian

Filipe Lautert filipe-guest at alioth.debian.org
Thu Mar 1 16:59:26 CET 2007


Author: filipe-guest
Date: 2007-03-01 17:59:26 +0100 (Thu, 01 Mar 2007)
New Revision: 1296

Removed:
   packages-wip/mongrel/trunk/debian/control.in
Modified:
   packages-wip/mongrel/trunk/debian/control
   packages-wip/mongrel/trunk/debian/init.d
   packages-wip/mongrel/trunk/debian/mongrel.1
   packages-wip/mongrel/trunk/debian/mongrel_rails.1
   packages-wip/mongrel/trunk/debian/rules
Log:

Lots of changes:

- init.d script just start mongrel, without cluster support (this will be aded in mongrel_cluster package)
- control file update with new depends
- some small changes to rules so lintian don't complain at it
- updates to man pages



Modified: packages-wip/mongrel/trunk/debian/control
===================================================================
--- packages-wip/mongrel/trunk/debian/control	2007-02-23 18:44:26 UTC (rev 1295)
+++ packages-wip/mongrel/trunk/debian/control	2007-03-01 16:59:26 UTC (rev 1296)
@@ -1,16 +1,16 @@
 Source: mongrel
 Section: web
 Priority: optional
-Maintainer: Filipe Lautert <filipe at icewall.org>, Gunnar Wolf <gwolf at debian.org>, Jens Kraemer <jk at jkraemer.net>
-Build-Depends: debhelper (>= 4.0.0), ruby1.8 (>=1.8.4), ruby1.8-dev (>=1.8.4), dpatch, cdbs
-Build-Depends-Indep: ruby-pkg-tools
+Maintainer: Filipe Lautert <filipe at icewall.org>
+Uploaders: Gunnar Wolf <gwolf at debian.org>
+Build-Depends: debhelper (>= 5.0.0), ruby1.8 (>=1.8.4), ruby1.8-dev (>=1.8.4), dpatch, cdbs
 Build-Conflicts: gcc-3.3 (<< 1:3.3.2-0pre1)
 Standards-Version: 3.7.2
 
 Package: mongrel
 Architecture: any
-Depends: ${shlibs:Depends}, ruby1.8 (>=1.8.4), libgems-ruby1.8, libgemplugin-ruby (>=0.2.2)
-Recommends: rails
+Depends: ${shlibs:Depends}, ruby1.8 (>=1.8.4), libgems-ruby1.8, libgemplugin-ruby (>=0.2.2), libdaemons-ruby
+Recommends: mongrel_cluster, rails
 Description: A small fast HTTP library and server that runs Rails, Camping, and Nitro apps
  Mongrel is a fast HTTP library and server for Ruby that is intended
  for hosting Ruby web applications of any kind using plain HTTP rather

Deleted: packages-wip/mongrel/trunk/debian/control.in
===================================================================
--- packages-wip/mongrel/trunk/debian/control.in	2007-02-23 18:44:26 UTC (rev 1295)
+++ packages-wip/mongrel/trunk/debian/control.in	2007-03-01 16:59:26 UTC (rev 1296)
@@ -1,19 +0,0 @@
-Source: mongrel
-Section: web
-Priority: optional
-Maintainer: Filipe Lautert <filipe at icewall.org>, Gunnar Wolf <gwolf at debian.org>, Jens Kraemer <jk at jkraemer.net>
-Uploaders: @RUBY_EXTRAS_TEAM@
-Build-Depends: debhelper (>= 4.0.0), ruby1.8 (>=1.8.4), ruby1.8-dev (>=1.8.4), dpatch, cdbs
-Build-Depends-Indep: ruby-pkg-tools
-Build-Conflicts: gcc-3.3 (<< 1:3.3.2-0pre1)
-Standards-Version: 3.7.2
-
-Package: mongrel
-Architecture: any
-Depends: ${shlibs:Depends}, ruby1.8 (>=1.8.4), libgems-ruby1.8, libgemplugin-ruby (>=0.2.2), 
-Recommends: rails
-Description: A small fast HTTP library and server that runs Rails, Camping, and Nitro apps
- Mongrel is a fast HTTP library and server for Ruby that is intended
- for hosting Ruby web applications of any kind using plain HTTP rather
- than FastCGI or SCGI. It is framework agnostic and already supports
- Ruby On Rails, Og+Nitro, and Camping frameworks. 

Modified: packages-wip/mongrel/trunk/debian/init.d
===================================================================
--- packages-wip/mongrel/trunk/debian/init.d	2007-02-23 18:44:26 UTC (rev 1295)
+++ packages-wip/mongrel/trunk/debian/init.d	2007-03-01 16:59:26 UTC (rev 1296)
@@ -1,4 +1,14 @@
 #! /bin/sh
+### BEGIN INIT INFO
+# Provides:          mongrel
+# Required-Start:
+# Required-Stop:
+# Default-Start:    
+# Default-Stop:    
+# Should-Start:      $network
+# Should-Stop:       $network
+# Short-Description: Start mongrel servers at boot time
+### END INIT INFO
 
 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
 DESC="mongrel servers"
@@ -12,7 +22,6 @@
 # don't change here, override in /etc/default/mongrel instead
 USER=www-data
 CONFIG_BASE=/etc/mongrel/sites-enabled
-PEN=/usr/bin/pen
 
 # Read config file if it is present.
 if [ -r /etc/default/mongrel ]
@@ -20,145 +29,82 @@
   . /etc/default/mongrel
 fi
 
-set -e
-
-
-# run the given command ($2, {start|stop|reload}) for the given app ($1)
+# run the given command ($2, {start|stop|reload|restart}) for the given app ($1)
 for_app() {
-  #reset all variables that can be used on the configuration file
-  for i in "dir port servers proxy_port env additional_pen_opts pen_status_file bind_address"; do
-    unset $i
-  done
+  echo -n "$1 "
+	daemon=$(grep :daemon: $CONFIG_BASE/$1 | cut -d ' ' -f 2)
 
-  echo -n $1
-  . $CONFIG_BASE/$1
+    if test -z $daemon -o $daemon != "true"; then
+      echo "is not set as daemon. Skipping. To run it set :daemon: true"
+      return 1
+    fi
 
-  if [ -z "$dir" -o -z "$port" -o -z "$servers" ]; then
-    echo " -> Error: incomplete configuration file. Variables 'dir', 'port' and 'servers' must be set."
-    return
-  fi
+	pidfile=$(grep :pid_file: $CONFIG_BASE/$1 | cut -d ' ' -f 2)
+	mcwd=$(grep :cwd: $CONFIG_BASE/$1 | cut -d ' ' -f 2)
+    if test -z $mcwd; then
+        mcwd=`pwd`;
+    fi
 
-  if [ "$2" != "reload" -a -n "$proxy_port" ]; then
-    start_stop_proxy $1 $2
-  fi
-
-  if [ -z $env ]; then
-  	env="production"
-  fi
-
-  if [ -z $bind_address ]; then
-  	bind_address="127.0.0.1"
-  fi
-
-  DAEMON_OPTS="start -e $env -a $bind_address -c $dir"
-  last_port=$(( $port + $servers - 1 ))
   case "$2" in
-    start|reload)
-      for p in `seq $port $last_port`; do
-        pidfile="/var/run/$NAME.$1.$p.pid"
-        case "$2" in
-          start)
-            start-stop-daemon --start --background --chuid $USER --make-pidfile --pidfile $pidfile --exec $DAEMON -- $DAEMON_OPTS -p $p
-          ;;
-          reload)
-            SIGUSR2=12
-            start-stop-daemon --stop --signal $SIGUSR2 --quiet --pidfile $pidfile  || echo "couldn't reload process $pidfile"
-          ;;
-        esac
-      done
-      ;;
+    start)
+      start-stop-daemon --start -d $mcwd --background --chuid $USER --exec $DAEMON -- start -C $CONFIG_BASE/$1
+    ;;
+    restart)
+      cd $mcwd
+      $DAEMON restart -c $mcwd -p $pidfile  || echo "couldn't restart mongrel $1"
+    ;;
+    reload)
+      cd $mcwd
+      $DAEMON restart -s -c $mcwd -p $pidfile  || echo "couldn't restart mongrel $1"
+    ;;
     stop)
-      for pidfile in `ls /var/run/$NAME.$1.*.pid`; do
-        (start-stop-daemon --stop --quiet --pidfile $pidfile || kill -9 `cat $pidfile` || echo "couldn't kill process $pidfile (`cat $pidfile`), removing pid file anyway") && rm -f $pidfile
-      done
-      ;;
-  esac
+      cd $mcwd
+      if test -z $pidfile -o ! -e $pidfile; then
+        echo "don't have a pidfile or it doesn't exist"
+        return 1;
+      fi
+      $DAEMON stop --pid $pidfile || ($DAEMON stop --force -P $pidfile || kill -9 `cat $pidfile 2>/dev/null` || echo "couldn't kill process $pidfile (`cat $pidfile 2>/dev/null`), removing pid file anyway") && rm -f $pidfile
+      esac
   echo "."
 }
 
-# run the given command ('stop' or 'start') for each app configured
-# in /etc/mongrel_cluster
 each_app() {
   for app in `ls $CONFIG_BASE/`; do
     for_app $app $1
   done
 }
 
-# runs given command ($1) for the given app ($2) or all apps, 
-# if $2 is not given
-run_command() {
-  if [ -z "$2" ]; then
-    # no site given
-    each_app $1
-  else
-    for_app $2 $1
-  fi
-}
 
-# start/stop the pen proxy for a given application:
-#
-# start_stop_proxy myapp start
-#
-# pen will be running as user nobody
-start_stop_proxy() {
-  if [ ! -x $PEN ]; then
-    echo "pen not available, skipping proxy"
-    return
-  fi
-  pidfile="/var/run/pen.$proxy_port.pid"
-
-  case "$2" in
-    start)
-      PEN_OPTS="$additional_pen_opts -fr $proxy_port "
-      if [ -n "$pen_status_file" ]; then
-        PEN_OPTS="-w $dir/public/$pen_status_file $PEN_OPTS"
-      fi
-      last_port=$(( $port + $servers - 1 ))
-      for p in `seq $port $last_port`; do
-        PEN_OPTS="$PEN_OPTS localhost:$p"
-      done
-      start-stop-daemon --start --quiet --pidfile $pidfile --chuid nobody --background --make-pidfile --exec $PEN -- $PEN_OPTS || echo "couldnt start pen"
-      ;;
-    stop)
-      if [ -f $pidfile ]; then
-        start-stop-daemon --stop --quiet --oknodo --pidfile $pidfile 
-      fi
-      ;;
-  esac
-}
-
-
 case "$1" in
   start)
   echo "Starting $DESC: $NAME"
-  run_command 'start' $2
+  each_app 'start'
   echo "."
   ;;
   stop)
   echo "Stopping $DESC: $NAME"
-  run_command 'stop' $2  
+  each_app 'stop'
   echo "."
   ;;
+  restart)
+  echo "Restarting $DESC: $NAME"
+  each_app 'restart'
+  echo "."
+  ;;
   reload)
   echo "Reloading $DESC: $NAME"
-  run_command 'reload' $2  
+  each_app 'reload'
   echo "."
   ;;
-  restart|force-reload)
-  #
-  #  If the "reload" option is implemented, move the "force-reload"
-  #  option to the "reload" entry above. If not, "force-reload" is
-  #  just the same as "restart".
-  #
+  force-reload)
   echo "Restarting $DESC: $NAME"
-  run_command 'stop' $2
+  each_app 'stop'
   sleep 1
-  run_command 'start' $2
+  each_app 'start'
   echo "."
   ;;
   *)
-  # echo "Usage: $SCRIPTNAME {start|stop|reload|restart}" >&2
-  echo "Usage: $SCRIPTNAME {start|stop|reload|restart}" >&2
+  echo "Usage: $SCRIPTNAME {start|stop|reload|restart|force-reload}" >&2
   exit 1
   ;;
 esac

Modified: packages-wip/mongrel/trunk/debian/mongrel.1
===================================================================
--- packages-wip/mongrel/trunk/debian/mongrel.1	2007-02-23 18:44:26 UTC (rev 1295)
+++ packages-wip/mongrel/trunk/debian/mongrel.1	2007-03-01 16:59:26 UTC (rev 1296)
@@ -1,43 +1,23 @@
 .TH MONGREL 1 "Juni 28, 2006"
 .SH NAME
-/etc/init.d/mongrel \- init script for Mongrel
+/etc/init.d/mongrel \- init script for Mongrel Rails
 .SH SYNOPSIS
 .B /etc/init.d/mongrel
 .RI {start | stop | reload | restart} 
 [application_name]
 .SH DESCRIPTION
-\fB/etc/init.d/mongrel\fP can control any number of Rails applications running under the Mongrel webserver. Pen will be used to balance load between multiple Mongrel processes. 
+\fB/etc/init.d/mongrel\fP can control any number of Rails applications running under the Mongrel webserver.
 .SH CONFIGURATION
 Each application is configured with a file located in (or symlinked to)
-\fB/etc/mongrel/sites-enabled\fP. The name of such a file can be given 
-as a second argument to the script, to only apply the stop/start/restart 
-command to this application.
+\fB/etc/mongrel/sites-enabled\fP.
 .PP
-Each config file has to set the following variables:
-.br
-\fBdir\fP        base directory of your Rails application (RAILS_HOME)
-.br
-\fBport\fP       base port for Mongrel to use
-.br
-\fBservers\fP    number of servers to start. Each server will take it's own port, counting upwards from \fBport\fP.
-.br
+Each configuration file is a mongrel_rails configuration file, so there is no cluster support using this init.d script. Option ":daemon" shall be set to true or the configuration file will be ignored.
 .PP
-The following variables are optional:
-.br
-\fBenv\fP                    environment the application shall run. If it isn't set, will default to production.
-.br
-\fBbind_address\fP           ip address to bind. If not set, will default to 127.0.0.1.
-.br
-\fBpen_status_file\fP        pen status file.
-.br
-\fBadditional_pen_opts\fP    additional options passed to pen.
-.br
-\fBproxy_port\fP             port for the pen proxy server to listen for inbound connections. You should configure your frontend Web server (e.g. Apache) to forward requests for your application to this port.
-.br
+If you need cluster support, take a look at mongrel_cluster(1).
 .PP
 .SH SEE ALSO
-.BR pen (1), mongrel_rails (1)
+.BR mongrel_rails (1), mongrel_cluster(1)
 .br
 .SH AUTHOR
 Mongrel (http://mongrel.rubyforge.org/) was written by Zed Shaw.
-The init script and this man page were written by Jens  Krämer <jk at jkraemer.net>.
+The init script and this man page were written by Filipe Lautert <filipe at icewall.org>.

Modified: packages-wip/mongrel/trunk/debian/mongrel_rails.1
===================================================================
--- packages-wip/mongrel/trunk/debian/mongrel_rails.1	2007-02-23 18:44:26 UTC (rev 1295)
+++ packages-wip/mongrel/trunk/debian/mongrel_rails.1	2007-03-01 16:59:26 UTC (rev 1296)
@@ -1,6 +1,6 @@
 .TH MONGREL_RAILS 1 "2006-11-17" "Mongrel Rails"
 .SH NAME
-mongrel_rails \- Ruby Application Server
+mongrel_rails \- Ruby Web Server
 .
 .SH SYNOPSIS
 .B mongrel_rails 

Modified: packages-wip/mongrel/trunk/debian/rules
===================================================================
--- packages-wip/mongrel/trunk/debian/rules	2007-02-23 18:44:26 UTC (rev 1295)
+++ packages-wip/mongrel/trunk/debian/rules	2007-03-01 16:59:26 UTC (rev 1296)
@@ -8,7 +8,7 @@
 include /usr/share/cdbs/1/rules/dpatch.mk
 include /usr/share/dpatch/dpatch.make
 include /usr/share/ruby-pkg-tools/1/class/ruby-setup-rb.mk
-include /usr/share/ruby-pkg-tools/1/rules/uploaders.mk
+#include /usr/share/ruby-pkg-tools/1/rules/uploaders.mk
 
 DEB_RUBY_CONFIG_ARGS = --installdirs=std --shebang=all
 
@@ -21,6 +21,7 @@
 # skip it (and enable it in case we think it is necessary)
 reverse-config::
 	tar xzf data.tar.gz 2>/dev/null
+	touch README
 
 # Usually, we would run unpatch here. Sadly, setup.rb modifies bin/mongrel*,
 # replacing /usr/bin/ruby by /usr/bin/ruby1.8 (or something like that). Ok, so




More information about the Pkg-ruby-extras-commits mailing list