Edgewall Software

Changes between Initial Version and Version 35 of TracOnWindowsIis6

(multiple changes)
(multiple changes)
(multiple changes)


  • TracOnWindowsIis6

    v1 v35  
     1== Windows Installation Instructions for Subversion w/ Trac 0.10 ==
     5 * Windows Server 2003 SP1
     6 * IIS 6
     7 * Trac 0.10
     10Note 1: Before continuing to set up Trac to run using IIS6, be warned that python running under IIS6 is painfully slow. It is recommended that the use of [source:trunk/README.tracd#latest tracd] be used for performance reasons. See http://lazutkin.com/blog/2006/feb/18/setting-tools-windows/ -> Section "Trac" -> Step 4. This results in a ''significant'' performance boost over CGI.
     12Comment from W.Berger, Statistisches Landesamt, Stuttgart, Germany:
     13The above may be impossible for some reasons. If you still have to connect Trac to IIS, [trac:TracOnWindowsIisAjp AJP] is a much better solution than CGI.
     15Note 2: This example installs to F: (for extra points, then goes DarkReign hard with a separate application pool and so on.)
     17Comment from follower of this guide: I followed the guide exactly, but could not get it running. Ran perfectly with the "test" web server tracd, but did not even get into trac with IIS. Seems the sub folder configured for cgi-bin is never asked for pages, all requests goes to the root (htdocs).
     18Maybe it is totally wrong of my to post here, but I couldn't find anywhere else to notify other who might be trying to use this guide.
     21Other comment by other follower : I followed the guide but i don't have any directory [F:\Python23]\share\trac\htdocs or .\share\trac\cgi-bin. No more *.cgi files. I don't know where is my misstake.
     24Note f:/tracsvn should be replaced with your path to your Trac project. Also note to view your site for that project you need to go to /trac/cgi-bin/trac.cgi.  You can also make this file the default for the directory so users can just go to the root of the directory instead of needing to hit the direct URL.
     27=== Arm Yourself ===
     281. Get & Read book
     29  http://svnbook.red-bean.com
     31=== Install Subversion Pre-Requisites ===
     322. Download and Install Python (Get version 2.4.4, because v2.5 doesn't have appropriate SVN plugins available EDIT:not true anymore).
     33  http://www.python.org/download/releases/2.4.4/
     35  Add F:\Python23 to path
     37  Note that installing to a path that contains spaces is likely to break the install (iis6 doesn't seem to like cgi interpreters with spaces in their path).
     393. Install IIS
     40  Control panel, Configure server roles...
     424. Install Subversion
     43  http://subversion.tigris.org (remember to get the python bindings as well)
     455. Install docutils (optional for WikiRestructuredText)
     46  http://docutils.sourceforge.net/
     48  expand and run from the expanded docutils-xxx directory
     49  > F:\python23\python install.py
     52=== Create Repository ===
     536. Create repository
     55F:\> svnadmin create f:\tracsvn --fs-type fsfs
     58The bdb repo type doesn't work well with a cgi trac on windows (possibly locking?). The fsfs type works quite well though.
     608. Create skeleton repository structure in f:\temp\project
     61  Example:
     64  /vendor
     65    /tags
     66    /trunk
     67      files
     68  /projectname
     69    /branches
     70    /tags
     71    /trunk
     72      files
     759. Build repository tree
     77f:\> svn import f:\temp\project file:///f:/tracsvn/ -m "Initial Load"
     8010. Create local SVN sandbox
     82f:\> svn checkout file:///f:/svn/repo1 f:\project
     85=== Configure IIS ===
     8711. Create the Service-Trac (local) user
     88 * Add Service-Trac to the IIS_WPG (local) group
     9012. Allow the Service-Trac user to run cgi scripts.
     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  * Together these permission allow the Service-Trac user to run cgi scripts.
     95  * See [http://www.microsoft.com/resources/documentation/iis/6/all/proddocs/en-us/ca_configcgi.mspx] for more information.
     9713. Add a Python CGI web service extension to IIS
     98  In the IIS control panel add a new web service extension.
     99  The required file is [F:\Python23\python.exe -u "%s" %s]. You will also need to enable this extension.
     10114. IIS virtual directories
     102  Add a virtual directory for /trac in the IIS control panel. It doesn't need execute permissions of any description as that will be taken care of by /trac/cgi-bin. Map this to [F:\Python23\share\trac\htdocs]. Ensure that Anonymous/Windows authentication is set as per your usage requirements.
     104  Add a cgi-bin vdir under /trac in the IIS control panel. It needs script execute permissions. Map this to [F:\Python23\share\trac\cgi-bin].
     10615. IIS Application Pool
     107  Add a new application pool in the IIS control panel.
     108  Change the Identity of the new pool to Configurable and enter the details for the Service-Trac user you defined earlier.
     110  Change the Application settings of the /trac/cgi-bin vdir: click Configuration and select the Mappings tab. Add a new mapping.
     111 * Executable: [F:\Python23\python.exe -u "%s" %s] - note that this must be identical to the web service extension added earlier
     112 * Extension: [cgi]
     113 * Verbs: All verbs
     114 * Script Engine: checked
     115 * Verify that file exists: unchecked
     117 Change the Application Pool setting of the cgi-bin vdir to the pool you just created.
     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
     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 and Python 2.4 - NOT 2.5)
     125  [[br]]Copy libsvn and svn directories to F:\Python23\Lib
     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.
     13219. Install PySQLite
     133  http://www.initd.org/tracker/pysqlite
     13520. Install ClearSilver
     136  http://www.clearsilver.net
     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.
     142=== Modify a few Python scripts to cater for peculiarities specific to IIS ===
     14422. Fix the CGI
     146In [F:\Python23\Share\Trac\cgi-bin\trac.cgi]
     147 modify the section between the try/except block to be as follows:
     150    # PATCH IIS6 - start
     151    import os
     152    os.environ['TRAC_ENV'] = "F:/tracsvn"
     153    # PATCH IIS6 - end
     154    from trac.web import cgi_frontend
     155    cgi_frontend.run()
     156except SystemExit:
     159The TRAC_ENV line is important as IIS6 won't pass this environment variable to the script when it runs.
     160In case you're going to make use of plugins, also add `os.environ['PYTHON_EGG_CACHE'] = "F:/path/to/eggcache"`.
     16223. Fix Python file - api.py
     164In [F:\Python23\Lib\site-packages\trac\web\api.py], change [source:/tags/trac-0.10/trac/web/api.py@4070#L217 "line 217"] to:
     166path_info = property(fget=lambda self: self.environ.get('PATH_INFO','').decode('utf-8').replace(self.environ.get('SCRIPT_NAME', ''), ''),
     167                     doc='Path inside the application')
     170'''Note: ''' For Trac 0.11 the correct [source:/tags/trac-0.11/trac/web/api.py@7236#L181 "line is 181"]. [[BR]]
     171'''Note: ''' For Trac 0.11.5 the correct line is 208.
     17424. Fix Python file - main.py
     176In [F:\Python23\Lib\site-packages\trac\web\main.py], change [source:/tags/trac-0.10/trac/web/main.py@4070#L315 "line 315"] to:
     178path_info = environ.get('PATH_INFO', '').replace(environ.get('SCRIPT_NAME', ''), '').lstrip('/').split('/')
     181'''Note: ''' For Trac 0.11 this fix is not necessary.
     183=== Configure Trac DB ===
     185The 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).
     18725. Run trac-admin
     189f:\Python23\Scripts> python trac-admin f:/tracsvn/
     19226. Initialize DB
     194Note: 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.
     197Trac [f:/tracsvn]> initdb
     201Trac [f:/tracsvn]> initenv
     204  Enter project name
     205    Project
     206  Database Connection String
     207    sqlite:db/trac.db
     208  Enter path to repository
     209    f:\tracsvn\
     210  Enter path to templates
     211    f:\Python23\share\trac\templates
     214If 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.
     21627. Add administrative permissions (the below adds all permissions for 'admin' user)
     218Trac [f:/tracsvn]> permission add admin TRAC_ADMIN
     221Note that if you're using windows authentication with iis6 you can grant permissions to windows users here. Eg.
     223Trac [f:/tracsvn/trac.db]> permission add STAR\\Administrator TRAC_ADMIN
     225If your iis server's windows network name is "STAR", or your iis server is in the "STAR" domain.
     227=== Finally... ===
     22828. Install Subversion clients as necessary (try [http://rapidsvn.tigris.org RapidSVN] & [http://tortoisesvn.tigris.org/ TortoiseSVN])
     23029. Don't forget to lock down the security on the box!
     23230. Now go get a *real* drink
     235See also:  TracGuide, TracCgi, TracFastCgi, TracUpgrade, TracPermissions, #692, #693, #697