Solved Troubleshooting service startup

Good afternoon all,

I've installed Gitlab into a FreeBSD 10.2 Jail and got everything working nicely, except for the fact that when the Jail starts, Gitlab doesn't...All of the other related services start (redis, postgresql, and nginx).

The rc(8) script I'm using is from here and I've placed it at /usr/local/etc/rc.d/gitlab. In my /etc/rc.conf I've added the following:
Code:
redis_enable="YES"
postgresql_enable="YES"
gitlab_enable="YES"
nginx_enable="YES"

If I do a service start gitlab, it starts without any problems. It takes maybe 20 seconds, but it starts.

There doesn't seem to be any errors in /var/log/dmesg or /var/log/messages, so I'm now at a loss as to where to look to troubleshoot this...

Many thanks,
Ben
 
Has all the Gitlab stuff been added to the ports tree? Last time I looked they were still working on it.

In any case, I think it's "normal" for Gitlab to take a while to startup. If the service starts without any problems what are you looking for to troubleshoot?
 
I installed Gitlab manually, as when I did a pkg search gitlab I got zip - I forgot to check /usr/ports though...

The problem I'm trying to troubleshoot is why Gitlab starts up fine manually, but doesn't start up when the Jail does.
 
Ah, right. One thing I can imagine is that it tries to start Gitlab before any of the other services are started. And it may fail because of that. Doing it by hand would work because at that time the required services had some time to start themselves.

You could try to add a REQUIRE to the top of the Gitlab rc(8) script. If you look at the scripts for nginx, for example, there's a PROVIDES line, if you add the service it provides to a REQUIRE line in the Gitlab script you can make sure the order of starting is correct.
 
Hmmm, alas no...

I've added # REQUIRE: LOGIN nginx postgresql redis to the file, but still no luck. I've also fixed the shebang (from #! /bin/sh to #!/bin/sh).

I think I'm going to have to insert echo's into the script to see what does and what does not get run on boot, and then try to figure out why that's different to doing it manually.
 
That's helped me to see that although the service is listed in the output of service -e, it doesn't seem to actually be checked or called on jail boot...
Still modifying bits, and I'm thinking it might be a "fun" task at the weekend to rewrite the whole thing...
 
I ended up putting the Linux RC script in
/usr/local/bin and then crafting a FreeBSD RC script which called the Linux one with appropriate arguments, etc. I might revisit it in the future, but it works for now.
 
  • Thanks
Reactions: Oko
Back
Top