jeromeLB / client175

Automatically exported from code.google.com/p/client175
GNU General Public License v3.0
0 stars 0 forks source link

Run on other web servers (lighttpd/apache/etc) #26

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Is it possible to make client175 run on other webservers as well? I tried 
getting it to work on lighttpd but I didn't succeed.

Original issue reported on code.google.com by doemaarn...@gmail.com on 19 Dec 2010 at 1:29

GoogleCodeExporter commented 9 years ago
The server component for client175 is CherryPy, which can be run behind other 
servers if you want to.  See http://www.cherrypy.org/ for details:

http://www.cherrypy.org/wiki/ModPython
http://tools.cherrypy.org/wiki/BehindApache

Original comment by cseic...@gmail.com on 19 Dec 2010 at 2:27

GoogleCodeExporter commented 9 years ago
And how exactly? I configured a proxy per those URLs (without the static 
exception), but the client isn't very functional. Several AJAX requests seem to 
use absolute paths instead of relative ones, which breaks the proxy settings.

E.g., I've configured a proxy to relay /mpdui/* to a locally running client175; 
but I see several errors coming, for example:
[error] [client $IP] File does not exist: $DOCUMENTROOT/status, referer: 
http://$HOST/mpdui/static/index.html

As far as I see, the culprit here seems to be a request in checkStatus @ 
mpd.js, using url: '/status', breaking the proxy.

Original comment by tim.besard@gmail.com on 4 Jan 2011 at 8:25

GoogleCodeExporter commented 9 years ago
Alright, fixing that relative path gets most of the mpd.cmd usage working. Only 
the browser seemed to fail, because client175 uses encoded slashes ('/', %2F) 
in the URL which makes Apache's proxy configuration fail. Server-side fix: 
"AllowEncodedSlashes On". Arguable client175 shouldn't send encoded slashes on 
the URL though...

Last thing I can't manage to get fixed is the correct cherrypy/proxy 
configuration to get redirects working. Failing this, the initial redirect 
doesn't work, as well as displaying of album art. The CherryPy wiki mentions 
using "ProxyPreserveHost on", but that doesn't seem to work here.

Original comment by tim.besard@gmail.com on 9 Jan 2011 at 4:59

GoogleCodeExporter commented 9 years ago
Scrap that, allowing encoded slashes doesn't work as it should: adding a single 
album/folder makes it add everything.

Original comment by tim.besard@gmail.com on 9 Jan 2011 at 5:02

GoogleCodeExporter commented 9 years ago
So, does someone had anybody enough luck to make client175 work behind Apache?

Original comment by sniff...@gmail.com on 28 Jan 2011 at 10:54

GoogleCodeExporter commented 9 years ago
I had some luck.

For quick-ugly-fix encoded slashes
in server.py change line 136 from:
d = args[0]
to
d = '/'.join(args)

For fixing 404 messages with "/status" url you can create a rewrite rule in 
your frontend server, or in static/mpd.js change line 60 from:
url: '/status'
to
url: '/$YOUR-FRONTEND-PATH/status'

Original comment by sniff...@gmail.com on 30 Jan 2011 at 2:25

GoogleCodeExporter commented 9 years ago
This is listed as done, however using the SVN I am still experiencing the error?

Original comment by m...@mbw.dk on 3 Mar 2011 at 7:47

GoogleCodeExporter commented 9 years ago
It was marked "Done" with the first comment.  It should have been closed with 
WontFix since there was not intention of pursuing the issue.  It wasn't meant 
to indicate that this has been tested or is supported.

Since there is a lot of interest in this feature, I'll re-open as an 
enhancement...

Original comment by cseic...@gmail.com on 3 Mar 2011 at 11:10

GoogleCodeExporter commented 9 years ago
So far i have found a serverside fix adding "nocanon" to the ProxyPass and 
allowing encoded slashes.

Example:

ProxyPass / http://localhost:4040/ nocanon
ProxyPassReverse / http://localhost:4040/ nocanon
AllowEncodedSlashes On

However its not fully tested and a solution not requirering serverside hacks 
would ofcourse be prefered.

