Jelastic PaaS provides an out-of-the-box integration of the fast, lightweight and highly scalable Node.js application server. It is automatically supplied with numerous optimization and management tools to make the cloud hosting process maximally convenient for developers. In this article, we’ll go through the main tools and features available on the Jelastic PaaS platform to provide the required level of Node.js cloud hosting.
Node.js Environment Creation
To run your Node.js application, you need to set up the appropriate environment using the powerful and intuitive Topology Wizard. Switch to the Node.js tab, select the required engine version for your application server and add any other software stack required. If needed, adjust other parameters, such as cloudlets and nodes count, Public IPv4 and IPv6, etc.
Currently, the following Node.js versions are supported:
- Node.js 6.11.5 – 6.14.1;
- Node.js 8.9.0 – 8.11.3;
- Node.js 9.0.0 – 9.11.1;
- Node.js 10.0.0 – 10.8.0.
You can select the required version of Node.js directly from the topology wizard during the creation of a new environment and adjust it for the existing one via container redeployment.
Node.js Application Deployment
Jelastic PaaS automates the deployment process for the managed Node.js application servers using:
- Application archive uploaded from local machine or via external URL;
- Remote VCS repository (e.g., GitHub).
You can read the appropriate documentation to learn more about the deployment of Node.js applications:
Node.js Package Managers
For greater convenience, each Node.js application server contains a built-in development tool called Package Manager, which provide standardization and automation of the installation, update, configuration, and removal processes.
Jelastic PaaS supports 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 Node.js 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).
Node.js Process Managers
Process Managers provide the ability to control application lifecycle, monitor running services and maintain the project operability. Jelastic PaaS provides support of the following process managers for the Node.js stack:
- 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.
You can choose the necessary process manager during container redeployment or by adjusting the PROCESS_MANAGER variable (using npm, pm2, forever or supervisor as value; container restart is needed to apply new options).
Your Node.js application can be easily supplemented with a custom domain name to be used instead of the default one. There are two options based on your environment topology:
- DNS CNAME redirect – if using Shared Load Balancer and is recommended for development and test environments;
- DNS A Record – if using Public IP, can handle high traffic load and is suitable for production environments.
Also, you can quickly switch traffic between your environments (e.g., to redirect customers to the newer application version without downtime) by utilizing the swap domains functionality or with the help of the SwapExtIps API/CLI method.
Automatic Vertical Scaling
Jelastic PaaS dynamically provide the exact amount of resources (RAM and CPU) required by your nodes according to the current load with no manual intervention required. As a result, you never overpay for unused resources and save your time as the Jelastic PaaS platform eliminates the need to handle the load-related adjustments or architectural changes.
You just need to set the upper cloudlets limit (each one equals to 128 MB of RAM and 400 MHz of CPU) for your Node.js application server and everything else will be handled by Jelastic PaaS platform automatically.
Refer to the automatic vertical scaling documentation for more information.
Manual Horizontal Scaling
To scale out/in Node.js application servers, you need to access the topology wizard and click the +/- buttons within the Horizontal Scaling section to set the required number of nodes. Also, starting with the 5.5 Jelastic PaaS 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 nodes.
The maximum number of the same-type servers within a single environment layer depends on a particular Jelastic Paas platform settings (usually this limit stands for 16 nodes and can be enlarged by sending the appropriate request to support).
Automatic Horizontal Scaling
Access the environment Settings > Monitoring > Auto Horizontal Scaling section to set up special tunable triggers, which allow to increase or decrease the number of nodes due to the application load. Configure type of resource to be monitored (CPU, RAM, Network, Disk) and the exact condition of scaling.
Refer to the automatic horizontal scaling documentation for more information.
In addition, cloud hosting at Jelastic PaaS allows using other inbuilt tools and features, for example:
- Custom or Jelastic 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.
As you can see, Jelastic PaaS provides all the necessary conditions for smooth Node.js cloud hosting! Get your trial account for free and try it right now at our Jelastic PaaS platform.