[[TranslatedPages(revision=0)]] 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 === 2. Скачайте и установите Python (версию 2.3.5, поскольку 2.4 не имеет соответствующих plugins для svn). http://www.python.org/download/releases/2.3.5/ Добавьте F:\Python23 в переменные окружения Учтите что инсталляци по пути содержащем пробелы может помешать продолжению, поскольку IIS6 не любит интерпретаторы cgi содержащие пробелы в своем пути. 3. Установите IIS Control panel -> Configure server roles... 4. Установите Subversion http://subversion.tigris.org (не забудьте, что вам понадобится Питоновская обвязка) 5. Установите docutils http://docutils.sourceforge.net/ {{{ Разожмите архив в папку и запустите там > F:\python23\python install.py }}} === Создание репозитария === 6. Создайте репозитарий командой {{{ F:\> svnadmin create f:\tracsvn --fs-type fsfs }}} Типо repo не работает в связке Trac на Windows (возможно замыкается). Тип fsfs работает достаточно хорошо. 8. Создайте скелет структуры репозитария во временной папке f:\temp\project {{{ /project /vendor /tags /trunk files /projectname /branches /tags /trunk files }}} 9. Постройте дерево репозитария командой {{{ f:\> svn import f:\temp\project file:///f:/tracsvn/ -m "Initial Load" }}} 10. Создайте локальный SVN sandbox {{{ f:\> svn checkout file:///f:/svn/repo1 f:\project }}} (У меня не прошло, выдало сообщение об ошибке) === Конфигурация IIS === 11. Создайте запись локального пользывателя Service-Trac * добавьте его в локальную группу IIS_WPG 12. Разрешите данному пользователю 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 * Дополнительная информация доступна [http://www.microsoft.com/resources/documentation/iis/6/all/proddocs/en-us/ca_configcgi.mspx на сайте Microsoft]. 13. Добавьте Python CGI web service extension к IIS В Контрольной панели IIS добавьте new web service extension. Управляющий файл [F:\Python23\python.exe -u "%s" %s]. Не забудьте разрешить данное разширение для использования. 14. Виртуальные директории 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]. 15. 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 Измените программный путь на созданный Вами. 16. 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 === 17. 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) [[br]]Copy libsvn and svn directories to F:\Python23\Lib 18. Install SQLite http://www.sqlite.org/download.html [[br]]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. 19. Install PySQLite http://www.initd.org/tracker/pysqlite 20. Install ClearSilver http://www.clearsilver.net 21. 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 === 22. 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. 23. 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 }}} 24. 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). 25. Run trac-admin {{{ f:\Python23\Scripts> python trac-admin f:/tracsvn/trac.db }}} 26. 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. 27. (BUG) Load Wiki {{{ Trac [f:/tracsvn/trac.db]> wiki load f:/python23/share/trac/wiki-default }}} 28. 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... === 29. Install Subversion clients as necessary (try [http://rapidsvn.tigris.org RapidSVN] & [http://tortoisesvn.tigris.org/ TortoiseSVN]) 30. Don't forget to lock down the security on the box! 31. Now go get a *real* drink