Node. js may still be younger than other languages, but its VM has many options. In this article, let's take a look at several "Platform as a service (PaaS)" providers.
I do not cover certain infrastructure-as-a-service (IaaS) options, such as AWS and Joyent, although the boundaries between some PaaS and IaaS in these options are slightly blurred.
In this round, I mainly examine two aspects: Deployment and environment variable configuration. I also included some observations on the dashboard and other miscellaneous operations. In future articles, we will run some basic performance tests to see how easy the architecture is to scale.
The Players
Provider |
Deployment method |
Environment variables |
Performance |
Nodejitsu |
CLI |
CLI or web interface |
Coming soon |
Heroku |
Git |
CLI |
Modulus |
CLI or web upload |
CLI or web interface |
App Fog |
CLI |
CLI or web interface |
Azure |
CLI or git |
CLI or web interface |
DotCloud |
CLI |
CLI or. yml file |
Engine Yard |
Git |
Ey_config npm module |
OpenShift |
Git |
SSH and create file |
CloudFoundry |
Coming soon |
Coming soon |
Set
I started with a very simple Express app. Using nconf can provide a variety of methods, so that we can specify a port for the app and listen to our application (if necessary) and a dummy variable, I call it SECRET. It first looks for the parameters and environment variables passed by the node command, and then tries to load the config. json file from the upper level of the root directory to the default location we have set. When loading an app, we can know whether the variables are correctly loaded from external sources. If an error occurs, the app will be rolled back to the default SECRET. If I can access the app startup log, I can see which port the app listens to on NODE_ENV.
Finally, I set "engines": {"node": "v0.10.x"... to the package. json file to see how each provider responds.
There is no specific order now ..
Nodejitsu
Https://www.nodejitsu.com/
An initial participant is still completely Node. js solution. After Joyent gave up their No. de service, Joyent's Nodejitsu became an official partner (sorry, that's really a good domain name ). nodejitsu is no longer a permanent free middle layer. however, some schemes require a free trial period of 3 $ every month and 30 days.
Variable Configuration
According to the document, you do not need to set the listening port, as long as it is 80 or greater than 1024.
Setting our SECRET to override the default one is quite easy. You can use the CLI or web interface list to set variables, Just Like several other vendors on this list.
Deployment
To publish your code to Nodejitsu cloud, install rpm through a custom command line interface (CLI) application. After registration, it will be automatically transferred to the github command version library. however, the overall installation process is quite painful. When you are prompted to select a second-level domain name, it will be automatically added to the package. json file. I ran several tests and the deployment was very fast. in each deployed package. the version attribute of the json file is automatically incremented, which won't bother me, but may cause other people to worry.
I have encountered three minor faults. The first is version control. When I deploy the service, I will display the following information:
Info: jitsu v0.12.10-2, node v0.10.4
However, I was told that 0.10.x is not a supported value. I can only succeed when I compare it to 0.8.x.
Second, I tried to change the property name in package. json and then told that the deployment would not work.
Third, I have eliminated the ENV variable. Every time I redeploy, there may be a way to avoid it.
Misc Notes and Dashboard
I like Nodejitsu. Any custom configuration will be processed through the standard package. json file. You can even define custom predeploy and postdeploy hooks. My impression is that it is flexible to deploy and view logs.
Heroku
Https://www.heroku.com/
PaaS is an extremely popular platform constructed using ubiquitous Ruby on Rails.
Variable Configuration
We also set our SECRET using CLI to overwrite the default value.
All applications run on port 5000, so you need to listen to this port.
Finally, you need to create a Procfile to describe the web application: node server. js. This is only a small side effect of the PaaS platform that supports multiple languages.
Deployment
Heroku's "toolbelt" CLI is used to manage your account and applications, but the deployment is through git. You only need to add terminals and they will provide you with remote access in your git configuration, because they do not fully support Node. js, I was pleasantly surprised to find that they already support v 0.10.6. My first deployment seemed to be successful, but I received a tracing error and guided me to find out how many resources need to be specified for the first time, I want to work on this program:
Heroku ps: scale web = 1
After that, it was smooth sailing.
Miscellaneous description and Control Panel
I have not tried Heroku for my own project until about three months ago, in part because I have a moderate standard to help me adjust my server, and partly because I think they are dealing with node. js, but if you can overcome their shortcomings about WebSocket support and some error mark and statistics, this is a pretty good experience.
They also get a very nice and functional control panel, with some convenient features that make you not feel like other places pointing to the 404 page in the S3-hosted file, in addition, the ownership of the project can be transferred to different users.
Modulus
Http://modulus.io
The. io suffix is a relatively new service. Node. js is embedded with support for MongoDB and local file storage.
Configuration variables
You can configure variables through the web interface or CLI. I am trying to create SECRET. After trying and encountering an error, I found no space in the variable! It is strange that the SECRET module does not work.
The application needs to listen to PORT 8080, "but we recommend that you use the PORT environment variable (process. env. PORT )."
Deployment
The deployment can be done through CLI, but you can also compress the entire project and upload it through their interesting network interfaces. I have no problems with deployment, but every time I want to package and upload your entire project (except node_modules, this makes it much slower to process than the tools that use git's "diff" function or rsync.
As for writing, the module runs on version 0.8.15 and ignores any content you specify in package. json.
Other precautions and dashboards
I cheered for these guys and hoped they could continue to improve. There is a built-in MongoDB option that will be good, I like the early pricing.
AppFog
Http://appfog.com
AppFog was previously known for PHP Fog and has now been acquired by CenturyLink. You can specify the cloud you want to use, such as AWS, HP, and Azure cloud in different regions.
Configuration variables
You can set variables through the web console or CLI (command line tool. Setting private variables is no problem.
This document requires listening to the process. env. VCAP_APP_PORT port, but I try to use the default configuration to work properly. The log shows that the listener is listening to port 57277.
Deployment
CLI tools are also used. When writing this article, AppFog uses v0.8.14 and ignores version settings in package. json.
Other precautions and dashboards
Its free plan looks generous. It provides up to 8 instances with a total of 2 gb ram and can be used separately. It also has the built-in MongoDB option.
Windows Azure
Http://windowsazure.com
Variable Configuration
Variables can be configured through network interfaces or CLI. The first time I configured SECRET through CLI, I encountered a strange small problem. The SECRET changed to secret. So I have to use network interfaces to correct it.
The application runs well without making any changes to the port, but a strange value is found in the log: \. \ pipe \ bea0dffc-de5b-47f4-8575-4d17c2175fd5
Deployment
I hope Microsoft can have more custom items here, because when some files are added to the Code (named azure_error and iisnode. yml). CLI is automatically installed through npm and deployed through git.
Azure runs the 0.8.2 version, but this version can be reconfigured in the package. json file.
Precautions and dashboards
The Account creation process is currently the most boring. It includes text message verification, a Windows Live account, and a Git account that is separately used for deployment. But in general, the dashboard is quite good in terms of the huge scope of the Azure platform. They also support flow log files. As for what I can tell, Heroku is the only vendor to do so.
DotCloud
Http://dotcloud.com
Supports multiple languages. Just like Nodejitsu, they have recently canceled their free services, so they need to bind a credit card before getting started.
Parameter configuration
You can set parameters through CLI or a dotcloud. yml file.
The listening port must be set to 8080.
Deployment
DotClouds CLI is written in Python and rsync is used to minimize the data to be uploaded during each deployment. To prepare a book, you need to configure the supervisord. conf and dotcloud. yml files.
Currently, the dotCloud version is 0.6.20. Ouch.
Precautions and Control Panel
In the early days, I was very angry when they made some major changes but were barely warned. I guess this is the world of beta, but I have never been in a rush to come back.
Engine Yard
Http://engineyard.com
Like Heroku, Engine Yard is hosted through Ruby on Rails. However, we have more options for installation and environment configuration. People with experience in server management will think that Engine Yard is more like directly operating a server, but this is still PaaS.
Variable Configuration
We can configure environment variables through the npm module ey_config. Engine Yard also supports accessing your machine through SSH, so that we can directly create config. json and put it in a correct place.
Deployment
This is deployed through git, but the node version in the package. json file only supports 0.8.11 at most.
Precautions and Control Panel
When we create an application, we need to select nginx (recommended) as the front-end proxy or use Node. js, which supports WebSockets.
When I fail to deploy the service for the first time, a dialog box is displayed that allows me to enter the mobile phone number.
OpenShift.com
Http://openshift.com
OpenShift is an open-source project mainly maintained by Red Hat. OpenShift.com is a hosted service platform (such as WordPress.org and WordPress.com ).
Configuration variables
OpenShift.com supports Using SSH to connect to your computer, which means you can create a config. json file and put it in a proper place. Otherwise, no special commands are available to pre-define the configuration file.
The port is process. env. OPENSHIFT_INTERNAL_PORT | 8080.
Deployment
If you are not a fan of Web-based GUI, use git to create and manage projects. add your public SSH key to your account, which is not included in node. js quick advanced sample step.
The node version number in the package. json file is ignored, and v0.6.20 is used by default. However, you can change it through additional operations.
Precautions and Control Panel
Previously, I had some problems with obtaining sample applications, so I started again and asked OpenShift to fill the git repository with their sample files. Here is a small note, including the deploy hook and some configuration files under the openshift directory. The README file shows the structure and describes the meaning of each file.
However, I am still confused about listening to a specific IP address, as shown below:
Var ipaddr = process. env. OPENSHIFT_NODEJS_IP | "127.0.0.1 ";
Add ipaddr to the app. listen of the server. js file, as shown in the following figure:
App. listen (app. get ('Port'), ipaddr, function (){...
I have already communicated with OpenShift related personnel, and they will also update the Getting Started Guide to make this part easier to understand.
CloudFoundry
Http://cloudfoundry.com
First, CloudFoundry has a clear and friendly getting started process. However, after several screens, I got the message:
* We are in a transitional period :*
You are reading the V2 documentation... Cloudfoundry.com and will be upgraded to V2.
So I will switch back to them in the next phase of this series.
Coming soon
Needless to say, the world is changing rapidly. Do not put too much attention on any specific details unless you check for updates first. For example, I wrote this article two days ago and Modulus sent me an email about the upgraded version of Node. js.
In future articles, I will continue to monitor and test the performance of these platforms, and then record the scaling of their snapshots. During this period, if I miss your favorite Node. js PaaS, please let me know.
Via http://www.oschina.net/translate/a-comparison-of-node-js-paas-hosting-providers