2

I have a few Upstart services that I would like to have started once Gitlab is started and ready to serve repositories.

There is a gitlab-runsvdir Upstart service (came with the gitlab package) that starts Gitlab on bootup, however using

start on started gitlab-runsvdir

did not prove to help, as Gitlab was still not ready when that service was started.

How can I setup Upstart services to start when Gitlab is ready to serve repositories?


Contents of /etc/init/gitlab-runsvdir.conf, as requested:

start on runlevel [2345]
stop on shutdown
respawn
post-stop script
   # To avoid stomping on runsv's owned by a different runsvdir
   # process, kill any runsv process that has been orphaned, and is
   # now owned by init (process 1).
   pkill -HUP -P 1 runsv$
end script
exec /opt/gitlab/embedded/bin/runsvdir-start

As far as I know, this came with the gitlab package.


  • Could you post the content of gitlab-runsvdir? – CameronNemo Jan 19 '15 at 17:43
  • @CameronNemo Done. – Santa Claus Jan 19 '15 at 18:12
  • 1
    I use gitlab as well, and the hard part is determining when gitlab is fully ready. It's not fully ready until all the unicorn workers are (until then you'll get 500/502 errors on the web interface). In practice that seems to take about a minute for me. You can examine your logs after a gitlab-ctl restart to see when the unicorn processes are up for you. – muru Jan 19 '15 at 18:23
  • 1
    Maybe having a post-start script in the upstart job that tries to ping the web interface for a couple minutes, then times out if it is not up by then, would be ideal? – CameronNemo Jan 19 '15 at 22:04
  • @muru: how about changing the upstart runlevel and priority of the services that depend on gitlab? (I don't use gitlab...) Talk to me in the chat room about this. – Fabby Jan 21 '15 at 11:25
1

Try gitlab-ctl. You can find it into the following paths :

/usr/bin/gitlab-ctl 
/opt/gitlab/bin/gitlab-ctl

for example

exec /usr/bin/gitlab-ctl start
exec /usr/bin/gitlab-ctl stop
  • This will start or stop gitlab, but I want to start services only once gitlab is actually ready to accept requests – Santa Claus Aug 27 '15 at 23:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.