git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Adding support for "plackup" and similar web server tools to git-instaweb
@ 2010-05-02  1:17 Jakub Narebski
  2010-05-03 20:56 ` Eric Wong
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Narebski @ 2010-05-02  1:17 UTC (permalink / raw)
  To: git; +Cc: Eric Wong, Christian Couder

I would like to add support for --httpd / instaweb.httpd = plackup
to git-instaweb.  'plackup'[1] is a command line utility to run 
PSGI[2][3] application (CGI application can be wrapped as such[4][5])
from the command line.  

Among others 'plackup' can use standalone HTTP::Server::PSGI server
(in Perl).  This means that one could use git-instaweb with 
--httpd=plackup even without permissions to install CGI scripts;
without admin rights (CPAN modules can be installed localy in one's
home directory using local::lib).


The problem is that contrary to other web servers that can be used by
git-instaweb, (namely apache2, lighttpd, mongoose and webrick), the
'plackup' utility is configured using command line options, and not
via configuration file (well, one can use configuration file, but it
depends on the web server run from plackup).

How should one go with adding support for such httpd?  My first attempt
was putting full command line into 'httpd' in resolve_full_httpd():

+       *plackup*)
+               # plackup is configured via command-line options
+               bind=
+               test x"$local" = xtrue && bind="--host=127.0.0.1"
+               httpd="$httpd --port=$port $bind --app=$fqgitdir/gitweb/app.psgi"
+               ;;

The default standalone web server used by plackup (HTTP::Server::PSGI)
does not have daemon mode, so we would have to do the same as for moongose
web server: set to background and save pid in pidfile in git-instaweb.

OTOH plackup prints information / logs to STDERR, so it would have to be
silenced or redirected to error_log.  Also plackup does not need to have
"$fqgitdir/gitweb/httpd.conf" passed as last argument, but it needs to
be passed PSGI wrapper for CGI (I'd rather not use httpd.conf, but rather
app.psgi or gitweb.psgi for that).


So how should one go with adding support for new web server to git-instaweb,
that is configured via command line options (--port, --host) and not via
config file?

[1] http://p3rl.org/plackup
[2] http://plackperl.org
[3] http://p3rl.org/PSGI
[4] http://p3rl.org/Plack::App::WrapCGI
[5] http://p3rl.org/CGI::Emulate::PSGI
[6] http://p3rl.org/Plack
-- 
Jakub Narebski
Poland

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Adding support for "plackup" and similar web server tools to git-instaweb
  2010-05-02  1:17 Adding support for "plackup" and similar web server tools to git-instaweb Jakub Narebski
@ 2010-05-03 20:56 ` Eric Wong
  2010-05-03 22:25   ` Jakub Narebski
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Wong @ 2010-05-03 20:56 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git, Christian Couder

Jakub Narebski <jnareb@gmail.com> wrote:
> The problem is that contrary to other web servers that can be used by
> git-instaweb, (namely apache2, lighttpd, mongoose and webrick), the
> 'plackup' utility is configured using command line options, and not
> via configuration file (well, one can use configuration file, but it
> depends on the web server run from plackup).
> 
> How should one go with adding support for such httpd?  My first attempt
> was putting full command line into 'httpd' in resolve_full_httpd():
> 
> +       *plackup*)
> +               # plackup is configured via command-line options
> +               bind=
> +               test x"$local" = xtrue && bind="--host=127.0.0.1"
> +               httpd="$httpd --port=$port $bind --app=$fqgitdir/gitweb/app.psgi"
> +               ;;
> 
> The default standalone web server used by plackup (HTTP::Server::PSGI)
> does not have daemon mode, so we would have to do the same as for moongose
> web server: set to background and save pid in pidfile in git-instaweb.
> 
> OTOH plackup prints information / logs to STDERR, so it would have to be
> silenced or redirected to error_log.  Also plackup does not need to have
> "$fqgitdir/gitweb/httpd.conf" passed as last argument, but it needs to
> be passed PSGI wrapper for CGI (I'd rather not use httpd.conf, but rather
> app.psgi or gitweb.psgi for that).
> 
> 
> So how should one go with adding support for new web server to git-instaweb,
> that is configured via command line options (--port, --host) and not via
> config file?

Hi Jakub,

How about generating a small shell script that wraps plackup with the
appropriate command-line options?

-- 
Eric Wong

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Adding support for "plackup" and similar web server tools to git-instaweb
  2010-05-03 20:56 ` Eric Wong
@ 2010-05-03 22:25   ` Jakub Narebski
  0 siblings, 0 replies; 3+ messages in thread
From: Jakub Narebski @ 2010-05-03 22:25 UTC (permalink / raw)
  To: Eric Wong; +Cc: git, Christian Couder

On Mon, 3 May 2010, Eric Wong wrote:
> Jakub Narebski <jnareb@gmail.com> wrote:
> >
> > The problem is that contrary to other web servers that can be used by
> > git-instaweb, (namely apache2, lighttpd, mongoose and webrick), the
> > 'plackup' utility is configured using command line options, and not
> > via configuration file (well, one can use configuration file, but it
> > depends on the web server run from plackup).
> > 
> > How should one go with adding support for such httpd?  My first attempt
> > was putting full command line into 'httpd' in resolve_full_httpd():
> > 
> > +       *plackup*)
> > +               # plackup is configured via command-line options
> > +               bind=
> > +               test x"$local" = xtrue && bind="--host=127.0.0.1"
> > +               httpd="$httpd --port=$port $bind --app=$fqgitdir/gitweb/app.psgi"
> > +               ;;
[...]
> > So how should one go with adding support for new web server to git-instaweb,
> > that is configured via command line options (--port, --host) and not via
> > config file?
> 
> How about generating a small shell script that wraps plackup with the
> appropriate command-line options?

 RFC1925 - The Twelve Networking Truths                      1 April 1996
 
 2. The Fundamental Truths

         (6a) (corollary). It is always possible to add another level of
              indirection.

Just kidding...


More seriously, even currently in git-instaweb the 'httpd' variable
contains web server invocation *with options* (see the case of apache2
and lighttpd, where resolve_full_httpd() ensures that 'httpd' ends
with '-f' in such case.  Using 'httpd' variable to be plackup-with-options
naturally follows from such example.

Shell script (plackup.sh?  gitweb-plackup.sh?  instaweb-plackup.sh?)
might be good idea, though.  Note that we have to create gitweb.psgi
(or app.psgi) CGI-to-PSGI wrapper (and to serve static files like 
gitweb.css) anyway by git-instaweb.

-- 
Jakub Narebski
Poland

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-05-03 22:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-02  1:17 Adding support for "plackup" and similar web server tools to git-instaweb Jakub Narebski
2010-05-03 20:56 ` Eric Wong
2010-05-03 22:25   ` Jakub Narebski

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).