public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail•com>
To: Eric Wong <normalperson@yhbt•net>
Cc: git@vger•kernel.org, Sam Vilain <sam.vilain@catalyst•net.nz>,
	Juan Jose Comellas <juanjo@comellas•org>,
	Peter Vereshagin <peter@vereshagin•org>,
	John Goerzen <jgoerzen@complete•org>
Subject: Re: [PATCH 0/2] gitweb: Add support for running gitweb as FastCGI script
Date: Sun, 9 May 2010 14:39:23 +0200	[thread overview]
Message-ID: <201005091439.26310.jnareb@gmail.com> (raw)
In-Reply-To: <20100509093100.GA7641@dcvr.yhbt.net>

On Sun, 9 May 2010, Eric Wong wrote:
> Jakub Narebski <jnareb@gmail•com> wrote:
>> On Fri, 7 May 2010, Jakub Narebski wrote:
>> 
>>> The alternate solution would be to add gitweb.fcgi wrapper, like e.g.:
>>> in the following patch by Eric Wong
>>> 
>>>   "[PATCH 1/2] gitweb: add a simple wrapper for FCGI support"
>>>   http://thread.gmane.org/gmane.comp.version-control.git/35920/focus=35921
>>> 
>>> which was part of the "[0/2 PATCH] FastCGI and nginx support for gitweb"
>>> series.  (Note that the patch does 'do $gitweb_cgi;' without checking for
>>> errors, see the bottom of `perldoc -f do` documentation on how it should
>>> be done).
>> 
>> I think a better solution here would be to use CGI::Compile instead
>> of 'do $gitweb_cgi;'.
> 
> Possibly, now that CGI::Compile exists.  Can that be used with a
> standalone Perl HTTP server?

Yes, it can.  CGI::Compile is used for example by CGI::Emulate::PSGI,
and you can run PSGI app on standalone Perl web server (pure Perl
HTTP::Server::PSGI, or HTTP::Server::Simple::PSGI which in turn uses
HTTP::Server::Simple, or Starman, or Twiggy, or Perlbal).  CGI::Compile
just compiles given CGI script into a subroutine, which can be called
many times in a persistent web environment like FastCGI.

> 
> It's 2010 now and I have long abandoned FastCGI in favor of using HTTP
> to the application backends.  In my experience, having only one
> plain-text protocol for both frontend web serving and backend
> application RPC makes development/monitoring/testing much easier.

Do you mean here standalone web server in the language of web application?

>
> I just use Ruby WEBrick nowadays for any instaweb instances I run to
> share with a few cow-orkers.  I do a reasonable amount of development in
> Ruby, so it's always installed and ready for me.  It would be nice if
> there were something standalone and as ubiquitous as WEBrick in the Perl
> world.

Modern Perl has PSGI/Plack (http://plackperl.org), which was inspired by
Python's WSGI and Ruby's Rack.  The Plack reference implementation includes
'plackup' tool (inspired by Ruby's 'rackup'), which can be used to run
a PSGI application on any supported web server (with Plackup's adapter),
like HTTP::Server::PSGI, HTTP::Server::Simple::PSGI, etc.

PSGI/Plack goal is to be THE superglue interface between perl web 
application frameworks and web servers.


P.S. BTW, I use the following wrapper for gitweb.cgi (in gitweb.psgi)

-- 8< --
#!/usr/bin/env plackup

# gitweb - simple web interface to track changes in git repositories
#          PSGI wrapper (see http://plackperl.org)

use strict;
use warnings;

use Plack::Builder;
use Plack::App::WrapCGI;
use CGI::Emulate::PSGI 0.07; # minimum version required to work

use File::Spec;
# __DIR__ is taken from Dir::Self __DIR__ fragment
sub __DIR__ () {
	File::Spec->rel2abs(join '', (File::Spec->splitpath(__FILE__))[0, 1]);
}

builder {
	enable 'Static',
		path => sub { m!\.(js|css|png)$! && s!^/gitweb/!! }, root => __DIR__."/";
	Plack::App::WrapCGI->new(script => __DIR__."/gitweb.cgi")->to_app;
}

__END__
-- >8 --

Thanks to the she-bang line (I don't have plackup installed globally, 
but it is in my $PATH) I can just run ./gitweb.psgi to start server
(http://0:5000/) with gitweb running.

-- 
Jakub Narebski
Poland

  parent reply	other threads:[~2010-05-09 12:39 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-07 12:54 [PATCH 0/2] gitweb: Add support for running gitweb as FastCGI script Jakub Narebski
2010-05-07 12:54 ` [PATCH/RFC 1/2] gitweb: Put all per-connection code in run() subroutine Jakub Narebski
2010-05-07 12:54 ` [RFC/PATCH 2/2] gitweb: Add support for FastCGI, using CGI::Fast Jakub Narebski
2010-05-08  7:59   ` [RFC/PATCHv2 " Jakub Narebski
2010-05-08 22:41 ` [PATCH 0/2] gitweb: Add support for running gitweb as FastCGI script Jakub Narebski
2010-05-09  9:31   ` Eric Wong
2010-05-09 11:48     ` Ævar Arnfjörð Bjarmason
2010-05-09 12:39     ` Jakub Narebski [this message]
2010-05-09 16:47       ` Peter Vereshagin
2010-05-09 18:18         ` Jakub Narebski
2010-05-10  7:13           ` Peter Vereshagin
2010-05-10 15:29             ` Jakub Narebski
2010-05-11  6:24               ` Peter Vereshagin
2010-05-11  8:35                 ` Petr Baudis
2010-05-11 10:58                 ` Jakub Narebski
2010-05-11 12:09                   ` Peter Vereshagin
2010-05-11 13:51                     ` Jakub Narebski
2010-05-13 13:10                       ` Peter Vereshagin
2010-05-13 17:13                         ` Ævar Arnfjörð Bjarmason
2010-05-14 15:58                           ` Peter Vereshagin
2010-05-14 10:53                         ` Jakub Narebski
2010-05-14 15:36                           ` Peter Vereshagin
2010-05-14 17:58                             ` Jakub Narebski
2010-05-14 18:43                               ` Jakub Narebski
2010-05-15 10:06                               ` Peter Vereshagin
2010-05-15 13:58                                 ` Jakub Narebski
2010-05-16 10:15                                   ` Peter Vereshagin
2010-05-18  1:06                                     ` Jakub Narebski
2010-05-16 10:26                                   ` Petr Baudis
2010-05-15 11:51                           ` Petr Baudis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201005091439.26310.jnareb@gmail.com \
    --to=jnareb@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=jgoerzen@complete$(echo .)org \
    --cc=juanjo@comellas$(echo .)org \
    --cc=normalperson@yhbt$(echo .)net \
    --cc=peter@vereshagin$(echo .)org \
    --cc=sam.vilain@catalyst$(echo .)net.nz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox