On this config
# https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server
workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads_count = Integer(ENV['MAX_THREADS'] || 5)
threads threads_count, threads_count
preload_app!
rackup DefaultRackup
port ENV['PORT'] || 10000
environment ENV['RACK_ENV'] || 'development'
daemonize false
bind 'tcp://192.168.23.3:10000'
on_worker_boot do
# Worker specific setup for Rails 4.1+
# See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
ActiveSupport.on_load(:active_record) do
ActiveRecord::Base.establish_connection
end
end
I expect puma to listen only on 192.168.23.3:10000
but when I run it with
bundle exec puma -C ./config/puma.default.rb
I got
$ bundle exec puma -C ./config/puma.default.rb
[50] Puma starting in cluster mode...
[50] * Version 2.15.3 (ruby 2.2.3-p173), codename: Autumn Arbor Airbrush
[50] * Min threads: 5, max threads: 5
[50] * Environment: production
[50] * Process workers: 2
[50] * Preloading application
Overwriting existing field _id in class App.
Creating scope :page. Overwriting existing method NotificationServices::CampfireService.page.
Creating scope :page. Overwriting existing method NotificationServices::FlowdockService.page.
Creating scope :page. Overwriting existing method NotificationServices::GtalkService.page.
Creating scope :page. Overwriting existing method NotificationServices::HipchatService.page.
Creating scope :page. Overwriting existing method NotificationServices::HoiioService.page.
Creating scope :page. Overwriting existing method NotificationServices::HubotService.page.
Creating scope :page. Overwriting existing method NotificationServices::PushoverService.page.
Creating scope :page. Overwriting existing method NotificationServices::SlackService.page.
Creating scope :page. Overwriting existing method NotificationServices::WebhookService.page.
[50] * Listening on tcp://0.0.0.0:10000
[50] * Listening on tcp://192.168.23.3:10000
/home/domains/errbit.somecompany.com/vendor/bundle/ruby/2.2.0/gems/puma-2.15.3/lib/puma/binder.rb:234:in `initialize': Address already in use - bind(2) for "192.168.23.3" port 10000 (Errno::EADDRINUSE)
from /home/domains/errbit.somecompany.com/vendor/bundle/ruby/2.2.0/gems/puma-2.15.3/lib/puma/binder.rb:234:in `new'
from /home/domains/errbit.somecompany.com/vendor/bundle/ruby/2.2.0/gems/puma-2.15.3/lib/puma/binder.rb:234:in `add_tcp_listener'
from /home/domains/errbit.somecompany.com/vendor/bundle/ruby/2.2.0/gems/puma-2.15.3/lib/puma/binder.rb:98:in `block in parse'
from /home/domains/errbit.somecompany.com/vendor/bundle/ruby/2.2.0/gems/puma-2.15.3/lib/puma/binder.rb:84:in `each'
from /home/domains/errbit.somecompany.com/vendor/bundle/ruby/2.2.0/gems/puma-2.15.3/lib/puma/binder.rb:84:in `parse'
from /home/domains/errbit.somecompany.com/vendor/bundle/ruby/2.2.0/gems/puma-2.15.3/lib/puma/runner.rb:119:in `load_and_bind'
from /home/domains/errbit.somecompany.com/vendor/bundle/ruby/2.2.0/gems/puma-2.15.3/lib/puma/cluster.rb:305:in `run'
from /home/domains/errbit.somecompany.com/vendor/bundle/ruby/2.2.0/gems/puma-2.15.3/lib/puma/cli.rb:215:in `run'
from /home/domains/errbit.somecompany.com/vendor/bundle/ruby/2.2.0/gems/puma-2.15.3/bin/puma:10:in `<top (required)>'
from /home/domains/errbit.somecompany.com/vendor/bundle/ruby/2.2.0/bin/puma:23:in `load'
from /home/domains/errbit.somecompany.com/vendor/bundle/ruby/2.2.0/bin/puma:23:in `<main>'
When I run it with
bundle exec puma -C ./config/puma.default.rb -b tcp://192.168.23.3:10000
Is OK but I don't want to specify the binding on two places.
When you use the port option, it's adding a bind to 0.0.0.0 with the requested port. Remove the port line and this behavior will go away.
Most helpful comment
When you use the
portoption, it's adding a bind to 0.0.0.0 with the requested port. Remove theportline and this behavior will go away.