On 05/01/2012 06:44 PM, Anthony Young wrote:
Adam,

It turns out that kanaka also maintains a websockify tree that independently houses the websocket and proxy code.  As we discussed on irc, I've proposed some changes to that repo: https://github.com/kanaka/websockify/pull/40 - if you could take a look and offer feedback that would be great.

A few things that differ in that tree from what you describe below:

 * I created a subdirectory for the websockify module (rather than leaving code at top level)

 * I put the proxy base class in websockify/proxy.py (rather than leaving it in websockify.py, which I rename to bin/websockify). 



That is fine.  I was tempted that way myself,  but wasn't sure that there was enough code to justify it.  It is only about 280 lines of code,  and thus I would see that being deployed in, for example:


/usr/lib[64]/python2.7/site-packages/websockify.py

as opposed to having to manage

/usr/lib[64]/python2.7/site-packages/websockify/__init__.py


Perhaps for the git repo, it just makes sense to have a python subdir with the websockify.py and other potential modules files in there, and then an explicit PYTHONPATH set to look there?  Just for development.  However,  your approach is certainly OK.



 * I also adopted the convention to use 'www' instead of 'html' to store html/js/css (although noVNC does not need to use this code directly).

Agreed.  I like this better as it is  more inclusive.

Once we work through these structural changes, we can turn our attention to some of the other fixes that you mentioned to me (directory listing, organization of html/css/js in the noVNC tree).

Anthony


On Fri, Apr 27, 2012 at 1:26 PM, Adam Young <ayoung@redhat.com> wrote:
Trying to get the noVNC package into something that matches the Fedora Python pakcage specificiation.

1.  Create a bin directory, and all shell scripts and executable python files go in there.  These will get installed into /usr/bin.  All the files in here will be prefixed by novnc-.  nova-novncproxy is the exception ,as it will eventually move back to Nova.   These are img2js.py, json2graph.py, launch.sh, u2x11, u2x11, websockify, rebind.

2.  websocket.py. is a Python file that is both an execuatble and a module.  It will get split into two parts.  The module websocket.py will stay in the top level directory with a .py extension.  The executable portion will go into bin as websockify.  The module code will get installed into /usr/lib/python2.7/site- packages/.

3.  All client side Javascript  and html files will go into an html subfile.  This includes the html and ico files in the top dir, and the subdirectories 'include'  and 'images'.

4.  rebind.so needs libtool support.  It will get moved into a subdir name rebind.  It will get installed into /usr/lib[64] as a versioned .so,  probably 0.1.0


This will likely conflict with a future websocket RPM, but we'll burn that bridge when we get there.

For our purposes, we don't really need rebind, as we are not using it.  I'm almost tempted to leave it out of the RPM.  Dan B mentioned that it needs IPv6 support,  but I don't think it is worth doing that right now.


The Init script for the VNC code is in Nova.  Since daemon runs with --user nova,  it should be run as a non-priveledged user,  which means that it only has the problem of running in the wrong CWD.  I suggest that we put

os.chdir(os.path.dirname(sys. argv[0]))

into nova-novncproxy.