Deploy to Cloud Foundry

Introduction is an open source system to synchronize data and events across multiple client applications in real time.

Using you can build modern web applications where users immediately see changes done by other users without reloading the page.

Cloud Foundry is an open source PaaS that helps you to deploy and scale web application with few commands.

This tutorial shows how to deploy to Cloud Foundry within a few simple steps.


To follow this tutorial you need access to a Cloud Foundry installation.

There are some public provider out there which provide a trial account, e.g.: Bluemix, anynines, Predix, and Pivotal.

If you have a little patience you can also setup your own Cloud Foundry installation.

Once you have a Cloud Foundry account, you must install the Cloud Foundry CLI, target the Cloud Foundry installation and provide your credentials. In this example a Bluemix account is used:

$ cf api
$ cf login


Step 1: Checkout

To get deepstream running with the existing node.js buildpack we created a node.js wrapper project for deepstream. It does nothing else then importing the deepstream sources and starting a listen socket on the port specified in the "PORT" environment variable.

You need to clone this project using git and then change into the projects directory:

$ git clone
$ cd deepstream-for-cf

Step 2: Deploy

To deploy to Cloud Foundry you just have to run the following command within the git repo:

$ cf push deepstream -m 256M --random-route

Attention: Note that this example doesn't configure any authentication. This means that everyone who knows the URL of your deepstream server can write data to it. For production purposes you must setup either a file based authentication or a HTTP Authentication.

This takes a few minutes and will result in the following output:

$ cf push deepstream -m 256M --random-route
Creating app deepstream in org / space dev as

Creating route

Binding to deepstream...

Uploading deepstream...
Uploading app files from: /private/tmp/deepstream-for-cf
Uploading 1.4K, 2 files
Done uploading

Starting app deepstream in org / space dev as
-----> Downloaded app package (4.0K)

-----> IBM SDK for Node.js Buildpack v3.8-20161006-1211
       Based on Cloud Foundry Node.js Buildpack v1.5.20
-----> Creating runtime environment
-----> Installing binaries
       engines.node (package.json): unspecified
       engines.npm (package.json): unspecified (use default)
       Resolving node version (latest stable) via 'node-version-resolver'
       Installing IBM SDK for Node.js (4.6.0) from cache
       Using default npm version: 2.15.9
-----> Restoring cache
       Skipping cache restore (new runtime signature)
-----> Building dependencies
       Installing node modules (package.json)
       > uws@0.9.0 install /tmp/staged/app/node_modules/
       > node-gyp rebuild > build_log.txt 2>&1 || exit 0 node_modules/
       ├── component-emitter@1.1.2
       └── (yeast@0.1.2, indexof@0.0.1, has-cors@1.1.0,
component-inherit@0.0.3, xmlhttprequest-ssl@1.5.1, debug@2.2.0, parseqs@0.0.2, ws@1.1.1, parseuri@0.0.4, parsejson@0.0.1, node_modules/
       ├── adm-zip@0.4.7
       ├── colors@1.1.2
       ├── commander@2.9.0 (graceful-readlink@1.0.1)
       ├── mkdirp@0.5.1 (minimist@0.0.8)
       ├── (base64id@0.1.0, debug@2.2.0, ws@1.1.0,,
       ├── needle@1.3.0 (debug@2.3.2, iconv-lite@0.4.13)
       ├── js-yaml@3.6.1 (esprima@2.7.3, argparse@1.0.9)
       ├── glob@7.1.1 (path-is-absolute@1.0.1, inherits@2.0.3, fs.realpath@1.0.0, once@1.4.0,
inflight@1.0.6, minimatch@3.0.3)
       └── uws@0.9.0
-----> Installing App Management
-----> Caching build
       Clearing previous node cache
       Saving 2 cacheDirectories (default):
       - node_modules
       - bower_components (nothing to cache)
-----> Build succeeded!

-----> Uploading droplet (19M)

1 of 1 instances running

App started


App deepstream was started using this command `./vendor/initial_startup.rb`

Showing health and status for app deepstream in org / space dev as

requested state: started
instances: 1/1
usage: 256M x 1 instances
last uploaded: Fri Nov 11 22:18:23 UTC 2016
stack: unknown
buildpack: SDK for Node.js(TM) (ibm-node.js-4.6.0, buildpack-v3.8-20161006-1211)

in the output above you find the URL which Cloud Foundry has assigned to you deepstream deployment. In the example it is "".

Step 2: Create a simple Client

Your deepstream server is up and running and you can connect some clients to it. Refer to the offical documentation to write a hello world client application.