Class: Unicorn::HttpServer

Inherits:
Object
  • Object
show all
Defined in:
lib/unicorn-lockdown.rb

Instance Method Summary collapse

Instance Method Details

#_original_spawn_missing_workersObject



28
# File 'lib/unicorn-lockdown.rb', line 28

alias _original_spawn_missing_workers spawn_missing_workers

#proc_name(tag) ⇒ Object

Override the process name for the unicorn processes, both master and worker. This gives all applications a consistent prefix, which can be used to pkill processes by name instead of using pidfiles.



44
45
46
47
# File 'lib/unicorn-lockdown.rb', line 44

def proc_name(tag)
  ctx = self.class::START_CTX
  $0 = ["unicorn-#{Unicorn.app_name}-#{tag}"].concat(ctx[:argv]).join(' ')
end

#request_filename(pid) ⇒ Object

The file name in which to store request information. The /var/www/request-error-data/$app_name folder is accessable only to the user of the application.



23
24
25
# File 'lib/unicorn-lockdown.rb', line 23

def request_filename(pid)
  "#{Unicorn.unicorn_lockdown_prefix}/www/request-error-data/#{Unicorn.app_name}/#{pid}.txt"
end

#spawn_missing_workersObject

This is the master process, set the master pledge before spawning workers, because spawning workers will also need to be done at runtime.



32
33
34
35
36
37
38
# File 'lib/unicorn-lockdown.rb', line 32

def spawn_missing_workers
  if pledge = Unicorn.master_pledge
    Unicorn.master_pledge = nil
    Pledge.pledge(pledge, Unicorn.master_execpledge)
  end
  _original_spawn_missing_workers
end