Edgewall Software

Changes between Initial Version and Version 1 of 0.12/TranslationRu/TracOnWindowsIis6


Ignore:
Timestamp:
Jul 16, 2012, 9:22:15 PM (12 years ago)
Author:
trac
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • 0.12/TranslationRu/TracOnWindowsIis6

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