[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[5305] branches/1.3



Revision: 5305
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5305&view=rev
Author:   einhverfr
Date:     2012-12-06 09:21:16 +0000 (Thu, 06 Dec 2012)
Log Message:
-----------
Merging fcgi support into main branches

Modified Paths:
--------------
    branches/1.3/Changelog

Added Paths:
-----------
    branches/1.3/tools/app.psgi
    branches/1.3/tools/lsmb_13-fcgi.conf
    branches/1.3/tools/system/
    branches/1.3/tools/system/ledgersmb.service
    branches/1.3/tools/system/lsmbstart
    branches/1.3/tools/system/lsmbstop

Modified: branches/1.3/Changelog
===================================================================
--- branches/1.3/Changelog	2012-12-06 09:16:23 UTC (rev 5304)
+++ branches/1.3/Changelog	2012-12-06 09:21:16 UTC (rev 5305)
@@ -4,6 +4,7 @@
 
 Changelog for 1.3.26
 * Added db statistics post-upgrade and pre/post rebuild (Chris T, 3586113)
+* Merged in fcgi support from addons (Chris T)
 
 Changelog for 1.3.25
 * Fixed internal server errors on LedgerSMB->error() during new() (Chris T)

Added: branches/1.3/tools/app.psgi
===================================================================
--- branches/1.3/tools/app.psgi	                        (rev 0)
+++ branches/1.3/tools/app.psgi	2012-12-06 09:21:16 UTC (rev 5305)
@@ -0,0 +1,45 @@
+#!/usr/bin/plackup -s FCGI ledgersmb.fcgi
+
+package LedgerSMB::FCGI;
+
+use CGI::Emulate::PSGI;
+use FCGI::ProcManager;
+use FindBin;
+# Preloads
+use LedgerSMB;
+use LedgerSMB::Form;
+use LedgerSMB::Sysconfig;
+use LedgerSMB::Template;
+use LedgerSMB::Template::LaTeX;
+use LedgerSMB::Template::HTML;
+use LedgerSMB::Locale;
+use LedgerSMB::DBObject;
+use LedgerSMB::File;
+
+BEGIN {
+  lib->import($FindBin::Bin) unless $ENV{mod_perl}
+}
+
+# Process Manager
+my $proc_manager = FCGI::ProcManager->new({ n_processes => 10 });
+
+
+my $app = CGI::Emulate::PSGI->handler(
+   sub {
+       if (my $cpid = fork()){
+          wait
+       } else {
+          $proc_manager->pm_pre_dispatch();
+          $uri = $ENV{REQUEST_URI};
+          $uri =~ s/\?.*//;
+          $ENV{SCRIPT_NAME} = $uri;
+          $ENV{SCRIPT_NAME} =~ m/([^\/\\]*.pl)\?*.*$/;
+
+          my $script = $1;
+          warn $script;
+          do "./$script";
+          $proc_manager->pm_post_dispatch();
+       }
+   }
+);
+


Property changes on: branches/1.3/tools/app.psgi
___________________________________________________________________
Added: svn:executable
   + *

Added: branches/1.3/tools/lsmb_13-fcgi.conf
===================================================================
--- branches/1.3/tools/lsmb_13-fcgi.conf	                        (rev 0)
+++ branches/1.3/tools/lsmb_13-fcgi.conf	2012-12-06 09:21:16 UTC (rev 5305)
@@ -0,0 +1,63 @@
+# This file must be edited to substitute the current path with WORKING_DIR
+
+Alias /ledgersmb_1.3 WORKING_DIR/
+LoadModule fastcgi_module modules/mod_fastcgi.so
+
+LogLevel debug
+
+FastCgiExternalServer WORKING_DIR/ledgersmb.fcgi -socket /var/run/httpd/fastcgi/lsmb.sock -idle-timeout 240 -pass-header Authorization
+
+<Directory WORKING_DIR>
+
+  # Rewrite rule to allow HTTP Authorization information to the scripts only
+  # from this directory.
+  RewriteEngine On
+  RewriteBase /ledgersmb_1.3/
+  RewriteRule ^([^/]*\.pl) ledgersmb.fcgi/$0 
+
+
+  AllowOverride All
+  Options Includes FollowSymlinks +ExecCGI
+
+
+  # By default, only allow from localhost.  If you change this, please be
+  # advised that you should use SSL protection on any and all network
+  # connections that access this application in order to protect usernames and
+  # passwords.
+
+  # The rest of this file just tightens up security.
+  <Files ~ "\.conf$">
+    Order Deny,Allow
+    Deny from All
+  </Files>
+</Directory>
+
+<Directory WORKING_DIR/users>
+  Order Deny,Allow
+  Deny from All
+</Directory>
+
+<Directory WORKING_DIR/bin>
+  Order Deny,Allow
+  Deny from All
+</Directory>
+
+<Directory WORKING_DIR/utils>
+  Order Deny,Allow
+  Deny from All
+</Directory>
+
+<Directory WORKING_DIR/spool>
+  Order Deny,Allow
+  Deny from All
+</Directory>
+
+<Directory WORKING_DIR/templates>
+  Order Deny,Allow
+  Deny from All
+</Directory>
+
+<Directory WORKING_DIR/LedgerSMB>
+  Order Deny,Allow
+  Deny from All
+</Directory>

Added: branches/1.3/tools/system/ledgersmb.service
===================================================================
--- branches/1.3/tools/system/ledgersmb.service	                        (rev 0)
+++ branches/1.3/tools/system/ledgersmb.service	2012-12-06 09:21:16 UTC (rev 5305)
@@ -0,0 +1,18 @@
+[Unit]
+Description=LedgerSMB FCGI service
+After=syslog.target
+
+[Service]
+Type=forkking
+PIDfile=/var/run/httpd/lsmb.pid
+RemainAfterExit=yes
+ExecStart=/usr/bin/lsmbstart
+ExecStop=/usr/bin/lsmbstop
+Environment=BOOTUP=serial
+Environment=CONSOLETYPE=serial
+StandardOutput=syslog
+StandardError=syslog
+
+[Install]
+WantedBy=basic.target
+

Added: branches/1.3/tools/system/lsmbstart
===================================================================
--- branches/1.3/tools/system/lsmbstart	                        (rev 0)
+++ branches/1.3/tools/system/lsmbstart	2012-12-06 09:21:16 UTC (rev 5305)
@@ -0,0 +1,5 @@
+#!/usr/bin/bash
+
+cd /usr/share/ledgersmb
+plackup -s FCGI -D --listen /var/run/httpd/fastcgi/lsmb.sock
+

Added: branches/1.3/tools/system/lsmbstop
===================================================================
--- branches/1.3/tools/system/lsmbstop	                        (rev 0)
+++ branches/1.3/tools/system/lsmbstop	2012-12-06 09:21:16 UTC (rev 5305)
@@ -0,0 +1,4 @@
+#!/usr/bin/bash
+
+killall perl-fcgi-pm
+

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.