Works after installation but gets 502 error after first restart

I’m trying to set up a test instance of Gitlab so I can write some Gitlab API calls without using our production server at work.

I’ve installed Gitlab twice now, and in both cases it works flawlessly after installation, but upon system reboot I get a 502 error when navigating to the home page. The 502 error is returned instantly- there’s no perceptible timeout.

Calling ‘gitlab-ctl status’ seems to indicate everything is running (I think, I’m not entirely sure what everything I should be looking for).

I’ve tried issuing ‘gitlab-ctl restart’, as well as reconfigure then restart. Neither helps.

I’ve also just booted the server and waited for 5-10 minutes before accessing it, as some pages online suggested that the server can take a few minutes to startup.

I first installed the most recent omnibus CE version, I’m not sure what that version number is. I second installed 13.4.4-ee.0 as it matched what I’m using at work. Both were installed over a fresh installation of Ubuntu Server 20.04 LTS running on Virtual Box with 4GB of RAM.

Any help would be greatly appreciated.

OK- on a whim I started my server and let it sit for a long time- 20 minutes, and things look like they’re working normally now.

Is there any indicator that shows when a system ought to be up and running? As I said before the ‘gitlab-ctl status’ seemed to say that everything was running.

Sounds like your virtual server is under specced. I have a test vm with 8gb ram and starts fine maybe a 2-3min wait until the 502 disappears but this is normal.

Are you running virtualbox on a server or desktop/laptop? Make sure your server has enough cpu and ram to actually provide decent vm performance.

Increase from 4gb to 8gb ram. And make sure it has at least 4cpu/cores as well.

I’m not so sure @dsf900’s virtual machine is under specced, he might just be impatient (the 20 miutes wait is hopefully quite a lot too much, the 2-3 minutes @iwalker mentioned is hopefully enough).

Unfortunately GitLab takes quite a while to (re)start, and I haven’t found any command (short of just requesting a page and seeing if you get a 502) to accurately say whether GitLab is actually responding. But in most cases gitlab-ctl status saying that everything is running will eventually translate into GitLab running properly.

@grove yes, hard to say as we don’t know exactly the configuration, 4GB in theory should be enough, I’ve had more personal success with 8GB, and as per the docs 4cpu. My production server has 24GB, even though we are only 10 - 20 users, but that’s because I have some other things on there as well (not that it justifies 24GB, but just playing it safe). We also don’t know the host server specs or what else is running on it to know if it will affect the VM or not.

If it is really taking 20 minutes, then there is definitely an issue, if it’s not the specification of the virtual machine, then the host is obviously so overloaded, that it’s unable to deal with it all. Otherwise, I see no reason for it taking 20 minutes to react and start working. Unless the 20 minutes is because of waiting longer than actually needed, since even on an 8GB or 24GB ram server, after a restart, it’s normal for a 2-3 minute stabilisation period before all services are accessible.

My test host VM server has 16GB of ram, and so I would never attempt to run a VM on it that has 16GB of ram allocated, as need to leave ram free for the host. I would only attempt to run a VM with max 12GB, to leave at least 2 - 4GB for the host. Over-booking ram for VM’s also needs to be taken into consideration, and if the VM’s have the same amount of ram or more than the host physically has, then it (the host) would need to be upgraded to ensure it has enough ram.