Edgewall Software
Modify

Opened 18 years ago

Last modified 18 years ago

#3099 closed task (fixed)

TranslateRu/TracOnWindowsIis6 - no_save

Reported by: aleviont@… Owned by: Jonas Borgström
Priority: low Milestone:
Component: general Version: 0.9.4
Severity: minor Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Translated half of TracOnWindowsIis6 manual in Russian, but cannot save my work here…


Инструкция по инсталляции и настройки Subversion с Trac версии 0.9.4

для:

Windows Server 2003 SP1 IIS 6 Trac 0.9.4

В Сети наличествуют документальные подтверждения того, что Trac очень медленно функционирует на Microsoft's Internet Information Server (IIS), однако работает. За деталями обратитесь к репортам: #692 #693 and #697.


Замечание №1: Перед тем как устанавливать Trac для работы в среде IIS6, учтите что python под IIS6 работает катастрофически медленно. Рекоммендуем использывать tracd для ускорения производительности. See http://lazutkin.com/blog/2006/feb/18/setting-tools-windows/ → Section "Trac" → Step 4. This results in a significant performance boost over CGI.


Замечание №2: В ходе этого опыта все устанавливается на диск F:


Вооружитесь

  1. Прочтите книгу http://svnbook.red-bean.com

Install Subversion Pre-Requisites

  1. Скачайте и установите Python (версию 2.3.5, поскольку 2.4 не имеет соответствующих plugins для svn). http://www.python.org/download/releases/2.3.5/

Добавьте F:\Python23 в переменные окружения

Учтите что инсталляци по пути содержащем пробелы может помешать продолжению, поскольку IIS6 не любит интерпретаторы cgi содержащие пробелы в своем пути.

  1. Установите IIS Control panel → Configure server roles…
  1. Установите Subversion http://subversion.tigris.org (не забудьте, что вам понадобится Питоновская обвязка)
  1. Установите docutils http://docutils.sourceforge.net/
      Разожмите архив в папку и запустите там
      > F:\python23\python install.py
    

Создание репозитария

  1. Создайте репозитарий командой
    F:\> svnadmin create f:\tracsvn --fs-type fsfs
    

Типо repo не работает в связке Trac на Windows (возможно замыкается). Тип fsfs работает достаточно хорошо.

  1. Создайте скелет структуры репозитария во временной папке f:\temp\project
    /project
      /vendor
        /tags
        /trunk
          files
      /projectname
        /branches
        /tags
        /trunk
          files
    
  1. Постройте дерево репозитария командой
    f:\> svn import f:\temp\project file:///f:/tracsvn/ -m "Initial Load"
    
  1. Создайте локальный SVN sandbox
    f:\> svn checkout file:///f:/svn/repo1 f:\project
    
    (У меня не прошло, выдало сообщение об ошибке)

Конфигурация IIS

  1. Создайте запись локального пользывателя Service-Trac
    • добавьте его в локальную группу IIS_WPG
  1. Разрешите данному пользователю Service-Trac запускать cgi скрипты.
    • Grant Service-Trac the following permissions in the 'Local Security Policy' Administrative Tool:
      • Security Settings > Local Policies > User Rights Assignment > Adjust Memory Quotas for a process
      • Security Settings > Local Policies > User Rights Assignment > Replace a process level token
      • Дополнительная информация доступна на сайте Microsoft.
  1. Добавьте Python CGI web service extension к IIS В Контрольной панели IIS добавьте new web service extension. Управляющий файл [F:\Python23\python.exe -u "%s" %s]. Не забудьте разрешить данное разширение для использования.
  1. Виртуальные директории IIS Добавьте виртуальную директорию /trac в Панели управления IIS. Ей не надо право на исполнение каких-либо разширений, поскольку все это будет обрабатываться в /trac/cgi-bin. Назначте виртуальной директории /trac путь к [F:\Python23\share\trac\htdocs]. Убедитесь что Anonymous/Windows authentication установленны как требования использования.

Добавьте виртуальную директорию cgi-bin в дерево под /trac через Панель управления IIS. Эта директория должна иметь разрешение на execute. Назначте этой директории путь к [F:\Python23\share\trac\cgi-bin].

  1. IIS Application Pool Создайте новый программный пул в Панели управления IIS. (c данным пунктом автор перевода не разобрался) Change the Identity of the new pool to Configurable and enter the details for the Service-Trac user you defined earlier.

Измените настройки Application виртуальной директории /trac/cgi-bin: нажмите на Настройки и добавьте новый Mapping.

  • Executable: [F:\Python23\python.exe -u "%s" %s] - Эта строка должна быть идентична указанной в выполнении пункта 13 данного руководства.
  • Extension: [cgi]
  • Verbs: All verbs
  • Script Engine: checked
  • Verify that file exists: unchecked

Измените программный путь на созданный Вами.

  1. Fix up permissions Change the ownership of, or give Full-Control permissions on F:\tracsvn to Service-Trac. You may also need to change the ownership or grant write/modify on F:\Python23\Lib\site-packages\trac to Service-Trac (so it can write pyc files). Service-Trac will need read access to F:\Python23\share\trac

