Serving HG repositories on Windows 2012 R2 Server.
Anders Ishoey (INT)
Anders.Ishoey at teledyne-reson.com
Thu Sep 24 12:52:47 UTC 2015
Hi Aaron and Matt,
I used your installation guide advice and I have tried lots of other stuff too, but bottom line is that I don't think I can get any further until I get a 2008 server to run at.
The URL rewrite did not do the trick.
I was actually using 2.7.10.
Yes modifying Random is not the way to go.
If you have any positive confirmation that someone is running HG on 2012 IIS8.5 (and what versions they use) I would be happy to be updated.
In that case I would also need some details about accounts (application pool?) that is needed.
I'm grateful for the help you already gave, and I don't expect that you spend more time on it.
/Anders
Additional info in case you are interested:
Uninstalled python and mercurial python.
Then I followed the guide https://mercurial.selenic.com/wiki/HgWebInIisOnWindows, but on windows server 2012 R2 it already failed (consistently) at the test.CGI. (due to python 2.6.6)
Adding the <handler> did not help, but allowing any CGI to run was necessary.
I then installed Python2.7.10 (Python 2.7.10 - 2015-05-23<https://www.python.org/downloads/release/python-2710/> Windows x86-64 MSI installer<https://www.python.org/ftp/python/2.7.10/python-2.7.10.amd64.msi>) which made the test.cgi script pass.
Running hgweb.cgi failed from the browser (already at import cgi.)
"import cgi" worked from the python command line on the server but not when included in a script started via the browser.
At this point I don't see that it is a HG problem.
It seems to be a CGI-IIS problem like reported here (http://forums.iis.net/t/1192084.aspx) who says:
"Somehow it seems like my python CGI script does not have access to that function when running from the IIS, while it has access to that function when run from a command prompt"
However, If I could find the reason why the script fails it would be good. therefore :
If I then edit random.py I can proceed as described in my previous mail. Here is some additional information on the subject
I dont see anything interesting in the server log. Are there any more interesting logs that I can enable?
#Software: Microsoft Internet Information Services 8.5
#Version: 1.0
#Date: 2015-09-24 11:47:04
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2015-09-24 11:47:04 10.45.3.27 GET /TestRepo cmd=capabilities 443 - 10.45.2.210 mercurial/proto-1.0 - 401 2 5 0
2015-09-24 11:47:12 10.45.3.27 GET /TestRepo cmd=capabilities 443 air 10.45.2.210 mercurial/proto-1.0 - 200 0 0 281
2015-09-24 11:47:12 10.45.3.27 GET /TestRepo cmd=batch 443 - 10.45.2.210 mercurial/proto-1.0 - 401 2 5 0
2015-09-24 11:47:12 10.45.3.27 GET /TestRepo cmd=batch 443 air 10.45.2.210 mercurial/proto-1.0 - 200 0 0 218
2015-09-24 11:47:12 10.45.3.27 POST /TestRepo cmd=unbundle 443 - 10.45.2.210 mercurial/proto-1.0 - 401 2 5 15
2015-09-24 11:47:12 10.45.3.27 POST /TestRepo cmd=unbundle 443 air 10.45.2.210 mercurial/proto-1.0 - 502 2 1 109
I intended to use a debugger (https://wiki.python.org/moin/PythonDebuggingTools) to see exactly what stop the program now.
However, I don't think it will work as the debugger will have to run in some account, and exactly that may impact the debugging result.
So I have more or less given in.
/Anders Ishøy-Rasmussen
Systems Architect
Teledyne-Reson
From: Jensen, Aaron [mailto:ajensen at webmd.net]
Sent: 2015-09-23 18:47
To: Anders Ishoey (INT); mercurial at selenic.com
Subject: RE: Serving HG repositories on Windows 2012 R2 Server.
We have Mercurial running, without changes to Python or Mercurial code, on Windows 2008 R2. The steps are documented on the https://mercurial.selenic.com/wiki/HgWebInIisOnWindows wiki page.
I believe the problem is that you have hgweb.cgi in the URL, which won't work. See section 3, Configuring IIS Rewrite Rules.
From: Mercurial [mailto:mercurial-bounces at selenic.com] On Behalf Of Anders Ishoey (INT)
Sent: Wednesday, September 23, 2015 7:38 AM
To: mercurial at selenic.com
Subject: Serving HG repositories on Windows 2012 R2 Server.
Hi,
I'm trying to set up a 2012 R2 windows server with mercurial HG.
browsing, pull, clone,add,commit works. push doesn't work.
Setup:
Basic authentication, pass-through, SSL
Python 2.7 (had to modify random.py. line 114 to make it work)
I only have that single python version.
Using hgweb.cgi
mercurial-3.3.3.win32-py2.7.msi is installed in the python site-packages directory.
Browsing my repositories, cloning and updating on HTTPS works
However, I can't push.
Repositories are in c:\users\public\hg_repos
I have full rights in hg_repos and everything below.
Scripts are in c:\users\public\hgweb
I have placed a web.allow_push = * in .rc\hgrc in the repository
I have tried
mercurial-3.3.3.win-amd64-py2.7.msi
mercurial-3.5.1.win32-py2.7.msi
mercurial-3.5.1.win-amd64-py2.7.msi
mercurial-3.5.win-amd64-py2.7.msi
But none of these can even browse directories. (DLL load error. Dont know the name of the DLL)
In parallel with all this I have a regular (non-python) hg installation for "hg init" on the server.
Q1) Is there some setting in the IIS webserver itself that can prevent writing and cause the error?
Q2) Is there a known good installer configuration for Windows server 2012.
Q2a) is python 3.0 better? Is there a mercurial-python3.0 installer available?
Q3) Are there (simple) tools that can tell more aobut the error
Error:
password:
searching for changes
abort: HTTP Error 502: Bad Gateway
Or, with more detailed output:
abort: 'https://slasvn02/hgweb.cgi/TestRepo' does not appear to be an hg repository:
---%<--- (text/html)
<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><pre>Traceback (most recent call last):
File "C:\Users\Public\hgweb\hgweb.cgi", line 57, in <module>
application = hgweb(config)
File "c:\Python27\lib\site-packages\mercurial\hgweb\__init__.py", line 26, in hgweb
return hgwebdir_mod.hgwebdir(config, baseui=baseui)
File "c:\Python27\lib\site-packages\mercurial\hgweb\hgwebdir_mod.py", line 89, in __init__
self.refresh()
File "c:\Python27\lib\site-packages\mercurial\hgweb\hgwebdir_mod.py", line 98, in refresh
u = ui.ui()
File "c:\Python27\lib\site-packages\mercurial\demandimport.py", line 114, in __getattribute__
self._load()
File "c:\Python27\lib\site-packages\mercurial\demandimport.py", line 86, in _load
mod = _hgextimport(_import, head, globals, locals, None, level)
---%<---
hgweb\hgweb.config
# all repos in subdirectories of "collections" will be exposed/visible on the web interface.
[collections]
c:/Users/Public/hg_repos = c:/Users/Public/hg_repos
[web]
allow_push = *
users = *
push_ssl = true
hgweb\hgweb.cgi
#!c:\Python27\python.exe
#This location is the one that is called: c:\Users\Public\hgweb\hgweb.cgi
import os;
import sys;
sys.path.insert(0, "c:\program files (x86); c:\Python27\Lib\site-packages\mercurial")
sys.path.insert(0, "c:\Python27\Lib\site-packages\mercurial\pure")
os.environ['PYTHONPATH'] = "c:\Python27\Lib\site-packages\mercurial; "
import cgi
from cgi import escape
config="hgweb.config"
import cgitb; cgitb.enable(display=1)
from mercurial import demandimport; demandimport.enable()
from mercurial.hgweb import hgweb, wsgicgi
application = hgweb(config)
wsgicgi.launch(application)
.rc\hgrc
[paths]
c:/Users/Public/hg_repos/TestRepo = c:/Users/Public/hg_repos/TestRepo
[ui]
username = "anders Ishoy "
[web]
baseurl = C:\Users\Public\hg_repos\TestRepo
allow_push = *
users = *
Thanks
Anders Ishøy-Rasmussen
Systems Architect
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20150924/f4df66d5/attachment-0002.html>
More information about the Mercurial
mailing list