Node.js Hosting

Togglebox has partnered with Jelastic to  provide an out-of-box integration of the highly scalable Node.js application server.

Optimization and management tools are automatically provided to make the hosting process maximally convenient.

In this article, we’ll go through the main tools and features available.

Node.js Environment Hosting

To run your Node.js application:

1. Set up the appropriate environment using the powerful and intuitive Topology Wizard.

2. Switch to the Node.js tab

3. Select the required engine version for your application server

4. Add any other software stack required.

If needed, adjust other parameters, such as cloudlets and nodes count, Public IPv4 and IPv6, etc.nodejs tutorial

Each instance is a completely isolated container. Scaled out nodes are automatically distributed across the physical servers (or VMs) ensuring high availability.

Node.js Versions:

You can easily switch between different Node.js versions.

Here is an up-to-date list of the releases available updated weekly:  Software Stack Versions

nodejs cluster

Select the required version of Node.js directly from the topology wizard

Adjust it for the existing one via container redeployment.

Node.js Application Deployment

The deployment process is automated for the managed NodeJS application servers using:

  • application archive uploaded from the local machine or via external URL
  • remote VCS repository (e.g. GitHub)nodejs hosting
With the ports auto-redirect algorithm, the deployed projects are instantly accessible.
You can manually exclude some of the services from the auto-redirect search by listing the appropriate ports via the REDIRECT_EXCLUDE_PORTS variable.

Read the appropriate documents to learn more about the deployment of the Node.js applications:

Node.js Package Managers

Each NodeJS application server contains a built-in development tool called Package Manager.

This provides automation of the installation, update, configuration, and removal processes.

Here are the two types of package managers:

  • npm – manages your project requirements by installing the additional modules, packages, and ready-to-use applications
  • yarn – operates the same requirements as in npm (so no changes are required for the existing applications), while providing higher speed, reliability, and convenience

By default, the npm package manager is used for the NodeJS application servers, but, if necessary, it can be easily switched to yarn. For that, access the container variables frame and set the appropriate PACKAGE_MANAGER value (either npm or yarn).cluster nodejs

Node.js Process Managers

Process Managers provide the ability to control application lifecycle.

It monitors running services and maintain the project operability.

Support of the following process managers for the NodeJS stack is provided:

  • npm – initiates and configures multiple processes
  • pm2 – provides a huge variety of application management features, including the launched Node.js processes monitoring
  • forever – allows running your Node.js processes continuously and automatically restarting them upon failure
  • supervisor – monitors running applications for changes and automatically restarts required ones to keep them up-to-date

Choose the necessary process manager during container redeployment.

Adjust the PROCESS_MANAGER variable (using forevernpmpm2 or supervisor as value, container restart is needed to apply new options).

Domains Management

Supplement your application with the custom domain name to be used instead of the default one:

  • CNAME redirect if using Shared Load Balancer; is recommended for dev and test environments
  • DNS A Record if using Public IP; can handle high traffic load and is suitable for production environments

Quickly switch traffic between your environments by utilizing the swap domains functionality or with the help of the SwapExtIps API/CLI method.nodejs docs

Automatic Vertical Scaling

With Automatic Vertical Scaling, you never overpay for unused resources and save your time.

Just set the upper cloudlets limit (each one equals to 128 MiB of RAM and 400 MHz of CPU) for your NodeJS application server.hosting nodejs

Refer to the automatic vertical scaling documentation for more information.

Manual Horizontal Scaling

Click the +/- buttons within the Horizontal Scaling section to set the required number of nodes.

With the 5.5 platform version, you can adjust the preferred scaling mode:

  • Stateless – simultaneously creates all new nodes from the base image template
  • Stateful – sequentially copies file system of the master container into the new nodesnodejs host

Usually this limit stands for 16 nodes and can be enlarged by sending the appropriate request to support.

A load balancer instance is automatically added upon NodeJS server scaling.

Refer to the horizontal scaling documentation for more details.

Automatic Horizontal Scaling

  1. Go to Settings > Monitoring > Auto Horizontal Scaling section to set up special tunable triggers
  2.  Increase or decrease the number of nodes due to the application load.
  3. Configure type of resource to be monitored (CPURAMNetworkDisk) and the exact condition of scaling.

nodejs env

Learn more about automatic horizontal scaling in the linked document.

In addition, hosting at Togglebox allows using other inbuilt tools and features, for example:

  • Custom or Let’s Encrypt SSL
  • Public IPv4 and IPv6
  • A wide range of managed software stacks
  • Container firewalls, endpoints, and environment isolation
  • User-friendly UI and direct SSH access for management
  • Open API and Cloud Scripting for automation
  • Pay-as-you-use pricing model
  • Collaboration functionality for teamwork
  • Multi-cloud distribution