Install Trac Prerequisites

  1. Install Subversion Python Bindings (Get from same download page as Subversion - http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91. Currently only supports Python 2.3 - NOT 2.4)
    Copy libsvn and svn directories to F:\Python23\Lib
  1. Install SQLite http://www.sqlite.org/download.html
    Copy sqlite.exe to F:\Program Files\SQLite This is really optional. Don't let it mess your disk unless something exceptional not described here happens.
  1. Install PySQLite http://www.initd.org/tracker/pysqlite
  1. Install ClearSilver http://www.clearsilver.net
  1. Install Trac http://projects.edgewall.com/trac/wiki/TracDownload Use the Windows installer to avoid having to manually install Trac with Python.

Modify a few Python scripts to cater for peculiarities specific to IIS

  1. Fix the CGI

In [F:\Python23\Share\Trac\cgi-bin\trac.cgi]

modify the section between the try/except block to be as follows:

try:
    from trac.web import cgi_frontend
    # PATCH IIS6 - start
    import os
    os.environ['TRAC_ENV'] = 'F:\\tracsvn\\Trac.db'
    # PATCH IIS6 - end
    cgi_frontend.run()
except Exception, e:

The TRAC_ENV line is important as IIS6 won't pass this environment variable to the script when it runs.

  1. Fix Python file - api.py

In [F:\Python23\Lib\site-packages\trac\web\api.py], in the [redirect] function on the Request class, replace the entire function with:

    def redirect(self, url):
        """Send a redirect to the client, forwarding to the specified URL. The
        `url` may be relative or absolute, relative URLs will be translated
        appropriately.
        """
        base_url = '%s://%s' % ("http", os.getenv('SERVER_NAME'))
        if self.session:
            self.session.save() # has to be done before the redirect is sent
        self.send_response(302)
        if not url.startswith('http://') and not url.startswith('https://'):
            # Make sure the URL is absolute
            url = absolute_url(self, url)
        self.send_header('Location', base_url + url)
        self.send_header('Content-Type', 'text/plain')
        self.send_header('Pragma', 'no-cache')
        self.send_header('Cache-control', 'no-cache')
        self.send_header('Expires', 'Fri, 01 Jan 1999 00:00:00 GMT')
        self._send_cookie_headers()
        self.end_headers()

        if self.method != 'HEAD':
            self.write('Redirecting...')

        raise RequestDone
  1. Fix Python file - cgi_frontend.py

In [F:\Python23\Lib\site-packages\trac\web\cgi_frontend.py], class CGIRequest, change the real_cgi_start function where it says :

        self.path_info = self.__environ.get('PATH_INFO', '')

Change this to:

        # IIS 6 Change
        self.path_info = self.__environ.get('PATH_INFO', '')
        self.path_info = self.path_info.replace(os.getenv('SCRIPT_NAME'),"")
        # End IIS 6 Change

Configure Trac DB

The trac database can be named to match the subversion repository it is working with, which is especially useful if more than one repository will ever be created. However, I'm not going to try that here (re: DarkReign hard).

  1. Run trac-admin
    f:\Python23\Scripts> python trac-admin f:/tracsvn/trac.db
    
  1. Initialize DB

Note: Before performing this step, ensure that your current user account (ie. the account you are running the command prompt under) has read/write permissions to your SVN directory (f:/tracsvn/) in order to create the Trac Sqlite database.

Trac [f:/tracsvn/trac.db]> initdb

or

Trac [f:/tracsvn/trac.db]> initenv
  Enter project name
    Project
  Database Connection String
    sqlite:db/trac.db
  Enter path to repository
    f:\tracsvn\
  Enter path to templates
    f:\Python23\share\trac\templates

If you get an error here stating that libdb42.dll was not found, copy [SVN PATH]\bin\libdb42.dll to [PYTHON PATH]\lib\libsvn\, then try again.

  1. BUG Load Wiki
    Trac [f:/tracsvn/trac.db]> wiki load f:/python23/share/trac/wiki-default
    
  1. Add administrative permissions (the below adds all permissions for 'admin' user)
    Trac [f:/tracsvn/trac.db]> permission add admin TRAC_ADMIN
    

Note that if you're using windows authentication with iis6 you can grant permissions to windows users here. Eg.

Trac [f:/tracsvn/trac.db]> permission add STAR\Administrator TRAC_ADMIN

If your iis server's windows network name is "STAR", or your iis server is in the "STAR" domain.

Finally…

  1. Install Subversion clients as necessary (try RapidSVN & TortoiseSVN)
  1. Don't forget to lock down the security on the box!
  1. Now go get a *real* drink

Attachments (0)

Change History (1)

comment:1 by Christopher Lenz, 18 years ago

Sorry, accidentially removed change by cboos which said:

Removed ticket spam and created the Wiki page that aleviont wrote but couldn't save for some reason.

Apparently it is now problematic to delete ticket changes from the middle of the history. Bah.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jonas Borgström.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jonas Borgström to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.