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

Add Unicorn support #9

Merged
merged 2 commits into from
Mar 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ And then execute:

### Registering metrics on server process start

Currently, yabeda-rails automatically registers rails metrics when a server is started via `rails server` or `puma -C config/puma.rb`. However, other application servers or launching via `rackup` aren't supported at the moment.
Currently, yabeda-rails automatically registers rails metrics when a server is started via `rails server`, `puma -C config/puma.rb` or `unicorn -c`. However, other application servers or launching via `rackup` aren't supported at the moment.

A possible workaround is to detect server process and manually activate yabeda-rails in an initializer:

Expand Down
6 changes: 5 additions & 1 deletion lib/yabeda/rails/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ def puma_server?
::Rails.const_defined?('Puma::CLI')
end

def unicorn_server?
::Rails.const_defined?("Unicorn::Launcher")
end

config.after_initialize do
::Yabeda::Rails.install! if rails_server? || puma_server?
::Yabeda::Rails.install! if rails_server? || puma_server? || unicorn_server?
Yabeda.configure! unless Yabeda.already_configured?
end
end
Expand Down