[buildout]
extends =
  ../../stack/kvm.cfg

develop =
  ${:parts-directory}/websockify

parts =
  template
  kvm
  eggs
  check-local-eggs

#XXX-Cedric : Currently, one can only access to KVM using noVNC.
#             Ideally one should be able to access KVM by using either NoVNC or VNC.
#             Problem is : no native crypto support in web browsers. So we have to disable ssl
#             In qemu builtin vnc server, and make it available only for localhost 
#             so that only novnc can listen to it.

#XXX-Cedric: Check status of https://github.com/kanaka/noVNC/issues/13 to see
#            When qemu has builtin support for websockets in vnc server to get rid of 
#            Websockify (socket <-> websocket proxy server) when it is ready.
#            May solve previous XXX depending on the implementation.

#XXX-Cedric: Check status of 
#            https://www.tiolive.com/nexedi/bug_module/20110819-11F4F70 for
#            Chrome >= 14 and Firefox >=7 can access to noVNC.

[eggs]
dummy =
  ${websockify:location}
eggs +=
  websockify

[websockify]
recipe = plone.recipe.command
stop-on-error = true
location = ${buildout:parts-directory}/${:_buildout_section_name_}
command = ${git:location}/bin/git clone --quiet https://github.com/desaintmartin/websockify.git ${:location}
update-command = cd ${:location} && ${git:location}/bin/git pull --quiet

[check-local-eggs]
recipe = plone.recipe.command
stop-on-error = true
update-command = ${:command}
command = grep parts ${buildout:develop-eggs-directory}/websockify.egg-link
depends = ${eggs:dummy}

[template]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
md5sum = 298b146e4efce41bfd58b3f85d064ff1
output = ${buildout:directory}/template.cfg
mode = 0644

[versions]
zc.buildout = 1.5.3-dev-SlapOS-010