"Please see the install instructions in the drupal-node.js NPM package. You will need to provide the hostname and port of your Drupal site to the Node.js process, and ensure that the service token matches in Drupal and in Node.js."

What does that mean?

is it
npm localhost port

What if you are on a multisite?
Can I pass in the settings file instead?

Comments

SocialNicheGuru created an issue. See original summary.

SocialNicheGuru’s picture

Title: How do you start the npm now especially in multiserver setup? » Setting up the new nodejs on a multisite/aegir install

Ok so I decided to do this globally.
I set my nodejs up outside of the drupal root directory
I am also on a multsite Aegir install
I am on ubuntu 14.04

sudo npm install -g drupal-node.js
sudo npm install -g forever

it was installed within: /usr/local/lib/node_modules/drupal-node.js

cd /usr/local/lib/node_modules/drupal-node.js
more Readme.md

link app.js to the new directory
but copy node.config.js.example from install directory drupal-node.js to the directory below:

sudo mkdir /var/aegir/platforms/7/nodejs-server
sudo mkdir /var/aegir/platforms/7/nodejs-server/my-drupal-site.com

Please notice that you must link app.js to the directory that you just created

sudo ln -s /usr/local/lib/node_modules/drupal-node.js/app.js  /var/aegir/platforms/7/nodejs-server/my-drupal-site.com/
sudo cp /usr/local/lib/node_modules/drupal-node.js/node.config.js.example  /var/aegir/platforms/7/nodejs-server/my-drupal-site.com
sudo chown aegir:aegir /var/aegir/platforms/7/nodejs-server/my-drupal-site.com/node.config.js.example
cd /var/aegir/platforms/7/nodejs-server/my-drupal-site.com/
sudo mv node.config.js.example node.config.js

change the config file

vi node.config.js

directory structure should look like:
/var/aegir/platforms/7/nodejs-server/my-drupal-site.com/
app.js
node.config.js
also add any extensions to this directory and modify the node.config.js file accordingly

start node server with either of the following:
node app.js

or
forever start app.js

SocialNicheGuru’s picture

I had a slight gotcha:
the servicekey, $conf['nodejs_service_key'], must be specified in two places:
1. in the nodejs.config.js file above

and one of the following:

2a) in settings.php

or

2b) enable nodejs_config and specify it there.

glekli’s picture

It sounds like you have figured it out. Are you still having problems with this setup?

On a side note, you don't necessarily need to have multiple copies or symlinks of the app for each site. All you need is a separate config file for each site, and you can run multiple instances of the app by specifying various config files as the argument.

E.g.
node app.js mysite1.config.js
node app.js mysite2.config.js

Each configuration will need to be set up to listen on different ports, though.

SocialNicheGuru’s picture

Ok. Thanks. and the mysite1.config.js file is just a modified copy of node.config.js?

i symlinked it so that I could run the node command from the directory that I setup otherwise it would look like

node /path/to/file/app.js mysite1.config.js

or it i ran it from where app.js is:

node app.js /path/to/file/mysite1.config.js

SocialNicheGuru’s picture

Don't forget to add the ssl keys in the nodejs.config.js file if needed.