I'm loving the node.js integration module and am already finding ways to integrate it in more creatively as the days go on. One thing I have noticed though: server.js must be within a drupal instance to work properly, therefore always combining your drupal instance with your server. I want to scale my application and have mysql and node.js running on their own server, and apache on another box running my drupal instance. I tried putting server.js on another box and it runs perfectly, until I try and hit it and authenticate.

Per my understanding, you authenticate to server.js with an MD5 hash of your session ID. For the server.js to receive /auth requests correctly, hook_menu has to be implemented to tell the server that something requesting /auth/[md5-hash]. From then it does a lookup on the session DB table to make sure you are legit. If server.js is running on another box somewhere though, this means that it needs to have a drupal database for it, plus the most up-to-date session information. The only way I can see around this is setting up master/slave mysql configuration for drupal, with the slave on the same box as server.js, then having a vanilla drupal instance with the node.js integration module installed and enabled so hook_menu is called correctly on your server when hitting /auth

Am I making this too complicated for myself? Is there an easier way to offload my server.js that comes with the module onto another box and still play nice with my authenticated users?

Comments

Anonymous’s picture

Title: Separating server.js and your drupal instance » Improve node.js setup documentation

There's no need to run node.js and drupal on the same machine.

Obviously, this is not clear ;-)

Let's use this issue to fix that.

LSU_JBob’s picture

Cool.

Nice talk on lullabot btw!

So where should I start with this? It's not clear to me how to get auth working without that session table and hook_menu to define the /auth callback.

LSU_JBob’s picture

Just talked with justin and got some clarity on this, I'll post a patch once I try some things and get it working!

LSU_JBob’s picture

Assigned: Unassigned » LSU_JBob
Illusioneer’s picture

I've installed a half dozen NodeJS apps before, and I can say I've run into more problems getting this one up (I have given up on the dozenth annoying gotcha).
You might want to put some attention into a more detailed install doc, something a bit more in depth than "install, copy config and run node serverjs."

LSU_JBob’s picture

Agreed, will update.

Illusioneer’s picture

One gotcha with NodeJS I ran into early on was setting up the NODE_PATH and also when you install via npm, the node_modules has a local and global setting which can trip users.

@LSU_JBOB : I'd be happy to give you a hand writing some install docs (once I can get my own install working)

joachim’s picture

Subscribe.

I've yet to get this working myself.

LSU_JBob’s picture

We're constantly trying to improve the documentation with every release, but please make sure you follow the directions very closely (in the module docroot and the socket_io directory), more times than not you need to make a symlink to your socket.io install or don't have npm installed. It took me days to get this working when I first started but that was because I missed a very important first step.

joachim’s picture

> you need to make a symlink to your socket.io install

That bit isn't really clear...

jzacsh’s picture

I'm curious - now that @tizzo gave us a proper package.json to utilize `npm install`, is the bit about symlinking socket.io still an issue?

Also just a heads up, #1261066: pull the actual node.js code itself out into a separate npm module, instead of shipping it with drupal module should also help address difficulties installing/configuring (as the node.js server will be downloaded/installed/ran just as any other npm package).

TelFiRE’s picture

Where is socket.io? Is this possible on shared hosting?