aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Bühler <stbuehler@web.de>2009-06-05 09:19:47 +0000
committerStefan Bühler <stbuehler@web.de>2009-06-05 09:19:47 +0000
commit2b87a673264b61984ea7572e3e5dca228e10fb73 (patch)
tree2fad9f45018b353fd7cf277427749cf5e8e6d471
parent93eba354ef4a3e7f827d9098d0ef16d57134d51d (diff)
downloadspawn-fcgi-2b87a673264b61984ea7572e3e5dca228e10fb73.tar.gz
spawn-fcgi-2b87a673264b61984ea7572e3e5dca228e10fb73.zip
Add some ./run script examples for use with daemontools or runit
git-svn-id: svn://svn.lighttpd.net/spawn-fcgi/trunk@50 4a9f3682-ca7b-49a8-9a55-ba4640e46f83
-rw-r--r--NEWS1
-rw-r--r--doc/run-generic49
-rw-r--r--doc/run-php8
-rw-r--r--doc/run-rails8
4 files changed, 66 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index b588a4f..416084b 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ NEWS
- 1.6.3 -
* Fix unix socket mode change to work without specifying user/group for socket
+ * Add some ./run script examples for use with daemontools or runit
- 1.6.2 - 2009-04-18
* Add homepage to README
diff --git a/doc/run-generic b/doc/run-generic
new file mode 100644
index 0000000..78417e6
--- /dev/null
+++ b/doc/run-generic
@@ -0,0 +1,49 @@
+#!/bin/bash
+# Use this as a run script with daemontools or runit
+
+## ABSOLUTE path to the spawn-fcgi binary
+SPAWNFCGI="/usr/bin/spawn-fcgi"
+
+## ABSOLUTE path to the FastCGI application (php-cgi, dispatch.fcgi, ...)
+FCGIPROGRAM="/usr/bin/php5-cgi"
+
+## bind to unix socket
+FCGISOCKET="/var/run/lighttpd/your-fcgi-app.sock"
+
+# allowed environment variables separated by spaces
+ALLOWED_ENV="PATH USER"
+
+## if this script is run as root switch to the following user
+USERID=xxx
+SOCKUSERID=www-data
+#CHROOT=/home/www/
+
+#RAILS_ENV="production"
+#export RAILS_ENV
+
+
+################## no config below this line
+
+exec 2>&1
+
+if test x$PHP_FCGI_CHILDREN = x; then
+ PHP_FCGI_CHILDREN=4
+fi
+
+ALLOWED_ENV="$ALLOWED_ENV RAILS_ENV"
+
+if test x$UID = x0; then
+ EX="$SPAWNFCGI -n -s $FCGISOCKET -u $USERID -U $SOCKUSERID -C $PHP_FCGI_CHILDREN -- $FCGIPROGRAM"
+else
+ EX="$SPAWNFCGI -n -s $FCGISOCKET -C $PHP_FCGI_CHILDREN -- $FCGIPROGRAM"
+fi
+
+# copy the allowed environment variables
+E=
+
+for i in $ALLOWED_ENV; do
+ E="$E $i=${!i}"
+done
+
+# clean environment and set up a new one
+exec env - $E $EX
diff --git a/doc/run-php b/doc/run-php
new file mode 100644
index 0000000..970573f
--- /dev/null
+++ b/doc/run-php
@@ -0,0 +1,8 @@
+#!/bin/sh
+# Use this as a ./run script with daemontools or runit
+# You should replace xxx with the user you want php to run as (and www-data with the user lighty runs as)
+
+exec 2>&1
+PHP_FCGI_CHILDREN=2 \
+PHP_FCGI_MAX_REQUESTS=1000 \
+exec /usr/bin/spawn-fcgi -n -s /var/run/lighttpd/php-xxx.sock -n -u xxx -U www-data -- /usr/bin/php5-cgi
diff --git a/doc/run-rails b/doc/run-rails
new file mode 100644
index 0000000..f045d37
--- /dev/null
+++ b/doc/run-rails
@@ -0,0 +1,8 @@
+#!/bin/sh
+# Use this as a ./run script with daemontools or runit
+# You should replace xxx with the user you want rails to run as (and www-data with the user lighty runs as)
+# /path-to-rails should be replaced with the correct path too :)
+
+exec 2>&1
+RAILS_ENV="production" \
+exec /usr/bin/spawn-fcgi -n -s /var/run/lighttpd/rails-xxx.sock -u xxx -U www-data -- /path-to-rails/public/dispatch.fcgi