Edgewall Software

Changes between Initial Version and Version 1 of TranslationRu/TracOnWindowsIis6


Ignore:
Timestamp:
Jul 3, 2006, 8:14:07 AM (18 years ago)
Author:
aleviont@…
Comment:

Contribution from #3099 (for some reason, was not created directly in the Wiki)

Legend:

Unmodified
Added
Removed
Modified
  • TranslationRu/TracOnWindowsIis6

    v1 v1  
     1Translated half of TracOnWindowsIis6 manual in Russian, but cannot save my work here...
     2
     3----
     4
     5Инструкция по инсталляции и настройки Subversion с Trac версии 0.9.4
     6
     7для:
     8
     9Windows Server 2003 SP1
     10IIS 6
     11Trac 0.9.4
     12
     13В Сети наличествуют документальные подтверждения того, что Trac очень медленно функционирует на Microsoft's Internet Information Server (IIS), однако работает. За деталями обратитесь к репортам: #692 #693 and #697.
     14
     15--------------------------------------------------------------------------------
     16
     17Замечание №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.
     18
     19
     20--------------------------------------------------------------------------------
     21
     22Замечание №2: В ходе этого опыта все устанавливается на диск F:
     23
     24
     25--------------------------------------------------------------------------------
     26
     27=== Вооружитесь ===
     281. Прочтите книгу
     29  http://svnbook.red-bean.com
     30
     31=== Install Subversion Pre-Requisites ===
     322. Скачайте и установите Python (версию 2.3.5, поскольку 2.4 не имеет соответствующих plugins для svn).
     33  http://www.python.org/download/releases/2.3.5/
     34 
     35  Добавьте F:\Python23 в переменные окружения
     36 
     37  Учтите что инсталляци по пути содержащем пробелы может помешать продолжению, поскольку IIS6 не любит интерпретаторы cgi содержащие пробелы в своем пути.
     38
     393. Установите IIS
     40  Control panel -> Configure server roles...
     41
     424. Установите Subversion
     43  http://subversion.tigris.org (не забудьте, что вам понадобится Питоновская обвязка)
     44
     455. Установите docutils
     46  http://docutils.sourceforge.net/
     47{{{
     48  Разожмите архив в папку и запустите там
     49  > F:\python23\python install.py
     50}}}
     51
     52=== Создание репозитария ===
     536. Создайте репозитарий командой
     54{{{
     55F:\> svnadmin create f:\tracsvn --fs-type fsfs
     56}}}
     57
     58Типо repo не работает в связке Trac на Windows (возможно замыкается). Тип fsfs работает достаточно хорошо.
     59
     608. Создайте скелет структуры репозитария во временной папке f:\temp\project
     61{{{
     62/project
     63  /vendor
     64    /tags
     65    /trunk
     66      files
     67  /projectname
     68    /branches
     69    /tags
     70    /trunk
     71      files
     72}}}
     73
     749. Постройте дерево репозитария командой
     75{{{
     76f:\> svn import f:\temp\project file:///f:/tracsvn/ -m "Initial Load"
     77}}}
     78
     7910. Создайте локальный SVN sandbox
     80{{{
     81f:\> svn checkout file:///f:/svn/repo1 f:\project
     82}}}
     83 (У меня не прошло, выдало сообщение об ошибке)
     84
     85=== Конфигурация IIS ===
     86
     8711. Создайте запись локального пользывателя Service-Trac
     88 * добавьте его в локальную группу IIS_WPG
     89
     9012. Разрешите данному пользователю Service-Trac запускать cgi скрипты.
     91 * Grant '''Service-Trac''' the following permissions in the 'Local Security Policy' Administrative Tool:
     92  * Security Settings > Local Policies > User Rights Assignment > Adjust Memory Quotas for a process
     93  * Security Settings > Local Policies > User Rights Assignment > Replace a process level token
     94  * Дополнительная информация доступна  [http://www.microsoft.com/resources/documentation/iis/6/all/proddocs/en-us/ca_configcgi.mspx на сайте Microsoft].
     95
     9613. Добавьте Python CGI web service extension к IIS
     97  В Контрольной панели IIS добавьте new web service extension.
     98  Управляющий файл [F:\Python23\python.exe -u "%s" %s]. Не забудьте разрешить данное разширение для использования.
     99
     10014. Виртуальные директории IIS
     101  Добавьте виртуальную директорию /trac в Панели управления IIS. Ей не надо право на исполнение каких-либо разширений, поскольку все это будет обрабатываться в /trac/cgi-bin. Назначте виртуальной директории /trac путь к [F:\Python23\share\trac\htdocs]. Убедитесь что Anonymous/Windows authentication установленны как требования использования.
     102
     103  Добавьте виртуальную директорию cgi-bin в дерево под /trac через Панель управления IIS. Эта директория должна иметь разрешение на execute. Назначте этой директории путь к [F:\Python23\share\trac\cgi-bin].
     104
     10515. IIS Application Pool
     106  Создайте новый программный пул в Панели управления IIS. (c данным пунктом автор перевода не разобрался)
     107  Change the Identity of the new pool to Configurable and enter the details for the Service-Trac user you defined earlier.
     108
     109  Измените настройки Application виртуальной директории /trac/cgi-bin: нажмите на Настройки и добавьте новый Mapping.
     110 * Executable: [F:\Python23\python.exe -u "%s" %s] - Эта строка должна быть идентична указанной в выполнении пункта 13 данного руководства.
     111 * Extension: [cgi]
     112 * Verbs: All verbs
     113 * Script Engine: checked
     114 * Verify that file exists: unchecked
     115
     116 Измените программный путь на созданный Вами.
     117
     11816. Fix up permissions
     119  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
     120
     121=== Install Trac Prerequisites ===
     12217. Install Subversion Python Bindings
     123  (Get from same download page as Subversion - http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91. Currently only supports Python 2.3 - NOT 2.4)
     124  [[br]]Copy libsvn and svn directories to F:\Python23\Lib
     125
     12618. Install SQLite
     127  http://www.sqlite.org/download.html
     128  [[br]]Copy sqlite.exe to F:\Program Files\SQLite
     129  This is really optional. Don't let it mess your disk unless something exceptional not described here happens.
     130
     13119. Install PySQLite
     132  http://www.initd.org/tracker/pysqlite
     133
     13420. Install ClearSilver
     135  http://www.clearsilver.net
     136
     13721. Install Trac
     138  http://projects.edgewall.com/trac/wiki/TracDownload
     139  Use the Windows installer to avoid having to manually install Trac with Python.
     140
     141=== Modify a few Python scripts to cater for peculiarities specific to IIS ===
     142
     14322. Fix the CGI
     144
     145In [F:\Python23\Share\Trac\cgi-bin\trac.cgi]
     146 modify the section between the try/except block to be as follows:
     147{{{
     148try:
     149    from trac.web import cgi_frontend
     150    # PATCH IIS6 - start
     151    import os
     152    os.environ['TRAC_ENV'] = 'F:\\tracsvn\\Trac.db'
     153    # PATCH IIS6 - end
     154    cgi_frontend.run()
     155except Exception, e:
     156}}}
     157
     158The TRAC_ENV line is important as IIS6 won't pass this environment variable to the script when it runs.
     159
     16023. Fix Python file - api.py
     161
     162In [F:\Python23\Lib\site-packages\trac\web\api.py], in the [redirect] function on the Request class, replace the entire function with:
     163{{{
     164    def redirect(self, url):
     165        """Send a redirect to the client, forwarding to the specified URL. The
     166        `url` may be relative or absolute, relative URLs will be translated
     167        appropriately.
     168        """
     169        base_url = '%s://%s' % ("http", os.getenv('SERVER_NAME'))
     170        if self.session:
     171            self.session.save() # has to be done before the redirect is sent
     172        self.send_response(302)
     173        if not url.startswith('http://') and not url.startswith('https://'):
     174            # Make sure the URL is absolute
     175            url = absolute_url(self, url)
     176        self.send_header('Location', base_url + url)
     177        self.send_header('Content-Type', 'text/plain')
     178        self.send_header('Pragma', 'no-cache')
     179        self.send_header('Cache-control', 'no-cache')
     180        self.send_header('Expires', 'Fri, 01 Jan 1999 00:00:00 GMT')
     181        self._send_cookie_headers()
     182        self.end_headers()
     183
     184        if self.method != 'HEAD':
     185            self.write('Redirecting...')
     186
     187        raise RequestDone
     188}}}
     189
     190
     19124. Fix Python file - cgi_frontend.py
     192
     193In [F:\Python23\Lib\site-packages\trac\web\cgi_frontend.py], class CGIRequest, change the real_cgi_start function  where it says :
     194{{{
     195        self.path_info = self.__environ.get('PATH_INFO', '')
     196}}}
     197
     198  Change this to:
     199{{{
     200
     201        # IIS 6 Change
     202        self.path_info = self.__environ.get('PATH_INFO', '')
     203        self.path_info = self.path_info.replace(os.getenv('SCRIPT_NAME'),"")
     204        # End IIS 6 Change
     205
     206}}}
     207
     208=== Configure Trac DB ===
     209
     210The 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).
     211
     21225. Run trac-admin
     213{{{
     214f:\Python23\Scripts> python trac-admin f:/tracsvn/trac.db
     215}}}
     216
     21726. Initialize DB
     218
     219Note: 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.
     220
     221{{{
     222Trac [f:/tracsvn/trac.db]> initdb
     223}}}
     224or
     225{{{
     226Trac [f:/tracsvn/trac.db]> initenv
     227}}}
     228{{{
     229  Enter project name
     230    Project
     231  Database Connection String
     232    sqlite:db/trac.db
     233  Enter path to repository
     234    f:\tracsvn\
     235  Enter path to templates
     236    f:\Python23\share\trac\templates
     237}}}
     238
     239If 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.
     240
     24127. (BUG) Load Wiki
     242{{{
     243Trac [f:/tracsvn/trac.db]> wiki load f:/python23/share/trac/wiki-default
     244}}}
     245
     24628. Add administrative permissions (the below adds all permissions for 'admin' user)
     247{{{
     248Trac [f:/tracsvn/trac.db]> permission add admin TRAC_ADMIN
     249}}}
     250
     251Note that if you're using windows authentication with iis6 you can grant permissions to windows users here. Eg.
     252{{{
     253Trac [f:/tracsvn/trac.db]> permission add STAR\Administrator TRAC_ADMIN
     254}}}
     255If your iis server's windows network name is "STAR", or your iis server is in the "STAR" domain.
     256
     257=== Finally... ===
     25829. Install Subversion clients as necessary (try [http://rapidsvn.tigris.org RapidSVN] & [http://tortoisesvn.tigris.org/ TortoiseSVN])
     259
     26030. Don't forget to lock down the security on the box!
     261
     26231. Now go get a *real* drink