Skip to content

Instantly share code, notes, and snippets.

@jrafanie
Last active April 7, 2016 14:53
Show Gist options
  • Save jrafanie/639157dd97155349a5c6a70e7d34a9cc to your computer and use it in GitHub Desktop.
Save jrafanie/639157dd97155349a5c6a70e7d34a9cc to your computer and use it in GitHub Desktop.
puma 3.0.0+ resets proctitle in rails server
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
gem 'sqlite3'
gem 'puma', "=3.3.0"
end
require 'active_record'
# This connection will do for database-independent bug reports.
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
ActiveRecord::Base.logger = Logger.new(STDOUT)
module Test
class Application < Rails::Application
end
end
options = {
:Host => "127.0.0.1",
:environment => "production",
:app => Test::Application
}
require "rails/commands/server"
Process.setproctitle("JoeApplicationProcess puma #{Puma::Const::PUMA_VERSION}")
Rails::Server.new(options).tap do |server|
Dir.chdir(Rails.application.root)
server.start
end
$ ps -ef |grep puma
503 86042 58636 0 10:06AM ttys000 0:00.00 grep puma
503 86020 410 0 10:06AM ttys001 0:02.14 JoeApplicationProcess puma 2.14.0
$ ps -ef |grep puma
503 86000 58636 0 10:06AM ttys000 0:00.00 grep puma
503 85977 410 0 10:05AM ttys001 0:02.12 JoeApplicationProcess puma 2.16.0
$ ps -ef |grep puma
503 86081 58636 0 10:06AM ttys000 0:00.00 grep puma
503 86062 410 0 10:06AM ttys001 0:02.16 puma 3.0.0 (tcp://127.0.01:9292) [Code]
$ ps -ef |grep puma
503 86119 58636 0 10:07AM ttys000 0:00.00 grep puma
503 86097 410 0 10:07AM ttys001 0:02.15 puma 3.1.0 (tcp://127.0.01:9292) [Code]
$ ps -ef |grep puma
503 86157 58636 0 10:07AM ttys000 0:00.00 grep puma
503 86137 410 0 10:07AM ttys001 0:02.16 puma 3.2.0 (tcp://127.0.01:9292) [Code]
$ ps -ef |grep puma
503 86194 58636 0 10:07AM ttys000 0:00.00 grep puma
503 86176 410 0 10:07AM ttys001 0:02.12 puma 3.3.0 (tcp://127.0.01:9292) [Code]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment