Import spawn-fcgi-1.6.2 as wip/spawnfcgi.

spawn-fcgi is used to spawn remote and local FastCGI processes.
Until recently, it was part of the lighttpd project, but has been
unhinged into its own projects some weeks ago. Because of this, I have 
made some efforts to include it into pkgsrc as its own package.

Here the official statement from the project-website about spawn-fcgi:

While  it is obviously needed to spawn remote FastCGI backends (the web
server can only spawn local ones), it is  recommended  to  spawn  local
backends with spawn-fcgi, too.

Reasons why you may want to use spawn-fcgi instead of something else:

*  Privilege  separation  without  needing  a  suid-binary or running a
   server as root.
*  You can restart your web server and the FastCGI applications without
   restarting the others.
*  You can run them in different chroot()s.
*  Running  your  FastCGI applications doesn't depend on the web server
   you are running, which  allows  for  easier  testing  of  other  web
   servers.
This commit is contained in:
Volkmar Seifert 2009-04-29 15:51:24 +00:00 committed by Thomas Klausner
parent 542f0f4815
commit 6ce4723634
6 changed files with 148 additions and 0 deletions

16
spawnfcgi/DESCR Normal file
View file

@ -0,0 +1,16 @@
spawn-fcgi is used to spawn remote and local FastCGI processes.
While it is obviously needed to spawn remote FastCGI backends (the web
server can only spawn local ones), it is recommended to spawn local
backends with spawn-fcgi, too.
Reasons why you may want to use spawn-fcgi instead of something else:
* Privilege separation without needing a suid-binary or running a
server as root.
* You can restart your web server and the FastCGI applications without
restarting the others.
* You can run them in different chroot()s.
* Running your FastCGI applications doesn't depend on the web server
you are running, which allows for easier testing of other web
servers.

26
spawnfcgi/MESSAGE Normal file
View file

@ -0,0 +1,26 @@
===========================================================================
$NetBSD: MESSAGE,v 1.1.1.1 2009/04/29 15:51:24 mjoellnir Exp $
Use the following flags to adjust spawn-fcgi to your demands:
(These flags come into /etc/rc.conf. Flags that are commented out
are added here with their default-values. You can leave them untouched
or adjust them to your own demands)
### Enables spawn-fcgi
spawnfcgi=YES
### The path to the pidfile...
#spawnfcgi_pidfile=@VARBASE@/run/spawnfcgi.pid
### The path to the actual FastCGI-Application
#spawnfcgi_app=@PREFIX@/libexec/cgi-bin/php
### The number of children, fast-cgi should launch for processing requests
#spawnfcgi_children=10
### The IP, spawn-fcgi should bind to...
#spawnfcgi_ip=127.0.0.1
### The port, spawn-fcgi should listen on...
#spawnfcgi_port=9999
### The user, spawn-fcgi should change to after startup
#spawnfcgi_user=www
### The group, spawn-fcgi should change to after startup
#spawnfcgi_group=www
===========================================================================

35
spawnfcgi/Makefile Normal file
View file

@ -0,0 +1,35 @@
# $NetBSD: Makefile,v 1.1.1.1 2009/04/29 15:51:24 mjoellnir Exp $
#
DISTNAME= spawn-fcgi-1.6.2
CATEGORIES= net www
MASTER_SITES= http://www.lighttpd.net/download/
EXTRACT_SUFX= .tar.bz2
MAINTAINER= vs@nifelheim.info
HOMEPAGE= http://redmine.lighttpd.net/projects/spawn-fcgi
COMMENT= Spawns FCGI-Processes and runs with priviledge separation
PKG_DESTDIR_SUPPORT= user-destdir
CONFLICTS= lighttpd<1.4.23
GNU_CONFIGURE= yes
CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
CONFIGURE_ARGS+= --libdir=${PREFIX}/lib/${PKGBASE}
DOCDIR= ${PREFIX}/share/doc/${PKGBASE}
EGDIR= ${PREFIX}/share/examples/${PKGBASE}
PKG_SYSCONFSUBDIR= ${PKGBASE}
RCD_SCRIPTS= spawnfcgi
INSTALLATION_DIRS= ${DOCDIR} ${EGDIR}
post-install:
cd ${WRKSRC}; for f in AUTHORS COPYING ChangeLog NEWS README; do \
${INSTALL_DATA} ${WRKSRC}/$$f ${DESTDIR}${DOCDIR}; \
done
.include "../../mk/bsd.pkg.mk"

8
spawnfcgi/PLIST Normal file
View file

@ -0,0 +1,8 @@
@comment $NetBSD: PLIST,v 1.1.1.1 2009/04/29 15:51:24 mjoellnir Exp $
bin/spawn-fcgi
man/man1/spawn-fcgi.1
share/examples/rc.d/spawnfcgi
share/doc/spawn-fcgi/AUTHORS
share/doc/spawn-fcgi/COPYING
share/doc/spawn-fcgi/NEWS
share/doc/spawn-fcgi/README

5
spawnfcgi/distinfo Normal file
View file

@ -0,0 +1,5 @@
$NetBSD: distinfo,v 1.1.1.1 2009/04/29 15:51:24 mjoellnir Exp $
SHA1 (spawn-fcgi-1.6.2.tar.bz2) = 475e9d9bff7ab31c29d082cc214cea66e04da690
RMD160 (spawn-fcgi-1.6.2.tar.bz2) = 7a0986a9254646e7c635c086ef055b0f9a00a458
Size (spawn-fcgi-1.6.2.tar.bz2) = 73169 bytes

View file

@ -0,0 +1,58 @@
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: spawnfcgi.sh,v 1.1.1.1 2009/04/29 15:51:24 mjoellnir Exp $
#
# FastCGI process spawner
#
# PROVIDE: spawn-fcgi
# REQUIRE: DAEMON
# BEFORE: LOGIN
if [ -f /etc/rc.subr ]; then
. /etc/rc.subr
fi
name="spawnfcgi"
rcvar=${name}
command="@PREFIX@/bin/spawn-fcgi"
start_precmd="spawnfcgi_start_precmd"
stop_postcmd="spawnfcgi_stop_postcmd"
load_rc_config $name
pidfile="${spawnfcgi_pidfile:=@VARBASE@/run/spawnfcgi.pid}"
fcgiapp="${spawnfcgi_app:=@PREFIX@/libexec/cgi-bin/php}"
fcgiip="${spawnfcgi_ip:=127.0.0.1}"
fcgiport="${spawnfcgi_port:=9999}"
fcgiuser="${spawnfcgi_user:=www}"
fcgigroup="${spawnfcgi_group:=www}"
spawnfcgi_children="${spawnfcgi_children:=10}"
if /bin/test "`echo ${fcgiapp} | grep php`" = "${fcgiapp}" ; then
fcgichildren="-C ${spawnfcgi_children}"
procname=${fcgiapp}
else
fcgichildren="-F ${spawnfcgi_children}"
fi
if /bin/test -n "${spawnfcgi_chroot}"; then
fcgichroot="-c ${spawnfcgi_chroot}"
else
fcgichroot=""
fi
spawnfcgi_start_precmd() {
touch ${pidfile}
chown ${fcgiuser}:${fcgigroup} ${pidfile}
}
spawnfcgi_stop_postcmd() {
rm ${pidfile}
}
spawnfcgi_flags="-f ${fcgiapp} ${fcgichildren} -a ${fcgiip} -p ${fcgiport} -P ${pidfile} -u ${fcgiuser} -g ${fcgigroup} ${fcgichroot}"
run_rc_command "$1"