Original comment by m...@mbw.dk on 4 Mar 2011 at 9:31

GoogleCodeExporter commented 9 years ago
I've modified the most recent release (version 0.6) to work with Apache using 
mod_python.  See the BehindApache wiki page for instructions:

http://code.google.com/p/client175/wiki/BehindApache

Let me know if you have any problems.

Original comment by cseic...@gmail.com on 3 Apr 2011 at 5:53

GoogleCodeExporter commented 9 years ago
I keep on getting "Unrecoverable error in the server", no idea what is causing 
it.

Original comment by tim.besard@gmail.com on 3 Apr 2011 at 7:19

GoogleCodeExporter commented 9 years ago
I had accidentally left some debug code setting the mpd host to a specific IP 
address.  There is a new package to fix this, version 0.6a

Original comment by cseic...@gmail.com on 3 Apr 2011 at 8:36

GoogleCodeExporter commented 9 years ago
Im using a VirtualHost and my host lookes like this:

<VirtualHost *:80>
        ServerName music.XXX.dk
        AllowEncodedSlashes On
        <Location "/client175">
                PythonPath "sys.path+['/var/www/client175']"
                SetHandler python-program
                PythonHandler cherrypy._cpmodpy::handler
                PythonOption cherrypy.setup server::serverless
                PythonDebug On
        </Location>
</VirtualHost>

Without allowing encoded slashes i get:

The following error was encontered when sending the command:  add The 
Bloodhound Gang/Hooray for Boobies (2000)/01 I Hope You Die.flac

Not Found
The requested URL /client175/add/The Bloodhound Gang/Hooray for Boobies 
(2000)/01 I Hope You Die.flac was not found on this server.

With encoded slashes i add the entire album when trying to add a single file.

