programing tip

IIS에서 Mercurial과 hgwebdir을 어떻게 설정합니까?

itbloger 2020. 10. 27. 07:54
반응형

IIS에서 Mercurial과 hgwebdir을 어떻게 설정합니까?


나는 IIS에서 hgwebdir을 작동시키는 방법에 대한 적절한 지침을 찾아 보았지만 그다지 가치가 없습니다.

있다 이 "단계적으로" 의욕 위키,하지만 매우 좋지 않다. 이 또한있어 , 그러나 다시, 나는 그 GET 시작 어디까지 이끌 좋은 단계를 찾을 수 없습니다.


어제 새로운 Mercurial 인스턴스를 설치해야했습니다. 다음은 1.7에 대한 업데이트 된 지침입니다.

  1. Mercurial 설치 (이 지침은 1.7에서 테스트 됨)
  2. Python 설치 (Mercurial 1.7의 경우 x86 버전의 Python 2.6.6을 사용해야 함)
  3. Mercurial 소스에서 hgweb.cgi 파일을 다운로드해야합니다. 다음을 실행하여 소스를 다운로드 할 수 있습니다.hg clone https://www.mercurial-scm.org/repo/hg/
  4. 웹 응용 프로그램 폴더가 될 폴더를 만듭니다. 이 폴더에 다음 세 가지를 복사해야합니다.

    • hgweb.cgi 파일
    • "C : \ Program Files \ Mercurial"폴더에있는 Library.zip의 내용
    • "C : \ Program Files \ Mercurial"의 Templates 폴더
  5. IIS에서 Python을 설정했는지 확인해야합니다.

    • 다음을 통해 CGI를 활성화합니다. 제어판-> Windows 기능 켜기 또는 끄기-> 역할-> 웹 서버 (IIS)-> 역할 서비스 추가-> CGI 확인
    • IIS에서 새 웹 사이트를 만들고 실제 경로가 위에서 만든 폴더인지 확인합니다.
    • 새 웹 사이트의 처리기 매핑에서 "스크립트 맵 추가"를 선택합니다. 요청 경로로 * .cgi입력 하고 실행 파일로 c : \ Python26 \ python.exe -u "% s" , 이름으로 Python 을 입력합니다.
  6. 또한 아래와 비슷한 내용으로 "hgweb.config"라는 파일을 만들어야합니다. 파일 내의 경로는 Mercurial 저장소를 저장할 드라이브의 위치 여야합니다.

    [컬렉션]
    c : \ Mercurial \ repos = c : \ Mercurial \ repos

  7. hgweb.cgi 파일을 편집하고 hgweb.config에 대한 경로를 설정하는 행을 다음과 같이 변경하십시오 (hgweb.config 파일이있는 위치에 관계없이).

    config = "C : \ Mercurial \ hgweb.config"

  8. 이제 브라우저를 열고 http : //localhost/mercurial/hgweb.cgi (또는 IIS에서 설정 한 적절한 URL 경로)로 이동하면 Mercurial Repositories 페이지가 표시됩니다.

또한 Jeremy Skinners 블로그 게시물을 확인하세요 . 약간 구식이지만 더 깨끗한 URL을 위해 URL 재 작성을 설정하는 것과 같은 몇 가지 좋은 단계가 있습니다.


Mercurial 1.5.2가 출시 된 이후로이 튜토리얼이 제대로 작동하지 않는 것 같습니다. 우선, hgwebdir.cgi가 제거되었고 이제 hgweb.cgi로 대체되었습니다.

저에게 가장 잘 맞는 지침은 eworldui.net에 있습니다 .

http://www.eworldui.net/blog/post/2010/04/08/Setting-up-Mercurial-server-in-IIS7-using-a-ISAPI-module.aspx

이러한 지침은 IIS 7 이상을위한 것입니다. IIS 6에서 이것을 설정하는 경우 Win2k3 및 IIS 6.0에 대한 유사한 지침을 작성했습니다.

http://partialclass.blogspot.com/2010/05/setting-up-mercurial-server-on-win2k3.html

업데이트 : 이 작업을 시작한 직후 BitBucket이 무료, 무제한, 비공개 호스팅을 제공하도록 가격 책정 체계를 변경했음을 알게되었습니다 : https://bitbucket.org/ . 나는 원래이 프로젝트에서 작업 할 때 심장 박동으로 그것을 선택했을 것입니다.


나는 Vampire Basic 의 블로그 게시물 이 좋은 시작이라는 것을 알았지 만 내가 추구하는 것에 대해 거의 자세하게 다루지 않았습니다.

Active Directory 통합, 푸시 / 풀을위한 보안 권한 설정, 템플릿 사용자 지정을 포함하여 IIS를 처음부터 시작하고 실행할 수 있도록 4 부로 구성된 블로그 게시물을 작성했습니다. 여기에서 재현 해 보겠습니다. Mercurial은 실제로 Linux / Apache에서 호스팅되도록 설계되었습니다.

http://www.endswithsaurus.com/2010/05/setting-up-and-configuring-mercurial-in.html


여기에 상당히 훌륭하고 포괄적 인 튜토리얼이 있습니다 : http://vampirebasic.blogspot.com/2009/06/running-mercurial-on-windows.html


아래는 IIS6에서 hgwebdir.cgi 설정을 얻기 위해 상당한 양의 조사를 한 후 수행 한 작업입니다. 다음 사이트를 기반으로합니다.

