Deploy Socketstream into Jelastic NodeJS Cloud

| September 22, 2015

Socketstream is an open-source web framework, powered by Node.js, which is mainly focused on building single-page real time applications and provides a set of tools for that. Its modular structure is designed not to bind you to a particular technology for being used within apps, but its main benefit is native WebSockets support. This framework supports all the modern browsers, allowing to establish a true bi-directional communication without any noticeable latency and makes your application actually work in real time!

Valuable features of Socketstream framework:

  • Live Reload - automatically reloads the browser when clients` files change
  • Comprehensive support for client-side templates
  • True bi-directional communication using WebSockets
  • Easy authentication
  • Easy code-share  between the client and server

So, let's examine its functionality in more detail by deploying a simple Socketstream app inside the Jelastic Cloud.

Create an Environment

  1. First of all, you need to log into your Jelastic account and create a New environment - the appropriate button can be found in the top left corner of the opened dashboard. 1
  2. In the appeared environment wizard, switch to the Node.js tab at the top, where the required app server will be already chosen: 2

Thus, just define the resource limits using the cloudlet sliders in the central pane, make sure you switch on the Public IPv4 option (circled above) and enter the desired environment name (e.g. socketstream). Click Create to finish.

Add Project

Now, let’s build and deploy the appropriate code to the prepared environment.

  1. Open the Socketstream project page at GitHub and click on the Copy to clipboard button at the pane to the right. 3
  2. Return to the Jelastic dashboard and click on the Add project icon for your Nodejs server. 4
  3. At the appeared Add project frame, ensure you have the Git tab opened and paste the URL you’ve just copied into the same-named field. 5

Adjust the rest of the non-obligatory options if needed and click the Add button below. Wait until your project is successfully deployed (this may take a couple of minutes).

Start the Application

Now it’s time to perform some configurations for making our Socketstream app work properly.

  1. Click the Config icon next to the Nodejs app server at your Jelastic dashboard. 6
  2. In the opened Сonfiguration manager tab, locate the package.json file within the webroot/ROOT directory and insert the following line into its scripts section (which starts approximately at the 77th line) as it is shown below:

"prestart": "sudo npm install -g socketstream; socketstream new jelastic; cd jelastic; npm instal", 7

Note: Do not miss the end comma, that separates our command from the default ones - otherwise, you’ll get an error further on.
  1. Save the changes and Restart node with the appropriate button next to your app server. 8
Note that our configurations require some time to be applied and you need to wait for this process to complete. Its current state can be tracked through the Log files - access the appropriate tab with the same-named button and wait until the npm info ok success response appears. 9
  1. Now, you need to change the package.json file one more time. Substitute the prestart line you’ve specified before with the next string:

"start": "cd ~/ROOT/jelastic/ && node app.js", 10

Save the made changes and Restart node once again.

  1. Finally, select the Open in browser icon for your environment. 11

The application will be opened within a new browser tab. 12

Congratulations! Now, you can use the Socketstream  chat app to enjoy real time communication with advanced data security, great uptime and high availability.

Sign up for a 2-week-free-trial and  try to  deploy  Socketstream  application on your own.