Re: [Catalyst] App Deployment - Apache, FastCGI, init.d

2007-09-20 Thread Daniel McBrearty
also, try daemontools - that shell script will shrink to about 3
lines, and managing it will be a cinch. It's in the cat calendar stuff
somewhere.


On 9/20/07, Hans Dieter Pearcey [EMAIL PROTECTED] wrote:
 On Wed, Sep 19, 2007 at 08:57:10PM -0500, Mitchell Jackson wrote:
  I've seen it mentioned on the list to use daemon tools with PAR (
  http://www.catalystframework.org/calendar/2006/4 ) but that uses the
  built-in myapp_server.pl, running it's own web server, and I much prefer
  the apache/fastcgi approach, most especially because it leaves the work
  of serving static content to apache instead of the heavier application
  process.

 You misread.  It uses myapp_server.pl only to make sure the PAR works
 properly.  Keep reading and you'll see it uses myapp_fastcgi.pl.

 hdp.

 ___
 List: Catalyst@lists.rawmode.org
 Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
 Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
 Dev site: http://dev.catalyst.perl.org/



-- 
Daniel McBrearty
email : danielmcbrearty at gmail.com
http://www.engoi.com
http://danmcb.vox.com
http://danmcb.blogger.com
find me on linkedin and facebook
BTW : 0873928131

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] App Deployment - Apache, FastCGI, init.d

2007-09-20 Thread Brian Cassidy

Mitchell Jackson wrote:
Does anybody have a better init script than the one below for handling 
the fastcgi processes?  I'm probably missing something obvious X.X


I've been generating an init.d script with 
Catalyst::Helper::FastCGI::ExternalServer [1] for our Ubuntu servers 
without issue.


-Brian

[1] http://search.cpan.org/dist/Catalyst-Helper-FastCGI-ExternalServer/

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] App Deployment - Apache, FastCGI, init.d

2007-09-19 Thread Mitchell Jackson

Friends,

I've got an interesting issue with a few catalyst apps.  I have a server 
running two apps under apache with FastCGI.  I wrote an init script to 
start and stop the app server, it's attached below.  I started having 
issues with the init script once I began running multiple apps.  The 
init scripts ( using the standard rc.d/functions library ) identify the 
PID of the FastCGI process via it's process name, which is 
perl-fcgi-pm. Because of this, when I issue a stop or restart command 
to the catalyst server via the init script, it may operate on the wrong 
process.


I dug into trying to change the running process name as seen by ps, but 
this seems to be a fully static value defined by FCGI::ProcManager with 
no option to override it (?).


I tried to get the init script able to properly identify the processes ( 
it seems to use the PID files which contain the correct PID for each 
process ) but it still might operate on the incorrect PID.


I've seen it mentioned on the list to use daemon tools with PAR ( 
http://www.catalystframework.org/calendar/2006/4 ) but that uses the 
built-in myapp_server.pl, running it's own web server, and I much prefer 
the apache/fastcgi approach, most especially because it leaves the work 
of serving static content to apache instead of the heavier application 
process.


Does anybody have a better init script than the one below for handling 
the fastcgi processes?  I'm probably missing something obvious X.X


Kind Regards,

/Mitchell Jackson
OnSite Mobile

___
#!/bin/bash
#
# qualifymanage qualify fastcgi server
#
# chkconfig: - 89 16
# description: Manage starting, stopping and restarting the \
#  catalyst fastcgi application
# processname: qualify
# pidfile: /var/run/qualify_fastcgi.pid

# Source function library
. /etc/rc.d/init.d/functions

# Paths
fastcgi=/var/www/qualify.x.com/qualify/script/qualify_fastcgi.pl
socket=/tmp/qualify.socket
prog=perl-fcgi-pm
pidfile=${PIDFILE-/tmp/qualify_fastcgi.pid}
lockfile=${LOCKFILE-/var/lock/qualify_fastcgi}
RETVAL=0
userid=qualify.x.com
parms=$-l $socket -n 5 -p $pidfile -d

start() {
   echo -n $Starting $prog: 
   daemon --user $userid --pidfile $pidfile $fastcgi $parms
   RETVAL=$?
   echo
   [ $RETVAL = 0 ]  touch ${lockfile}
   return $RETVAL
}
stop() {
   echo -n $Stopping $prog: 
   killproc -p $pidfile -d 10 $prog
   RETVAL=$?
   echo
   [ $RETVAL = 0 ]  rm -f ${lockfile} ${pidfile}
}

# See how we were called.
case $1 in
 start)
   start
   ;;
 stop)
   stop
   ;;
 status)
   status -p $pidfile $prog
   RETVAL=$?
   ;;
 restart)
   stop
   start
   ;;
 condrestart)
   if [ -f ${pidfile} ] ; then
   stop
   start
   fi
   ;;
 *)
   echo $Usage: $prog {start|stop|restart|condrestart|status|help}
   exit 1
esac

exit $RETVAL


___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] App Deployment - Apache, FastCGI, init.d

2007-09-19 Thread Hans Dieter Pearcey
On Wed, Sep 19, 2007 at 08:57:10PM -0500, Mitchell Jackson wrote:
 I've seen it mentioned on the list to use daemon tools with PAR ( 
 http://www.catalystframework.org/calendar/2006/4 ) but that uses the 
 built-in myapp_server.pl, running it's own web server, and I much prefer 
 the apache/fastcgi approach, most especially because it leaves the work 
 of serving static content to apache instead of the heavier application 
 process.

You misread.  It uses myapp_server.pl only to make sure the PAR works
properly.  Keep reading and you'll see it uses myapp_fastcgi.pl.

hdp.

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/