title: How to expose a tornado server serving websockets on dotcloud to the www?
body: <p>I am trying to install the  <a href="http://ipython.org/ipython-doc/dev/install/install.html#installnotebook" rel="nofollow noreferrer">IPython html notebook server</a>
  on dotCloud. The IPython server uses tornado with websockets (and other internal communications using zeromq on tcp sockets).</p>
  
  <p>Hhere's my <strong>dotcloud.yml</strong>:</p>
  
  <pre><code>www:          
      type: custom
      buildscript: builder
      ports:
         nbserver: tcp
  </code></pre>
  
  <p>I am following the custom port recipes given <a href="http://answers.dotcloud.com/question/337/configure-ports-for-python-worker-web-server-eg" rel="nofollow noreferrer">here</a> and <a href="https://stackoverflow.com/questions/12065217/dotcloud-www-and-tcp-in-single-app/12066359#12066359">here</a>. As the logs show, I run the tornado server on <code>127.0.0.1:$DOTCLOUD_WWW_NBSERVER_PORT</code>:</p>
  
  <p><strong>/var/log/supervisor/www.log</strong>:</p>
  
  <blockquote>
    <p>[NotebookApp] The IPython Notebook is running at: '<a href="http://127.0.0.1:35928/" rel="nofollow noreferrer">http://127.0.0.1:35928/</a>'<br>
    [NotebookApp] Use Control-C to stop this server and shut down all kernels.</p>
  </blockquote>
  
  <p>But when I push, the dotCloud CLI tells me:</p>
  
  <blockquote>
    <p>WARNING: The service crashed at startup or is listening to the wrong port. It failed to    >respond on port "nbserver" (42801) within 30 seconds. Please check the application logs.<br>
    ...<br>
    Deployment finished. Your application is available at the following URLs
    No URL found. That's ok, it means that your application does not include a webservice."</p>
  </blockquote>
  
  <p>There's nothing on <code>my-app.dotcloud.com</code> or <code>my-app.dotcloud.com:DOTCLOUD_WWW_NBSERVER_PORT</code></p>
  
  <p>What am I missing here? Thanks for your help.</p>
  
  <h2>UPDATE</h2>
  
  <p>Issue solved. The usual HTTP port works fine with websockets so the custom port recipes are not required. This is my new <strong>dotcloud.yml</strong>:</p>
  
  <pre><code>www:
   type: custom
   buildscript: builder
   ports:
     web: http
  </code></pre>
  
  <p>works with the following in <code>ipython_notebook_config.py</code>:</p>
  
  <pre><code> c.NotebookApp.ip = '*'
  </code></pre>
  
  <p>This makes it so that the tornado webserver listens to all ip addresses.</p>
  
  <p><strong>WARNING: setup security and authentication first!</strong></p>
  
  <p>See <a href="http://ipython.org/ipython-doc/dev/interactive/htmlnotebook.html#running-a-public-notebook-server" rel="nofollow noreferrer">Running a Public Notebook Server</a> for more information.</p>