Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

odd behavior related to 'unicorn_use_tcp' #89

Open
nextofsearch opened this issue Jul 25, 2016 · 2 comments
Open

odd behavior related to 'unicorn_use_tcp' #89

nextofsearch opened this issue Jul 25, 2016 · 2 comments

Comments

@nextofsearch
Copy link

Hi,

I just found out a very odd behavior related to 'unicorn_use_tcp'

If I don't set any value for :unicorn_use_tcp, 1) when there is only one server, 'unicorn_use_tcp' works as false. 2) when there are more than 1 server, 'unicorn_use_tcp' seems to be true. This results in a disaster since the upstream setting in the nginx conf goes wrong when running 'cap nginx:setup'

  1. upstream unicorn_tp_staging {
    server unix:/home/xxxxxxxxxxx/shared/sockets/unicorn.tp_staging.sock fail_timeout=0;
    }

  2. upstream unicorn_tp_staging {
    server 54.xxx.xxx.xxx:8080 fail_timeout=0;
    server 54.xxx.xxx.xxx:8080 fail_timeout=0;
    }

My case was, that it worked well in a staging environment with 1 API server then it shut down in a production environment with multiple servers. It can be avoided by setting it explicitly as you want but this is not what I expected and I think it definitely needs to be fixed.

Thanks,

@nextofsearch
Copy link
Author

I just found out that this is an intended feature as described here

set :unicorn_use_tcp, -> { roles(:app).count > 1 }

  • true if there are multiple app servers. nginx and unicorn communicate over tcp port.
  • false for single node configuration. nginx and unicorn communicate over unix socket.

We have multiple servers when each server has nginx (proxy) and unicorn communicate over unix socket behind a load balancer.

@nextofsearch
Copy link
Author

I think changing a default value by a certain condition is not a good idea. Not sure which case is more common, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant