ericholiveira / studio-cluster

Auto cluster for Studio framework
23 stars 4 forks source link

Multiple Networks Support #16

Closed sean-hill closed 8 years ago

sean-hill commented 8 years ago

Hey there,

Now that I've gotten studio-cluster working perfectly locally with redis and multiple process's, I decided to give it a whirl with an Amazon Linux Instance. Here's my configuration for my API that is working perfectly locally for studio-cluster:

rpcPort: 10120,
publisher: StudioCluster.publisher.redis(rpcPort, {
  password: 'XXX',
  host: 'pub-redis-12009.us-east-1-4.3.ec2.garantiadata.com',
  port: '12009'
})

And I have the same configuration for my services project. Again, it's working perfectly locally connecting to my remote redis connection. I have my API up and running here. That API route is simply responding with that text:

// Core - up

'use strict'

module.exports = (request, reply) => {
  reply('API is up!')
}

I have another route http://52.87.212.191:3000/core/status that actually uses a Studio Service call to reply with as shown below:

// Core - status

'use strict'

const Studio = require('studio')
const Services = Studio.services()

module.exports = (request, reply) => {
  Services.Core.status().then((status) => {
    reply(status)
  })
}

What I've done to test is deployed my API server to the Amazon Linux, and fired up my Services project locally on my machine (while pointing to the same redis connection as the API server has). However, if you click here you'll notice that the /core/status route is not replying.

It appears that the Studio services are no longer talking. Any ideas here?

ericholiveira commented 8 years ago

Did you opened the port 10120 on both machines for internet access(or at least, for each other) on your security group?

sean-hill commented 8 years ago

Yes, I have done that, unless I chose the wrong option.

screen shot 2016-06-13 at 10 50 24 am

ericholiveira commented 8 years ago

This custom tcp rule (port 10120) is open for 0.0.0.0 ? It is open on all machines? It needs to be open on the machine running studio service

sean-hill commented 8 years ago

Yes my the Amazon Server I have running for my API has it open.

screen shot 2016-06-13 at 10 53 30 am

I'm currently running the services on my local machine not on an Amazon instance. I assumed they could communicate through redis. If I am mistaken, I will fire up another Amazon instance for my services and test it that way 😄

ericholiveira commented 8 years ago

aeuhaeuhaeuhu yes... this is the reason... the thing is... the process running studio services needs to have port 10120 open... so if youre running on your machine, you will need to open port 10120 of your machine for internet access.... The services do not communicate through redis.... redis is used ONLY to service discovery, after discovered, the services start a websocket communication between process (process-to-process direct access)

I will close for now... let me know if you dont understand something and i will reopen, ok?

sean-hill commented 8 years ago

Just wanted to report back that I got it to work. 👍 Rock and roll. Thanks for the help! Studio cluster in a production environment!