[DRE-maint] Bug#846179: gitlab: Use notify on ready under systemd instead of hack with sleep + check commandline
Jason Rhinelander
jagerman at jagerman.com
Tue Nov 29 01:39:11 UTC 2016
Package: gitlab
Version: 8.13.6+dfsg1-2
Severity: normal
Dear Maintainer,
The current systemd service file for gitlab-sidekiq contains a hack to
delay the systemd service startup until sidekiq is actually ready by
sleeping for up to 32 seconds (in increments of 4 seconds) until
sidekiq's cmdline changes.
Besides being an unpleasant hack, and potentially ending too early (e.g.
if sidekiq takes more than 32 seconds to start up on a slow/loaded
machine), this also has the unfortunate consequence of showing this
command forever in the service status output, and of making the service
take up to 4 seconds longer than necessary to actually be registered as
started.
We can do much better by performing a proper systemd notify, as follows
(I've tested this locally, and it works properly):
1. Patch the installed /etc/gitlab/initializers/sidekiq.rb to add, near
the top of the configure_server function:
if ((socket_path = ENV["NOTIFY_SOCKET"]))
config.on(:startup) do
notify_socket = Socket.new(Socket::AF_UNIX, Socket::SOCK_DGRAM, 0)
notify_socket.connect(Socket.sockaddr_un(socket_path))
notify_socket.sendmsg "READY=1", Socket::MSG_NOSIGNAL
end
end
2. change the gitlab-sidekiq.service file to contain:
Type=notify
and delete the ExecStartPost= line.
Then we get proper notification support: notification happens
immediately upon sidekiq being ready, the hack is gone, and the job
starts faster.
Jason Rhinelander
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4248 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-ruby-extras-maintainers/attachments/20161128/49302717/attachment.bin>
More information about the Pkg-ruby-extras-maintainers
mailing list