comparison docs/installation_iis.rst @ 4554:2dad9708c89f

paster: add install-iis command to automate IIS handler generation A new paster command, install-iis, is added that automates generating the ISAPI-WSGI file that allows IIS to serve up Kallithea's WSGI application using IIS' ISAPI filters. The paster command's output also describes the final steps necessary to complete IIS installation.
author Henrik Stuart <hg@hstuart.dk>
date Sun, 14 Sep 2014 07:39:06 +0200
parents e69d34136be5
children 22a3fa3c4254
comparison
equal deleted inserted replaced
4553:e98aa842683c 4554:2dad9708c89f
42 pool. 42 pool.
43 43
44 ISAPI Handler 44 ISAPI Handler
45 ............. 45 .............
46 46
47 The ISAPI handler needs to be generated from a custom file. Imagining that the 47 The ISAPI handler can be generated using::
48 Kallithea installation is in ``c:\inetpub\kallithea``, we would have a file in
49 the same directory called, e.g. ``dispatch.py`` with the following contents::
50 48
51 import sys 49 paster install-iis my.ini --root=/
52 50
53 if hasattr(sys, "isapidllhandle"): 51 This will generate a ``dispatch.py`` file in the current directory that contains
54 import win32traceutil 52 the necessary components to finalize an installation into IIS. Once this file
53 has been generated, it is necessary to run the following command due to the way
54 that ISAPI-WSGI is made::
55 55
56 import isapi_wsgi 56 python dispatch.py install
57 57
58 def __ExtensionFactory__(): 58 This accomplishes two things: generating an ISAPI compliant DLL file,
59 from paste.deploy import loadapp 59 ``_dispatch.dll``, and installing a script map handler into IIS for the
60 from paste.script.util.logging_config import fileConfig 60 ``--root`` specified above pointing to ``_dispatch.dll``.
61 fileConfig('c:\\inetpub\\kallithea\\production.ini')
62 application = loadapp('config:c:\\inetpub\\kallithea\\production.ini')
63
64 def app(environ, start_response):
65 user = environ.get('REMOTE_USER', None)
66 if user is not None:
67 os.environ['REMOTE_USER'] = user
68 return application(environ, start_response)
69
70 return isapi_wsgi.ISAPIThreadPoolHandler(app)
71
72 if __name__=='__main__':
73 from isapi.install import *
74 params = ISAPIParameters()
75 sm = [ScriptMapParams(Extension="*", Flags=0)]
76 vd = VirtualDirParameters(Name="/",
77 Description = "ISAPI-WSGI Echo Test",
78 ScriptMaps = sm,
79 ScriptMapUpdate = "replace")
80 params.VirtualDirs = [vd]
81 HandleCommandLine(params)
82
83 This script has two parts: First, when run directly using Python, it will
84 install a script map ISAPI handler into the root application of the default
85 website, and secondly it will be called from the ISAPI handler when invoked
86 from the website.
87 61
88 The ISAPI handler is registered to all file extensions, so it will automatically 62 The ISAPI handler is registered to all file extensions, so it will automatically
89 be the one handling all requests to the website. When the website starts the 63 be the one handling all requests to the specified root. When the website starts
90 ISAPI handler, it will start a thread pool managed wrapper around the paster 64 the ISAPI handler, it will start a thread pool managed wrapper around the paster
91 middleware WSGI handler that Kallithea runs within and each HTTP request to the 65 middleware WSGI handler that Kallithea runs within and each HTTP request to the
92 site will be processed through this logic henceforth. 66 site will be processed through this logic henceforth.
93 67
94 Authentication with Kallithea using IIS authentication modules 68 Authentication with Kallithea using IIS authentication modules
95 .............................................................. 69 ..............................................................