Also if i remove replace /client175 with / (using the root) it isnt working at 
all :(

Original comment by m...@mbw.dk on 4 Apr 2011 at 12:13

GoogleCodeExporter commented 9 years ago
Sorry about that, I didn't check the encoded slashes problem on he last 
package... his should be fixed with version 0.7.

With the location, you must set the server_location in site.conf to match 
whatever is setup in apache config.

Original comment by cseic...@gmail.com on 6 Apr 2011 at 11:24

GoogleCodeExporter commented 9 years ago
I did set the server_root variable in site.conf to match the Location variable 
of the VirtualHost. There is a server_location variable as well?

Where can I find the possible variables in site.conf. Not even mpd_password is 
listed in the default site.conf file (I would recommend adding it).

Original comment by m...@mbw.dk on 6 Apr 2011 at 11:45

GoogleCodeExporter commented 9 years ago
Nevermind. With 0.7 it works like a charm (so far atleast ;).

No need for encoded slashes. Can use the root. Everything just works. Awesome 
job.

Original comment by m...@mbw.dk on 6 Apr 2011 at 12:19

GoogleCodeExporter commented 9 years ago
Still doesn't work with my Apache on Ubuntu Natty. I get "Unrecoverable error 
in the server:"
The apache2 error.log has this to say:

[06/Apr/2011:23:03:33] MOD_PYTHON Traceback (most recent call last):
  File "/var/www/client175/cherrypy/_cpmodpy.py", line 139, in handler
    setup(req)
  File "/var/www/client175/cherrypy/_cpmodpy.py", line 82, in setup
    mod = __import__(modname, globals(), locals(), [fname])
  File "/var/www/client175/server.py", line 76, in <module>
    mpd = mpd_proxy.Mpd(HOST, PORT, PASSWORD)
  File "/var/www/client175/mpd_proxy2.py", line 48, in Mpd
    _Instance = _Mpd_Instance(host, port, password)
  File "/var/www/client175/mpd_proxy2.py", line 144, in __init__
    self._connect()
  File "/var/www/client175/mpd_proxy2.py", line 157, in _connect
    self.con.connect(self._host, self._port, self._password)
TypeError: connect() takes exactly 3 arguments (4 given)

[Wed Apr 06 23:03:35 2011] [error] [client 192.168.1.100] File does not exist: 
/etc/apache2/htdocs

Original comment by Ripps...@gmail.com on 7 Apr 2011 at 4:10

GoogleCodeExporter commented 9 years ago
Could you post your site.conf settings and your apache settings?

Original comment by m...@mbw.dk on 7 Apr 2011 at 8:24

GoogleCodeExporter commented 9 years ago
Okay, attached them.

Original comment by Ripps...@gmail.com on 7 Apr 2011 at 9:22

Attachments:

GoogleCodeExporter commented 9 years ago
Try setting the server_root: "/var/www/client175/" in site.conf to server_root: 
"/client175"

Original comment by m...@mbw.dk on 7 Apr 2011 at 10:13

GoogleCodeExporter commented 9 years ago
nope, still doesn't work

Original comment by Ripps...@gmail.com on 7 Apr 2011 at 10:37

GoogleCodeExporter commented 9 years ago
Does it work when you run the server directly?

sudo python /var/www/client175/server.py

With your settings, this would host the site at http://localhost:8080/client175

Original comment by cseic...@gmail.com on 7 Apr 2011 at 10:49

GoogleCodeExporter commented 9 years ago
Yes, that works.

Original comment by Ripps...@gmail.com on 7 Apr 2011 at 11:25

GoogleCodeExporter commented 9 years ago
Try changing the order of the PythonPath option so that the client175 directory 
comes first.  I am thinking that you might have another version of mpd.py 
installed that is taking precedence. 

Original comment by cseic...@gmail.com on 7 Apr 2011 at 12:11

GoogleCodeExporter commented 9 years ago
Awesome that worked, thanks!

Original comment by Ripps...@gmail.com on 7 Apr 2011 at 6:48

GoogleCodeExporter commented 9 years ago
Could you explain the fix in more detail, as I am getting the exact same error 
running it on Apache2 in Ubuntu 10.10.

Here is the apache2.log:

[18/Apr/2011:21:07:39] MOD_PYTHON Traceback (most recent call last):
  File "/var/www/mpd/cherrypy/_cpmodpy.py", line 139, in handler
    setup(req)
  File "/var/www/mpd/cherrypy/_cpmodpy.py", line 82, in setup
    mod = __import__(modname, globals(), locals(), [fname])
  File "/var/www/mpd/server.py", line 76, in <module>
    mpd = mpd_proxy.Mpd(HOST, PORT, PASSWORD)
  File "/var/www/mpd/mpd_proxy2.py", line 48, in Mpd
    _Instance = _Mpd_Instance(host, port, password)
  File "/var/www/mpd/mpd_proxy2.py", line 144, in __init__
    self._connect()
  File "/var/www/mpd/mpd_proxy2.py", line 157, in _connect
    self.con.connect(self._host, self._port, self._password)
TypeError: connect() takes exactly 3 arguments (4 given)

[Mon Apr 18 21:07:39 2011] [error] [client 192.168.1.2] File does not exist: 
/var/www/favicon.ico

The only difference is I am not using httpd.conf, instead I am using files in 
/etc/apache2/sites-available

I've attached the mpd file (which approximates to httpd.conf and my site.conf)

If I run it via sudo python /var/www/mpd/server.py it works ok....

Original comment by r.plumri...@gmail.com on 18 Apr 2011 at 8:18

Attachments:

GoogleCodeExporter commented 9 years ago
You need to change the entry you made to your apache config. Either in 
httpd.conf or wherever you made the edit.
Change:
PythonPath "sys.path+['/var/www/client175']"
To:
PythonPath "['/var/www/client175']+sys.path"

Original comment by Ripps...@gmail.com on 18 Apr 2011 at 10:59

GoogleCodeExporter commented 9 years ago
That fixed it, awesome.

Original comment by r.plumri...@gmail.com on 20 Apr 2011 at 7:07

GoogleCodeExporter commented 9 years ago
Can we update the behind apache document to reflect this?

Original comment by cow...@gmail.com on 7 May 2011 at 8:54

GoogleCodeExporter commented 9 years ago
Done.

Original comment by cseic...@gmail.com on 7 May 2011 at 8:59