/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to doc/en/user-guide/http_smart_server.txt

merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
===========================
2
1
Serving Bazaar with FastCGI
3
2
===========================
4
3
 
5
 
**This feature is EXPERIMENTAL and is NOT SECURE.  It will allow access to
6
 
arbitrary files on your server.**
7
 
 
8
4
This document describes one way to set up a Bazaar HTTP smart server,
9
5
using Apache 2.0 and FastCGI or mod_python.
10
6
 
11
7
For more information on the smart server, and other ways to configure it
12
8
see the main `smart server documentation`_.
13
9
 
14
 
.. _smart server documentation: server.html
 
10
.. _smart server documentation: #running-a-smart-server
15
11
 
16
12
Example
17
 
=======
 
13
-------
18
14
 
19
15
You have a webserver already publishing `/srv/example.com/www/code` as
20
16
`http://example.com/code/...` with plain HTTP.  It contains bzr branches and
50
46
 
51
47
    Alias /code /srv/example.com/www/code
52
48
    <Directory /srv/example.com/www/code>
53
 
        Options Indexes, FollowSymLinks
 
49
        Options Indexes FollowSymLinks
54
50
        RewriteEngine On
55
51
        RewriteBase /code
56
52
        RewriteRule ^(.*/|)\.bzr/smart$ /srv/example.com/scripts/bzr-smart.fcgi
106
102
This instructs Apache to hand requests for any URL ending with `/.bzr/smart`
107
103
inside `/code` to a Bazaar smart server via mod_python.
108
104
 
 
105
NOTE: If you don't have bzrlib in your PATH, you will be need to change the
 
106
following line::
 
107
 
 
108
            PythonPath "sys.path+['/srv/example.com/scripts']"
 
109
 
 
110
To::
 
111
 
 
112
            PythonPath "['/path/to/bzr']+sys.path+['/srv/example.com/scripts']"
 
113
 
 
114
 
109
115
Refer to the mod_python_ documentation for further information.
110
116
 
111
117
.. _mod_python: http://www.modpython.org/
126
132
    from bzrlib.transport.http import wsgi
127
133
 
128
134
    smart_server_app = wsgi.make_app(
129
 
        root='/srv/example.com/code',
 
135
        root='/srv/example.com/www/code',
130
136
        prefix='/code/',
131
137
        path_var='REQUEST_URI',
132
 
        readonly=True)
 
138
        readonly=True,
 
139
        load_plugins=True, 
 
140
        enable_logging=True)
133
141
 
134
142
    fcgi.WSGIServer(smart_server_app).run()
135
143
        
150
158
    from bzrlib.transport.http import wsgi
151
159
 
152
160
    smart_server_app = wsgi.make_app(
153
 
        root='/srv/example.com/code',
 
161
        root='/srv/example.com/www/code',
154
162
        prefix='/code/',
155
163
        path_var='REQUEST_URI',
156
 
        readonly=True)
 
164
        readonly=True,
 
165
        load_plugins=True, 
 
166
        enable_logging=True)
157
167
 
158
168
    def handler(request):
159
169
        """Handle a single request."""
160
170
        wsgi_server = modpywsgi.WSGIServer(smart_server_app)
161
171
        return wsgi_server.run(request)
162
172
        
163
 
The `modpywsgi` module can be found at http://trac.pocoo.org/wiki/ModPyWsgi.  It
164
 
is part of pocoo_.
 
173
The `modpywsgi` module can be found at
 
174
http://dev.pocoo.org/projects/pocoo/browser/pocoo/wrappers/modpy.py. It is
 
175
part of pocoo_. You sould make sure you place modpywsgi.py in the same
 
176
directory as bzr-smart.py (ie. /srv/example.com/scripts/).
165
177
 
166
 
.. _pocoo: http://trac.pocoo.org/wiki/
 
178
.. _pocoo: http://dev.pocoo.org/projects/pocoo/
167
179
 
168
180
Clients
169
181
-------
178
190
 
179
191
 
180
192
Advanced configuration
181
 
======================
 
193
----------------------
182
194
 
183
195
Because the Bazaar HTTP smart server is a WSGI application, it can be used with
184
196
any 3rd-party WSGI middleware or server that conforms the WSGI standard.  The
205
217
 
206
218
 
207
219
Pushing over ``bzr+http://``
208
 
----------------------------
 
220
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
209
221
 
210
222
It is possible to allow pushing data over the http smart server. The
211
223
easiest way to do this, is to just supply ``readonly=False`` to the