capistrano-plugins / capistrano-unicorn-nginx

Capistrano tasks for automatic and sensible unicorn + nginx configuration
MIT License
175 stars 81 forks source link

Is it possible to connect to :app nodes using private ip? #75

Closed ricardokrieg closed 8 years ago

ricardokrieg commented 9 years ago

Considering a setting like this:

server '1.1.1.1', roles: %w{web app db}
server '2.2.2.2', roles: %w{app}

If I got it right, the nginx will be configured this way:

server 1.1.1.1:8080 fail_timeout=0;
server 2.2.2.2:8080 fail_timeout=0;

But I want to connect to server 2.2.2.2 using its private ip (3.3.3.3). Is there a way to do this?

ricardokrieg commented 9 years ago

Reading the code, it seems its not possible. I'll try to implement this feature.

seanlinsley commented 9 years ago

Given this configuration:

server '1.1.1.1', roles: %w{web}
server '2.2.2.2', roles: %w{app db}, private_ip: '3.3.3.3'

You can do this in the NGINX template:

server <%= primary(:app).properties.private_ip %>:8080 fail_timeout=0;
rhomeister commented 8 years ago

Closing due to lack of activity. Happy to accept a PR though.