Review of OpenShift Node.js Support
I recently worked with a bunch of guys from Red Hat's OpenShift PaaS “Platform as a Service” to get a blog post published over there. While I was working with their interface and making tweaks to my Node.js game engine, I was keeping a bunch of mental notes on what sort of changes I would like to see. I did send this list over to them, but I figured it would benefit everyone to see this information.
OpenShift Node.js Specific
Applications are run directly, e.g. with `node server.js`. Apps should have the option of being run directly with node or with a management utility. Forever is such a utility for restarting node apps when they die. You might have seen a different type of app, Supervisor, which runs node apps and restarts them when the developer changes js files, but this wouldn't be as useful on a server.
The version of node on OpenShift is 0.6, which is about 8 months behind (forever in node years!) Not only should OpenShift always be up to date, but it should probably support NVM (Node Version Manager) for allowing the user to set the version of node an app will use. Selecting the version with either package.json or with the GUI would be great. I haven't used it, but a lot of Node.js developers I know swear by it.
OpenShift should be able to support websockets. I'm guessing different accounts are shared on the same shared host, which is why the single port allocated to that host is available as an environment variable. I'm not a websocket guru, but I think it works by dedicating random high ports for each client. To fix this, OpenShift might be able to allocate specific port ranges to each application, making this range available as an environment variable. To keep from burning through all the ports, make it an option for users to enable websockets if they know they'll need it when they create their app.
I was trying to follow the output of the running node app (e.g. console.log() commands, which are written directly to stdout), but the log command in rhc was showing me some sort of failed npm command output which didn't seem to have anything to do with my app.
OpenShift In General
The ip/port to bind to is available as an environment variable, and is fairly easy to discover this by looking at the default code when creating a new application. When adding the MongoDB cartridge, the user is given a bunch of information about the connection (e.g. port, ip, user, pass, collection). This would be a great way to also show the names of the environment variables available for MongoDB connections. Since, by at this point, OpenShift knows what language the application is using, it would be nice to also show how to access these environment variabels in said language. I didn't know about the MongoDB environement variables until I saw one of the RedHat guys mention them in a comment:
var mongo_user = process.env.OPENSHIFT_NOSQL_DB_USERNAME; var mongo_pass = process.env.OPENSHIFT_NOSQL_DB_PASSWORD; var mongo_collection = process.env.OPENSHIFT_APP_NAME;
Forums should have categories; they're kinda hard to navigate. Right now, forums are a linear set of posts, that seem to go back for 100 pages and then old posts might vanish into the ether. The forums are searchable, but categories would be a lot more navigable.
The documentation which has collapsible navigation in the left column reminds me of antiquated framed documentation from old corporate java type apps. They're hard to navigate and not too user friendly. It would be nice to see the documentation system for this refreshed (check out the express.js documentation for some cool ideas for simple, modern documentation).
Cartridges can be added via the web GUI, but not removed. Really, any feature available in the `rhc` cli utility should be available in the web GUI. I'm a big fan of command line tools, but it does make a barrier of entry to newbies. Starting and stopping an app and managing cartridges would be great candidate to begin with.
rhc utility command output is a little hard to understand. I would often type a command incorrectly, and not understand why. There's a fairly common format for specifying *nix commands and how arguments are optional, the output for rhc should probably be updated to reflect it. Also, this is super nit picky, but when running rhc on a standard sized 80×25 terminal, the text would often wrap.
OpenShift as a Node.js Hosting Contender
If Red Hat were to make these changes, OpenShift would become quite the contender in the Node.js hosting world. The best Node.js hosting services (e.g. Joyent) seem focus primarily on Node, OpenShift however is putting more or equal focus on all of their offerings.
OpenShift is a cheaper platform than the others, sporting three applications with the free plan. When signing up for Joyent, I can't even finish without first entering in my credit card information. The cheapest plan with Joyent costs $21.90 / month, which isn't a lot, but it doesn't compare to free OpenShift (or $7/mo cheap PHP shared hosts).