Edgewall Software

Changes between Version 17 and Version 18 of TracOnWindowsIis6


Ignore:
Timestamp:
Mar 9, 2006, 2:56:32 PM (18 years ago)
Author:
Christopher J B Scholten
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • TracOnWindowsIis6

    v17 v18  
    1 == Windows Installation Instructions for Subversion w/Trac 0.9 ==
     1== Windows Installation Instructions for Subversion w/Trac 0.9.4 ==
    22
    33For:
     
    55 * IIS 6
    66 * Trac 0.9
    7 Trac running on Microsoft's Internet Information Server (IIS) is _highly_ experimental. See #692 #693 and #697.
     7
     8There are some documented issues regarding running Trac on Microsoft's Internet Information Server (IIS), however it does work (albeit slowly). Refer to the following issues for details: #692 #693 and #697.
    89
    910Trac running without Apache or IIS:  using [source:trunk/README.tracd#latest tracd] and svnserve is experimental (''tracd'') but the performance improvement is ''very'' significant over cgi.  See TracOnWindowsSansApacheOrIis (TBD).
     
    3536{{{
    3637  expand and run from the expanded docutils-xxx directory
    37   > D:\python23\python install.py
     38  > F:\python23\python install.py
    3839}}}
    3940
     
    106107
    10710816. Fix up permissions
    108   Change the ownership of 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
     109  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
    109110
    110111=== Install Trac Prerequisites ===
     
    121122  http://www.initd.org/tracker/pysqlite
    122123
    123 19.5. Install ClearSilver
     12420. Install ClearSilver
    124125  http://www.clearsilver.net
    125126
    126 20. Install Trac
     12721. Install Trac
    127128  http://projects.edgewall.com/trac/wiki/TracDownload
    128129  Use the Windows installer to avoid having to manually install Trac with Python.
    129130
    130 === Fix a few things ===
    131 
    132 23. Rename and fix CGI
    133 
    134 In wtrac.py add the line [import os;os.environ['TRAC_ENV'] = 'F:\\tracsvn\\trac.db'] to the first try block as shown here:
    135 {{{
    136 try:   
    137     import os;os.environ['TRAC_ENV'] = 'F:\\tracsvn\\trac.db'
    138     import trac.core
    139     trac.core.cgi_start()
    140 }}}
    141 You will still need the except block that follow the original
    142 
    143 The TRAC_ENV line is important as IIS6 won't pass this environment variable to the script when it runs.
    144 
    145 23a. Fix core.py
    146   In F:\Python23\Lib\site-packages\trac\web\cgi_frontend.py: class CGIRequest, change the real_cgi_start function  where it says
    147 {{{
    148     path_info = os.getenv('PATH_INFO')
    149 }}}
     131=== Modify a few Python scripts to cater for peculiarities specific to IIS ===
     132
     13322. Fix the CGI
     134
     135In [F:\Python23\Share\Trac\cgi-bin\trac.cgi]
     136 modify the section between the try/except block to be as follows:
     137{{{
     138try:
     139    from trac.web import cgi_frontend
     140    # PATCH IIS6 - start
     141    import os
     142    os.environ['TRAC_ENV'] = 'F:\\tracsvn\\Trac.db'
     143    # PATCH IIS6 - end
     144    cgi_frontend.run()
     145except Exception, e:
     146}}}
     147
     148The TRAC_ENV line is important as IIS6 won't pass this environment variable to the script when it runs.
     149
     15023. Fix Python file - api.py
     151
     152In [F:\Python23\Lib\site-packages\trac\web\api.py], in the [redirect] function on the Request class, replace the entire function with:
     153{{{
     154    def redirect(self, url):
     155        """Send a redirect to the client, forwarding to the specified URL. The
     156        `url` may be relative or absolute, relative URLs will be translated
     157        appropriately.
     158        """
     159        base_url = '%s://%s' % ("http", os.getenv('SERVER_NAME'))
     160        if self.session:
     161            self.session.save() # has to be done before the redirect is sent
     162        self.send_response(302)
     163        if not url.startswith('http://') and not url.startswith('https://'):
     164            # Make sure the URL is absolute
     165            url = absolute_url(self, url)
     166        self.send_header('Location', base_url + url)
     167        self.send_header('Content-Type', 'text/plain')
     168        self.send_header('Pragma', 'no-cache')
     169        self.send_header('Cache-control', 'no-cache')
     170        self.send_header('Expires', 'Fri, 01 Jan 1999 00:00:00 GMT')
     171        self._send_cookie_headers()
     172        self.end_headers()
     173
     174        if self.method != 'HEAD':
     175            self.write('Redirecting...')
     176
     177        raise RequestDone
     178}}}
     179
     180
     18124. Fix Python file - cgi_frontend.py
     182
     183In [F:\Python23\Lib\site-packages\trac\web\cgi_frontend.py], class CGIRequest, change the real_cgi_start function  where it says :
     184{{{
     185        self.path_info = self.__environ.get('PATH_INFO', '')
     186}}}
     187
    150188  Change this to:
    151189{{{
    152     path_info = os.getenv('PATH_INFO').replace(os.getenv('SCRIPT_NAME'),"")
    153 }}}
    154 
    155   In the redirect function on the Request class (in trac 0.9 it's in web\api.py), change the first part of the method to read:
    156 {{{
    157     def redirect(self, url):
    158         base_url = '%s://%s' % ("http", os.getenv('SERVER_NAME'))
    159         self.send_response(302)
    160         self.send_header('Location', base_url + url)
     190
     191        # IIS 6 Change
     192        self.path_info = self.__environ.get('PATH_INFO', '')
     193        self.path_info = self.path_info.replace(os.getenv('SCRIPT_NAME'),"")
     194        # End IIS 6 Change
     195
    161196}}}
    162197
     
    211246
    212247=== Finally... ===
    213 32. Install Subversion clients as necessary (try [http://rapidsvn.tigris.org RapidSVN] & [http://tortoisesvn.tigris.org/ TortoiseSVN])
    214 
    215 33. Don't forget to lock down the security on the box!
    216 
    217 34. Now go get a *real* drink
     24829. Install Subversion clients as necessary (try [http://rapidsvn.tigris.org RapidSVN] & [http://tortoisesvn.tigris.org/ TortoiseSVN])
     249
     25030. Don't forget to lock down the security on the box!
     251
     25231. Now go get a *real* drink