[GLLUG] nginx oops!

MJ mirojrsc at yahoo.co.uk
Sun Nov 29 16:23:04 UTC 2020


 this is seriously OH DEAR ;-( none of languages I comprehend in any way shape or form

# frozen_string_literal: true

require_relative "load_config"

port = ENV["PORT"]
port = port && !port.empty? ? port.to_i : nil

listen port || AppConfig.server.listen.get unless RACKUP[:set_listener]
pid AppConfig.server.pid.get
worker_processes AppConfig.server.unicorn_worker.to_i
timeout AppConfig.server.unicorn_timeout.to_i
stderr_path AppConfig.server.stderr_log.get if AppConfig.server.stderr_log?
stdout_path AppConfig.server.stdout_log.get if AppConfig.server.stdout_log?

preload_app true
@sidekiq_pid = nil

before_fork do |_server, _worker|
 ActiveRecord::Base.connection.disconnect! # preloading app in master, so reconnect to DB

 # disconnect redis if in use
 unless AppConfig.environment.single_process_mode?
 Sidekiq.redis {|redis| redis.client.disconnect }
 end

 if AppConfig.server.embed_sidekiq_worker?
 @sidekiq_pid ||= spawn("bin/bundle exec sidekiq")
 end
end

after_fork do |server, worker|
 Logging.reopen # reopen logfiles to obtain a new file descriptor

 ActiveRecord::Base.establish_connection # preloading app in master, so reconnect to DB

 # We don't generate uuids in the frontend, but let's be on the safe side
 UUID.generator.next_sequence

 # Check for an old master process from a graceful restart
 old_pid = "#{AppConfig.server.pid.get}.oldbin"

 if File.exist?(old_pid) && server.pid != old_pid
 begin
 # Remove a worker from the old master when we fork a new one (TTOU)
 # Except for the last worker forked by this server, which kills the old master (QUIT)
 signal = (worker.nr + 1) >= server.worker_processes ? :QUIT : :TTOU

 Process.kill(signal, File.read(old_pid).to_i)
 rescue Errno::ENOENT, Errno::ESRCH
 # someone else did our job for us
 end
 end
end


--
=============================================
"I JUST WANNA DO GOD'S WILL!" -- Dr. Martin L. King Jr.
"AND IF YOU TOLERATE THIS, YOUR CHILDREN WILL BE NEXT" -- MSP
=============================================


     On Sunday, 29 November 2020, 15:48:22 GMT, John Winters via GLLUG <gllug at mailman.lug.org.uk> wrote:  
 
 On 29/11/2020 15:39, MJ via GLLUG wrote:
> in /home/diaspora/.rvm/gems/ruby-2.6.5 at diaspora/bin/unicorn -c

The above is a command, not a directory, so it can't really contain your 
config/unicorn.rb

> there is no config/unicorn.rb > nor in
> #############:/home/diaspora/.rvm/config# ls
> alias db displayed-notes.txt known known_aliases known_strings md5 
> pre_commit.yml remote sha512 solaris ssh.example
> #############:/home/diaspora/.rvm/config#

I certainly wouldn't expect to find it in your Ruby Version Manager 
configuration directory.

I'm not familiar with this particular piece of software (Diaspora) so I 
don't know how it lays out its directory structure but I'd be pretty 
confident that the file must exist because you've invoked it explicitly 
specifying that configuration file, so I'd expect it to complain if it 
wasn't there.

It will presumably be under the working directory of your software, so 
take a look at:

/etc/systemd/system/diaspora-web.service

and look for a line which reads something like:

WorkingDirectory=/home/...

Then in that directory look for a sub-directory called config containing 
a file called unicorn.rb.

Cheers,
John

-- 
Xronos Scheduler - https://xronos.uk/
All your school's schedule information in one place.
Timetable, activities, homework, public events - the lot
Live demo at https://schedulerdemo.xronos.uk/

-- 
GLLUG mailing list
GLLUG at mailman.lug.org.uk
https://mailman.lug.org.uk/mailman/listinfo/gllug  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.lug.org.uk/pipermail/gllug/attachments/20201129/5680f03b/attachment-0001.html>


More information about the GLLUG mailing list