1

I'm trying to install and host gitlab, but it requires and pulls in Nginx. Which would be fine, except I use Caddy and Caddy doesn't play well with Nginx and has to be disabled for Nginx to even start.

I like Caddy a lot, especially the built in file server, so just switching completely to Nginx isn't an option. I also have no interest in trying to do firewall redirects to try to use Nginx on a nonstandard port.

Is there any way to use gitlab without nginx, eg Caddy? There's no official documentation and the last thing I tried from an online forum completely broke my gitlab install and only pertained to Apache which I'm not using

My system is a dedicated cloud server running Ubuntu 20.04.

6
  • 4
    Put it in its own virtual machine. It's 2020, we don't have monolithic multipurpose servers anymore. Commented Aug 18, 2020 at 1:47
  • 1
    @MichaelHampton you mean use docker? it's 2020 afterall Commented Aug 19, 2020 at 21:22
  • @JacobEvans I suppose if you really wanted to and GitLab supported it, you could. Commented Aug 19, 2020 at 21:47
  • 1
    @MichaelHampton They have do official images. hub.docker.com/r/gitlab/gitlab-ce Commented Aug 19, 2020 at 22:07
  • To be fair I did try the docker images but ran into the same problem that Caddy doesn't play well with other services binding to the same port Commented Aug 20, 2020 at 12:00

2 Answers 2

2

The answer from unixandria is correct for when it's from. Things have changed a little since then.

There's now this official section on GitLab Docs.

Also, GitLab 13.5 changed the location of the unix socket, so the Caddyfile should have this now:

git.example.com { reverse_proxy unix//var/opt/gitlab/gitlab-workhorse/sockets/socket } 
5

I finally figured it out.

GitLab doesn't listen on a port but a Unix socket. Luckily we can configure Caddy to reverse proxy to the socket in the Caddyfile like so:

git.example.com { reverse_proxy * unix//var/opt/gitlab/gitlab-workhorse/socket } 

Make sure caddy user is in git and gitlab-www groups and vice versa.

In /etc/gitlab/gitlab.rb make sure these are configured as such:

nginx['enable'] = false web_server['external_users'] = ['caddy'] web_server['username'] = 'gitlab-www' web_server['group'] = 'gitlab-www' web_server['uid'] = nil web_server['gid'] = nil web_server['shell'] = '/bin/false' web_server['home'] = '/var/opt/gitlab/nginx' 

Then do

sudo gitlab-ctl reconfigure sudo systemctl restart caddy (or restart Caddy manually if you don't use systemd) 

I've only tested with the official caddy and GitLab-EE packages on Ubuntu 20.04, and don't configure Caddy via API, but this should work for standard installs of GitLab.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.