Loggerhead unable to serve as daemon behind apache

Bug #948825 reported by Hospik on 2012-03-07
94
This bug affects 17 people
Affects Status Importance Assigned to Milestone
loggerhead
High
Unassigned
loggerhead-breezy
Undecided
Unassigned
loggerhead (Ubuntu)
Undecided
Unassigned

Bug Description

I am trying to serve a bzr repo from behind an Apache proxy. Using the init.d/serve-branches deamon or /usr/bin/serve-branches I am unable to get any loggerhead pages to load, all I get from 127.0.0.1/bzr is:

Not Found
The resource could not be found.

Using "bzr serve --http" I can view my repos in a basic way, but I am unable to use the "prefix" option that I need for the proxy.

/etc/serve-branches.conf:
served_branches=/srv/bzr
prefix=/bzr
port=8080

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: loggerhead 1.19~bzr461-1
ProcVersionSignature: Ubuntu 3.2.0-18.28-generic 3.2.9
Uname: Linux 3.2.0-18-generic x86_64
ApportVersion: 1.94-0ubuntu2
Architecture: amd64
Date: Wed Mar 7 11:03:21 2012
InstallationMedia: Ubuntu-Server 12.04 LTS "Precise Pangolin" - Beta amd64 (20120229)
PackageArchitecture: all
SourcePackage: loggerhead
UpgradeStatus: No upgrade log present (probably fresh install)

Hospik (jmhospers) wrote :
Hospik (jmhospers) wrote :

Experimenting some more:
Adding --allow-writes fixes things for me...
This seems strange to me, maybe a permissions thing?

However this is not really what I want as I would like to restrict write acces to ssh+bzr traffic.

Cruz Bishop (cruzjbishop) wrote :

I could run Loggerhead fine on Ubuntu 11.10 and python 2.6, but since upgrading to 12.04 and 2.7 I have to have --allow-writes no matter where the branches are "hosted"

Maybe it's for extra security? Who knows.

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in loggerhead (Ubuntu):
status: New → Confirmed
Changed in loggerhead:
status: New → Confirmed
Changed in loggerhead:
importance: Undecided → High
Robert Collins (lifeless) wrote :

You probably need paste-deploy installed.

Changed in loggerhead:
status: Confirmed → Incomplete

I'v got paste-deploy installed, but it doesn't work. It only works with --allow-writes.

Tobi Schäfer (interface) wrote :

Confirming Annette’s report of serve-branches not working without --allow-writes switch:

# serve-branches /opt/source/bzr &
[5] 15623
serving on 0.0.0.0:8080 view at http://127.0.0.1:8080
# curl -I localhost:8080
HTTP/1.0 404 Not Found
Server: PasteWSGIServer/0.5 Python/2.7.3
Date: Wed, 13 Jun 2012 10:16:48 GMT
content-type: text/html
Connection: close
# kill %5
[5] Terminated serve-branches /opt/source/bzr/

# serve-branches --allow-writes /opt/source/bzr &
[5] 15662
serving on 0.0.0.0:8080 view at http://127.0.0.1:8080
# curl -I localhost:8080
HTTP/1.0 200 OK
Server: PasteWSGIServer/0.5 Python/2.7.3
Date: Wed, 13 Jun 2012 10:19:34 GMT
Content-Type: text/html
Connection: close

William Grant (wgrant) wrote :

serve-branches seems to want a full URL, not just a path. so 'serve-branches file:///opt/source/bzr' should work. I'm not sure why --allow-writes relaxes that restriction.

Tomas Lukosius (tomas-ebox) wrote :

I am behind ngnix and I can confirm full URL fixes the problem for me. So I assume the problem is not with the proxies.

The only issue I have now is when I open http://hostname/prefix for the first time the link generated for the subdirectory (bzr branch in this case) has no prefix in it, so trying to open it results in "404 Not Found".

The solution seems to be open http://hostname/prefix/subdirectory directly in which case all the links are generated correctly and behaves as it should.

Is apache having similar problem?

Annakan (annakan) wrote :

Hi.

I have the same problem on a centos 6.2 and "absolute url" does not seem to fix the problem or me.
(Like " file://var/repositories/" )
And trying " file://var/repositories/folder/branchFolder" i.e. pointing directly on a branch did not change anything.

All test performed with serve-branch launched via command line and a curl request done straight into it, so Apache does not come into play.

Anything we could do to investigate further ? or Workaround ?

Thanks a lot for your time.

Annakan (annakan) wrote :

Sorry I forgot to mention this :

Python 2.7.3
Paste==1.7.5.1
PasteDeploy==1.5.0
loggerhead==1.18.1
wsgiref==0.1.2
bzr==2.6b1

.X.

Annakan (annakan) wrote :

And I made a mistake in my testing :(

The absolute url WORKS

like file://var/repositories/

so it IS a workaround.

Hi,
after upgrading my 64bit server to Ubuntu 12.04 I had the exact same problem described above.

I have loggerhead running behind an Apache instance, that does some authentication using Django and WSGI. As I'm using the same for a Download area, this cannot be an issue.

After using the suggested absolute URL fix, the loggerhead service does not start. No entries in the logs either. Apache return a 503 HTML error. But when starting serve-branches from command line it is working.

Using the call from /etc/init.d/loggerhead serve-branches cannot start and exits with an error message that does not get displayed by the init script as its sent to /dev/null:

# start-stop-daemon -p 123 -S --startas /usr/bin/serve-branches --chuid loggerhead --make-pidfile --background --chdir file:///data/bazaar/ -- --prefix=/code --port=8080 --host=localhost --log-folder /var/log/loggerhead
start-stop-daemon: unable to chdir() to file:///data/bazaar/ (No such file or directory)

Changing line 32 in /etc/init.d/loggerhead from

start-stop-daemon -p $PIDFILE -S --startas /usr/bin/serve-branches --chuid loggerhead --make-pidfile --background --chdir $served_branches -- --prefix=$prefix --port=$port --host=$host --log-folder /var/log/loggerhead 2>/dev/null

to

start-stop-daemon -p $PIDFILE -S --startas /usr/bin/serve-branches --chuid loggerhead --make-pidfile --background -- $served_branches --prefix=$prefix --port=$port --host=$host --log-folder /var/log/loggerhead 2>/dev/null

allows loggerhead to run as service again...

Changed in loggerhead:
status: Incomplete → Confirmed
neonkandi (jodi-curtis) wrote :

I can confirm the same problem on Ubuntu 12.10 with Apache installed using all the default options

sudo serve-branches file:///location/ --allow-writes #works without correct permissions being set
sudo serve-branches file:///location/ #works, as long as permissions are set accordingly.
sudo serve-branches /location does work only with --allow-writes #worked when tested with correct permissions

at this point in time, configuration through the Apache proxy, and via the pre-defined service has been problematic, and is currently not starting, most of the tutorials do not take into account that the service is pre-installed and running already following the use of apt-get.

Following attempts to configure for Apache my service from init.d will not start, and I am now trying to debug the problem and hopefully make some edits to the pre-configured script and setup.

William Grant (wgrant) wrote :

Bug #1097567 hints at why this breaks, and why --allow-writes fixes it: loggerhead appears to prepend readonly+ to the URL, which obviously doesn't work too well if the URL is actually a path.

Cerem Cem ASLAN (ceremcem-2) wrote :

Editing code (/usr/share/pyshared/loggerhead/main.py) and setting "prefix" variable by hand is not helping either.

summary: - Loggerhead unable to serve as deamon behind apache
+ Loggerhead unable to serve as daemon behind apache
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers