Bazaar Smart server setup falied in Linux
Hi all,
I’m trying to setup smart server for bazaar in linux using apache and mod_python or mod_wsgi.
Tried the same steps as mentioned here:- http://
Repository is in another shared drive, which is mounted to this linux m/c . (/mnt/p/
Getting error:-
C:\>bzr log bzr+http://
bzr: ERROR: Generic bzr smart protocol error: Invalid http response for http://
Here I attached my http.conf file and bzr.wsgi scripts.
Could any please analyze and let me know why it is not working for me.
Thanks & Regards,
Vijay
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Bazaar Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Martin Packman
- Solved:
- Last query:
- Last reply:
Revision history for this message
|
#1 |
>>>>>>>
#WSGI method
WSGIScriptAlias
#The three next lines allow regular GETs to work too
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/renessas/
RewriteRule ^/renessas/
<Directory /mnt/p/
WSGIApplica
</Directory>
>>>>>>>
>>>>>>>
Alias /renessas /mnt/p/
<Directory /mnt/p/
Options Indexes FollowSymLinks
RewriteEngine On
RewriteBase /renessas
RewriteRule ^(.*/)?\.bzr/smart$ /mnt/p/
#RewriteRule ^(.*/|)\.bzr/smart$ /mnt/p/
#RewriteRule ^/renessas/
</Directory>
Alias /mnt/p/
<Directory /mnt/p/
<Files bzr-smart.py>
PythonPath "['/usr/
AddHandler python-program .py
</Files>
</Directory>
>>>>>>>
>>>>>>>
from bzrlib.
def application(
app = wsgi.make_app(
return app(environ, start_response)
>>>>>>>
>>>>>>>
import modpywsgi
from bzrlib.
smart_server_app = wsgi.make_app(
root=
prefix=
path_
readonly=True,
load_
enable_
def handler(request):
"""Handle a single request."""
wsgi_server = modpywsgi.
return wsgi_server.
>>>>>>>
Revision history for this message
|
#2 |
http 403 means 'forbidden', probably something in your configuration
is blocking this request. check apache's error.log.
Revision history for this message
|
#3 |
Hi,
Here is the apache error.log
[Wed Nov 09 12:39:54 2011] [error] [client 161.92.51.226] (13)Permission denied: access to /renessas/
[Wed Nov 09 12:39:54 2011] [error] [client 161.92.51.226] (13)Permission denied: access to /renessas/
[Wed Nov 09 12:40:11 2011] [error] [client 161.92.51.226] (13)Permission denied: access to /renessas/
[Wed Nov 09 12:40:11 2011] [error] [client 161.92.51.226] (13)Permission denied: access to /renessas/
FYI., i changed the repository to local and gave full permission for all users.. still the same error..
Revision history for this message
|
#4 |
Access_log..
161.92.51.226 - - [09/Nov/
161.92.51.226 - - [09/Nov/
161.92.51.226 - - [09/Nov/
161.92.51.226 - - [09/Nov/
Revision history for this message
|
#5 |
I think you must have some other apache configuration that's blocking
these requests. Check out
http://
Revision history for this message
|
#6 |
Hi Martin,
I still couldn't find the issue.. can i share my httpd.conf file.
Revision history for this message
|
#8 |
https:/
Please find my httpd.conf file
Revision history for this message
|
#9 |
For mod_wsgi, you need to allow access to the scripts dir, eg:
<Directory /mnt/p/
Order deny,allow
Allow from all
</Directory>
Be aware that if you want to enable write access, you won't want "Allow from all", or will need some other mechanism of restricting access.
Revision history for this message
|
#10 |
I allowed access and tried both the methods(mod_python) & (mod_wsgi), but still the same issue.
Error:-
C:\>bzr log bzr+http://
bzr: ERROR: Generic bzr smart protocol error: Invalid http response for http://
>>>>>>>
##mod_python
Alias /bzr /home/tanst/repo
<Directory /home/tanst/repo>
Order allow,deny
Allow from all
Options Indexes FollowSymLinks
RewriteEngine On
RewriteBase /bzr
RewriteRule ^(.*/)?\.bzr/smart$ /root/bzr/
#RewriteRule ^(.*/|)\.bzr/smart$ /root/bzr/
#RewriteRule ^/bzr/(
</Directory>
Alias /root/bzr/
<Directory /root/bzr/scripts>
<Files bzr-smart.py>
Order allow,deny
Allow from all
PythonPath "['/usr/
AddHandler python-program .py
</Files>
</Directory>
>>>>>>>
##WSGI method
<Directory /root/bzr/scripts/>
Order deny,allow
Allow from all
</Directory>
WSGIScriptAlias
#The three next lines allow regular GETs to work too
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/bzr/
RewriteRule ^/bzr/(
<Directory /home/tanst/repo>
Order deny,allow
Allow from all
WSGIApplica
</Directory>
>>>>>>>
Revision history for this message
|
#11 |
The www-data (or equivalent) user also has access to both the scripts directory and the repo?
I suggest picking just one mod_ and sticking with it, trying to get both working at once is confusing. You want a minimal failing case so you can work out where the problem is, rather than adding new things. I suggest working from the basics up:
# Get basic http access to the repo working. That's just an Alias or the mod_rewrite stuff.
# Add a hello world WSGI script and try accessing it through the browser.
# Finally, add the smart server script and pattern for it.
Make sure you post the apache error log extract if you get stuck, rather than assuming it's the same as before.
Revision history for this message
|
#12 |
Hi, I tried with mod_python mod and failed.. complete details below... couldn't find out why cant i access the repo via apache.
Path:- /home/tanst/scripts
Path:- /home/tanst/repo
Repository: renessas
Branch: RC1234
>>>>>>>
import modpywsgi
from bzrlib.
smart_server_app = wsgi.make_app(
root=
prefix='/bzr/',
path_
readonly=True,
load_
enable_
def handler(request):
"""Handle a single request."""
wsgi_server = modpywsgi.
return wsgi_server.
>>>>>>>
>>>>>>>
##mod_python
Alias /bzr /home/tanst/repo
<Directory /home/tanst/repo>
Order allow,deny
Allow from all
Options Indexes FollowSymLinks
RewriteEngine On
RewriteBase /bzr
RewriteRule ^(.*/)?\.bzr/smart$ /home/tanst/
</Directory>
Alias /home/tanst/
<Directory /home/tanst/
<Files bzr-smart.py>
Order allow,deny
Allow from all
PythonPath "['/usr/
AddHandler python-program .py
</Files>
</Directory>
>>>>>>>
httpd.conf:
https:/
Apache Log:-
error_log - Log Once I started apache.
>>>>>>>
[Thu Nov 10 09:19:56 2011] [notice] caught SIGTERM, shutting down
[Thu Nov 10 09:23:04 2011] [notice] SELinux policy enabled; httpd running as context user_u:
[Thu Nov 10 09:23:04 2011] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Thu Nov 10 09:23:04 2011] [warn] module python_module is already loaded, skipping
[Thu Nov 10 09:23:04 2011] [notice] Digest: generating secret for digest authentication ...
[Thu Nov 10 09:23:04 2011] [notice] Digest: done
[Thu Nov 10 09:23:04 2011] [notice] mod_python: Creating 4 session mutexes based on 256 max processes and 0 max threads.
[Thu Nov 10 09:23:04 2011] [notice] Apache/2.2.3 (CentOS) configured -- resuming normal operations
>>>>>>>
Executed command:-
C:\>bzr log bzr+http://
bzr: ERROR: Generic bzr smart protocol error: Invalid http response for http://
Apache Log:-
Error log:-
>>>>>>>
[Thu Nov 10 09:25:16 2011] [error] [client 137.55.202.44] (13)Permission denied: access to /bzr/renessas/
[Thu Nov 10 09:25:16 2011] [error] [client 137.55.202.44] (13)Permission denied: access to /bzr/renessas/
>>>>>>>
Access log:-
>>>>>>>
137.55.202.44 - - [10/Nov/
137.55.202.44 - - [10/Nov/
>>>>>>>
Revision history for this message
|
#13 |
Hi all,
It is working now after disable SELinux.
Revision history for this message
|
#14 |
Hi,
Now i'm getting this commit error.
Commit Error:-
bzr: ERROR: Cannot lock LockDir(
i have given full permission to repository, but still the same issue.
Any idea ???
Revision history for this message
|
#15 |
Repository:-
[tanst@P690-6YWJR1S src]$ ls -la /home/tanst/repo/
total 24
drwxrwxr-x 3 tanst apache 4096 Nov 8 16:30 .
drwxr-xr-x 29 tanst RemoteUsr 4096 Nov 10 13:41 ..
drwxrwxrwx 5 tanst apache 4096 Nov 8 16:30 renessas
File tried to add:-
[tanst@P690-6YWJR1S src]$ ls -l
total 4
-rwxrwxrwx 1 tanst RemoteUsr 0 Nov 10 13:42 file
Revision history for this message
|
#16 |
smart_server_app = wsgi.make_app(
root=
prefix=
path_
readonly=True,
load_
enable_
Did you change this to `readonly=False` before trying to push (also see my earlier access warnings).
Revision history for this message
|
#17 |
Thanks Martin Packman, that solved my question.