In a perfect world GitLab would now be running perfectly. Unfortunately, GitLab has surprisingly high memory requirements, so on 512MB VPSs it often chokes on the first sign in. This is because GitLab uses a lot of memory on the very first login. Since the Ubuntu 12.04 VPS has no swap space when the memory is exceeded parts of GitLab get terminated. Needless to say GitLab does not run well when parts of it are being unexpectedly terminated.
The easiest solution is just to allocate more memory to your VPS, at least for the first sign in. If you don’t want to do that, another option is to increase swap space. DigitalOcean already has a full tutorial on how to do this available here (although I would recommend adding more than just 512MB of swap). The quick fix is to run the following:
sudo dd if=/dev/zero of=/swapfile bs=1024 count=1024k sudo mkswap /swapfile sudo swapon /swapfile
Your swapfile is now running and active, but to set it so that it’s activated on each boot we need to edit
sudo nano /etc/fstab
Paste the following onto the bottom of the file:
/swapfile none swap sw 0 0
Now restart your VPS:
Wait a minute or two for your VPS to reboot, and then try GitLab again. If it doesn’t work the first time, refresh the Bad Gateway page a couple of times, and you should soon see the GitLab login page.
- Check out the excellent Gitlab installation documentation here.
- And for info on the 502 bad gateway error, check this thread.