hgweb serve behind apache

Gregory Szorc gregory.szorc at gmail.com
Tue Jan 17 22:03:40 UTC 2017


On Tue, Jan 17, 2017 at 1:21 PM, Jérôme Godbout <jerome at bodycad.com> wrote:

> Hi,
>
> I'm currently moving our hgweb server from Window to Linux (CentOS 7). I
> have a working pull but cannot push through http:
>
> *hg push http://10.1.30.67/TestRepos <http://10.1.30.67/TestRepos>*
> *pushing to http://10.1.30.67/TestRepos <http://10.1.30.67/TestRepos>*
> *searching for changes*
> *'http://10.1.30.67/TestRepos <http://10.1.30.67/TestRepos>' does not
> appear to be an hg repository:*
> *---%<--- (text/html; charset=UTF-8)*
> *<body bgcolor="#f0f0f8"><font color="#f0f0f8" size="-5"> -->*
> *<body bgcolor="#f0f0f8"><font color="#f0f0f8" size="-5"> --> -->*
> *</font> </font> </font> </script> </object> </blockquote> </pre>*
> *</table> </table> </table> </table> </table> </font> </font> </font><body
> bgcolor="#f0f0f8">*
> *<table width="100%" cellspacing=0 cellpadding=2 border=0
> summary="heading">*
> *<tr bgcolor="#6622aa">*
> *<td valign=bottom> <br>*
> *<font color="#ffffff" face="helvetica,
> arial"> <br><big><big><strong><type
> 'exceptions.OSError'></strong></big></big></font></td*
> *><td align=right valign=bottom*
> *><font color="#ffffff" face="helvetica, arial">Python 2.7.5:
> /usr/bin/python<br>Tue Jan 17 16:05:36 2017</font></td></tr></table>*
>
> *<p>A problem occurred in a Python script.  Here is the sequence of*
> *function calls leading up to the error, in the order they occurred.</p>*
> *<table width="100%" cellspacing=0 cellpadding=0 border=0>*
> *<tr><td bgcolor="#d8bbff"><big> </big><a
> href="file:///var/www/cgi-bin/hgweb.cgi">/var/www/cgi-bin/hgweb*
> *---%<---*
>
>
> I can browse the repos on the web interface.
> Here's the current .cgi file (I will try to migrate to wsgi after
> everything work):
>
> *#!/usr/bin/env python*
>
> *# Path to repo or hgweb config to serve (see 'hg help hgweb')*
> *config = "/var/www/cgi-bin/hgserve.config"*
>
> *# Uncomment to send python tracebacks to the browser if an error occurs:*
> *import cgitb; cgitb.enable()*
>
> *from mercurial import demandimport; demandimport.enable()*
> *from mercurial.hgweb import hgweb, wsgicgi*
>
> *application = hgweb(config)*
> *wsgicgi.launch(application)*
>
>
> Here the hgserve.config
>
> *[paths]*
> *TestRepos = /mnt/hg/TestRepos/**
>
> *[web]*
> *contact = cad at bodycad.com <cad at bodycad.com>*
> *description = Laboratoire Bodycad repositories*
> *allow_archive = zip*
> *push_ssl = False*
> *allow_push = **
> *allow_pull = True*
> *allow_read = **
> *baseurl = /*
> *staticurl = /static/*
> *verbose = True*
>
>
> This config file work under our Window installation (only the drive is not
> mount but access directly //host/TestRepos/* with credential already save
> under windows). The pull work as expected.
>
> The drive is mounted and *sudo -u apache touch
> /mnt/hg/TestRepos/myFileTouch* does work so permission seem to be fine. I
> try disabling selinux s=just to make sure I wasn't having any trouble. The
> /mnt/hg is an NTFS file server mount with cifs.
>
> The only trace into the apache log is a return code 200 OK:
>
> "GET / HTTP/1.1" 200 2281
> "GET /static/hgicon.png HTTP/1.1" 200 792
> "GET /TestRepos/ HTTP/1.1" 200 3465
> "GET /TestRepos?cmd=capabilities HTTP/1.1" 200 356
> "GET /TestRepos?cmd=batch HTTP/1.1" 200 43
> "GET /TestRepos?cmd=listkeys HTTP/1.1" 200 58
> "GET /TestRepos?cmd=listkeys HTTP/1.1" 200 -
> "GET /TestRepos?cmd=branchmap HTTP/1.1" 200 48
> "GET /TestRepos?cmd=branchmap HTTP/1.1" 200 48
> "GET /TestRepos?cmd=listkeys HTTP/1.1" 200 -
> "POST /TestRepos?cmd=unbundle HTTP/1.1" 200 33470
>
>
> Anybody have an idea of what is going on?
>
>
I don't see anything obvious here. But I have some suggestions.

First, try to get the server working without the cifs mount point. Copy the
repo to the local filesystem and get that working first. If that works,
then you know where to look for further debugging.

Second, I'd encourage you to ditch CGI and use WSGI. Since you are using
Apache httpd, you probably want to use mod_wsgi. If nothing else, the
performance of mod_wsgi will be better than CGI. Mozilla's Ansible role for
running the HTTP component of hg.mozilla.org (also using CentOS 7) lives at
https://hg.mozilla.org/hgcustom/version-control-tools/file/tip/ansible/roles/hg-web.
The most interesting file to you is likely
https://hg.mozilla.org/hgcustom/version-control-tools/file/tip/ansible/roles/hg-web/templates/vhost.conf.j2.
We also install mod_wsgi to a virtualenv and have httpd run mod_wsgi and
Python out of that virtualenv because the official CentOS mod_wsgi package
is a bit old IIRC.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20170117/bff42b28/attachment-0002.html>


More information about the Mercurial mailing list