0

I have a PHP App Server running Ubuntu 14.04 with a stack that contains an ELB, the server, and a MySQL RDS. All of this is working as expected, but to finalise my deployment I need to install node.js.

On the Chef Supermarket I have found a cookbook for node.js but I'm a little confused as to how to add it in regards to the lifecycle events - and even just in general. For example, the Node.js App Server contains events such as deploy::nodejs-undeploy and deploy::nodejs-stop yet this cookbook doesn't - primarily because it is for an installation. Would this be an issue for when an instance shuts down?

With that, how would I go about installing it altogether? Would it just be a case of cloning the repository to my private one and then adding to the setup lifecycle nodejs::default or are there any additional steps I would need to follow?

My final question is in regards to NPM - I'd need to install socket.io and express. I assume I can do this using the custom JSON feature (on the readme towards the bottom there appears to be this ability). With that does it just become a case of:

"nodejs": {
    "npm_packages": [
    {
        "name": "express"
    },
    {
        "name":"socket.io"
    } 
}

Or would it be done through some other mechanism?

Thank you very much in advance, and sorry for the mass questions - I feel I am totally out of my depth, but at least I'm learning an incredible amount!

J Young
  • 121
  • 1
  • 5
  • Why do you need to install node.js on the same server as php? Since you're looking install express, it sounds like you want to have both php and node.js serving web content. Since only one of them can claim port 80, how are these servers going to work together? If you add a bit more info I can try to provide an answer – Codebling Jul 13 '15 at 21:09

1 Answers1

0
  • Option 1: install PHP on your node.js deployment, run php as middleware through express
  • Option 2: have 2 separate servers, make node.js your main one, proxy requests to PHP server when needed.
Codebling
  • 162
  • 1
  • 6
  • @code-biling How? Can you please give some example. I have node.js environment exists & running well. Now I have to create another app using php. I have use nginx as server. thanks. – Manish Sapkal Oct 23 '15 at 08:19
  • @ManishSapkal It depends on a lot of things. What is the next step that you are having trouble with? Have a look at the http-proxy package. – Codebling Oct 23 '15 at 16:44