서버에 다음을 설치해야합니다.

  • Mercurial (버전 1.5 사용)
  • Python 2.6. Python 버전은 설치된 Mercurial 버전에 따라 다릅니다. Mercurial 1.5는 Python 2.6을 사용합니다. x64를 실행하는 경우에도 x86을 설치합니다.

나를위한 단계는 다음과 같습니다.

  • 웹 사이트에 대한 디렉토리를 만듭니다. 나는 c : \ inetpub \ wwwroot \ hg를 사용했습니다.
  • IIS에서 hg 폴더를 마우스 오른쪽 버튼으로 클릭하고 속성을 선택한 다음 홈 디렉터리 탭을 선택합니다.
  • 애플리케이션 생성 버튼을 클릭합니다. 실행 권한을 "스크립트"로 설정합니다.
  • 홈 디렉토리 탭에서 구성 버튼을 클릭합니다. "애플리케이션 구성"팝업에서 추가 버튼을 클릭하여 애플리케이션 확장을 추가합니다. 실행 파일은 c : \ Python26 \ python.exe -u "% s" "% s"입니다. 확장자는 .cgi입니다. "동사"를 "제한 : GET, HEAD, POST"로 설정합니다. 스크립트 엔진을 모두 확인하고 파일이 있는지 확인하십시오.
  • 디렉토리 보안 탭에서 인증 및 액세스 제어 섹션의 편집 버튼을 클릭합니다. 모든 인증 방법을 선택 취소하고 "기본 인증"방법을 확인하십시오. 원하는 경우 기본 도메인을 Active Directory 도메인으로 설정합니다.
  • IIS에서 왼쪽 패널의 웹 서비스 확장 폴더를 클릭합니다. "새 웹 서비스 확장 추가"링크를 클릭합니다. 확장자 이름은 Python이어야하며 필수 파일은 c : \ Python26 \ python.exe -u "% s" "% s"입니다. 새 확장이 "허용"인지 확인하십시오.

이제 Python이 작동하는지 테스트 할 좋은 시간입니다. 새 Hg 폴더에 test.cgi라는 파일을 만듭니다. 다음 Python 코드를 붙여 넣습니다.

print 'Status: 200 OK'
print 'Content-type: text/html'
print

print '<html><head>'
print ''
print '<h1>It works!</h1>'
print ''
print ''

사이트에 대한 브라우저를 엽니 다 (예 : http : //localhost/hg/test.cgi).

"작동합니다!"가 표시되어야합니다. 브라우저에서.

Next let's get the hgwebdir working.

  • Delete test.cgi
  • clone the hg repo to a new directory: https://www.mercurial-scm.org/repo/hg/
  • copy hgwebdir.cgi to your web directory: c:\inetpub\wwwroot\hg\ from the cloned hg repo
  • Edit the file and change
application = hgwebdir('hgweb.config')
wsgicgi.launch(application)

to

application = hgwebdir('c:\inetpub\wwwroot\hg\hgweb.config')
wsgicgi.launch(application)
  • Unzip the Library.zip file in the Mercurial directory, c:\Program Files\Mercurial\, to your web directory, c:\inetpub\wwwroot\hg\
  • Copy the templates directory from c:\Program Files\Mercurial\templates\ to c:\inetpub\wwwroot\hg\templates\
  • Create a file called hgweb.config in your web directory.

Now is a good time to test it out. Go to the following URL in the browser, http://localhost/hg/hgwebdir.cgi

  • Edit hgweb.config, and paste the following:
[collections]
\\server\share$\Hg\ = \\server\share$\Hg\
[web]
allow_push = *
push_ssl = false

These are all my preferences, for instance we have our repos in subdirectories at \\server\share$\Hg. The web app will run under the permissions of the logged in user via the browser, so they'll need read/write permissions to the share.

The last step is to allow for long connections which can happen when you first clone a repo. Run the following command to increase the timeout to 50 minutes:

cd \inetpub\AdminScripts\
cscript adsutil.vbs GET /W3SVC/CGITimeout 
cscript adsutil.vbs SET /W3SVC/CGITimeout 3000

Use mercurial to clone the mercurial repository:

hg clone https://www.mercurial-scm.org/repo/hg/

you will find hgwebdir.cgi at the top level. It should install like any other cgi script.


I've been fighting with this setup for mercurial 1.7.2 for the past week or so, I had to do things slightly differently than the above articles do in order to get it working.

Posting here because google kept bringing me back here....

Full instructions posted here

I followed a combination of these instructions and these (in the source)

The main differences are that I had to do the "pure python" install of mercurial otherwise it would complain about missing dlls, and I found it was important to use the "python installers" for pywin and isapi-wsgi. (maybe this is obvious to experienced python developers, but I'm a python newbie so it was news to me)

Hope this helps somebody and I'm not just making stuff up (I might be, like i said, python newbie)


The hg red book contains some much better general instructions than I've seen in other places. They are not IIS specific, but they are quite good:

http://hgbook.red-bean.com/read/collaborating-with-other-people.html#sec:collab:cgi


I was running into a "...can not load module..." type error and after some reading, the key for me was to ignore the Library.zip file in the Mercurial folder, and instead use the one from C:\Program Files (x86)\TortoiseHg folder.

That tip I found as #6 in this guide:

http://www.endswithsaurus.com/2010/05/setting-up-and-configuring-mercurial-in.html

Hope this helps someone...


You can try HgLab. This isn't exactly hgwebdir; rather it is a purely managed Mercurial implementation with push and pull server and repository browser.

참고URL : https://stackoverflow.com/questions/818571/how-do-i-set-up-mercurial-and-hgwebdir-on-iis

반응형