From: Jakub Narebski <jnareb@gmail.com>
To: Tatsuhiko Miyagawa <miyagawa@gmail.com>
Cc: git@vger.kernel.org, Peter Vereshagin <peter@vereshagin.org>,
Petr Baudis <pasky@suse.cz>, Eric Wong <normalperson@yhbt.net>,
Sam Vilain <sam.vilain@catalyst.net.nz>,
Juan Jose Comellas <juanjo@comellas.org>,
John Goerzen <jgoerzen@complete.org>
Subject: Re: gitweb, FastCGI and PSGI/Plack
Date: Mon, 10 May 2010 18:26:07 +0200 [thread overview]
Message-ID: <201005101826.10735.jnareb@gmail.com> (raw)
In-Reply-To: <t2n693254b91005091759ye577992y32d2b6a41d7d8c45@mail.gmail.com>
On Sun, May 9, 2010 at 17:59:11 -0700, Tatsuhiko Miyagawa wrote:
> On Sun, May 9, 2010 at 4:05 PM, Jakub Narebski <jnareb@gmail.com> wrote:
>
> > Moving to PSGI, or adding possibility to run gitweb as PSGI script (like
> > the series adds *ability* to run gitweb as FastCGI script) by modifying
> > gitweb would not be that easy, even with help of CGI::PSGI.
>
> You don't need it - since you can just use Plack::App::WrapCGI.
It is simplest method, but I don't think it is best one from the
performance and especially latency point of view.
As I understand it, CGI::Compile catches all STDOUT output of compiled
CGI script, and passes it to PSGI layer (PSGI interface). That doesn't
allow, I think, for serving request as it is generated. This might be
important for actions (pages) such as 'snapshot', 'blob_plain' and
'patches', which simply dump output of external comand to STDOUT. If
gitweb was written as PSGI app, or with PSGI-compliant web framework,
it would return IO::Handle-like object.
Also I think that currently you can currently see in web browser page as
it is being generated by gitweb (e.g. 'projects_list' page). This is
impossible (I guess) with CGI::Compile.
There is also a problem that there is no way, I guess, to automatically
reload / refresh app if underlying CGI script changes (a la "plackup -r").
> > CGI::Compile was referring to an alternate approach, where instead of
> > modifying gitweb to be able to run it as FastCGI script (you can run it
> > as CGI script and as ModPerl::Registry script from mod_perl) there was
> > added gitweb.fcgi wrapper:
>
> and the .fcgi wrapper can just use Plack::Loader, or the plackup
> executable with FCGI environment variable set, to DWIM.
Right, having gitweb.psgi PSGI wrapper, which can be run not only via
FCGI, but also on many other web servers, is certainly superior to
having gitweb.fcgi FastCGI wrapper, which allows to run gitweb as
FastCGI script (on FCGI server).
> > One can of course use this approach wrapping gitweb to be run on PSGI,
> > using CGI::Emulate::PSGI (via Plack::App::WrapCGI), which in turn uses
> > CGI::Compile. The gitweb.fcgi wrapper could use CGI::Emulate::FCGI...
> > if it existed.
>
> Again, you still don't understand - once your CGI script is turned
> into PSGI, plackup can take over the web server interface, including
> the FastCGI interface. If you need .fcgi wrapper to be spawned from
> web servers, just put plackup command line call (or Plack::Runner or
> ::Loader) in the .fcgi script.
I didn't made myself clear here.
What I want, like I wrote in neighbour subthread, is for the FastCGI app
that looks like this:
use CGI::Fast;
do_some_initialization();
while ($q = new CGI::Fast) {
process_request(); # it uses 'my $cgi = CGI->new()' inside
}
to make PSGI application that runs do_some_initialization() only once,
and returns converted-to-PSGI process_request() as PSGI subroutine (as
PSGI $app).
--
Jakub Narebski
jnareb on #plack
Poland
next prev parent reply other threads:[~2010-05-10 16:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <g2s693254b91005091428ib188cbd1le5ffa90eace741a8@mail.gmail.com>
2010-05-09 23:05 ` gitweb, FastCGI and PSGI/Plack Jakub Narebski
2010-05-10 0:59 ` Tatsuhiko Miyagawa
2010-05-10 16:26 ` Jakub Narebski [this message]
2010-05-10 17:14 ` Tatsuhiko Miyagawa
2010-05-10 1:05 ` Tatsuhiko Miyagawa
2010-05-10 10:32 ` Jakub Narebski
2010-05-10 17:03 ` Tatsuhiko Miyagawa
2010-05-10 18:40 ` Jakub Narebski
2010-05-10 18:43 ` Tatsuhiko Miyagawa
2010-05-10 21:10 ` Jakub Narebski
2010-05-11 0:07 ` Tatsuhiko Miyagawa
2010-05-11 9:29 ` Jakub Narebski
2010-05-11 9:44 ` Peter Vereshagin
2010-05-11 18:56 ` Tatsuhiko Miyagawa
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=201005101826.10735.jnareb@gmail.com \
--to=jnareb@gmail.com \
--cc=git@vger.kernel.org \
--cc=jgoerzen@complete.org \
--cc=juanjo@comellas.org \
--cc=miyagawa@gmail.com \
--cc=normalperson@yhbt.net \
--cc=pasky@suse.cz \
--cc=peter@vereshagin.org \
--cc=sam.vilain@catalyst.net.nz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).