installing GitLab on VPS running Parallels Plesk

Diederik Van Remoortere picture Diederik Van Remoortere · Jul 10, 2014 · Viewed 7.7k times · Source

I'm thinking about installing GitLab Community Edition on my VPS which is currently also running svn & Parallels Plesk (git should eventually replace svn). The VPS hosts a couple of websites, none of which carry heavy load.

VPS specs: CentOS 6.5 RAM 2Gb CPU Intel Xeon 2,3Ghz

I'm wondering if the installation of GitLab could somehow mess up Plesk or will both work flawlessly alongside each other?

also: how do bind the domain name to the server? i.e. git.myserver.com should not be done through plesk, right?

Answer

nilo picture nilo · Feb 11, 2015
  1. Add a new subdomain in Plesk e.g. gitlab.domain.com.
  2. Remove all files under: /var/www/vhosts/domain.com/gitlab.domain.com/
  3. Add a new file gitlab.conf to /etc/nginx/conf.d/ with the following content:
    upstream gitlab {
        # for manual installation
        server unix:/home/git/gitlab/tmp/sockets/gitlab.socket;
        # for omnibus installation
        server unix:/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket;
    }
    
  4. in Plesk select Websites & Domains > your subdomain > Webserver Settings - remove all ticks under "nginx settings" and add the following code to "Additional nginx directives"

    location ~ / {
        # serve static files from defined root folder;.
        # @gitlab is a named location for the upstream fallback, see below
        # for manual installation
        root /home/git/gitlab/public;
        # for omnibus installation
        root /opt/gitlab/embedded/service/gitlab-rails/public;
        try_files $uri $uri/index.html $uri.html @gitlab;
      }
    
      # if a file, which is not found in the root folder is requested,
      # then the proxy pass the request to the upsteam (gitlab unicorn)
      location @gitlab {
        proxy_read_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
        proxy_connect_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
        proxy_redirect     off;
    
    
    proxy_set_header   X-Forwarded-Proto $scheme;
    proxy_set_header   Host              $http_host;
    proxy_set_header   X-Real-IP         $remote_addr;
    
    proxy_pass http://gitlab;
    
    }
  5. Save this settings and reboot your server

Note: Maybe you have to change some permissions - see also https://github.com/gitlabhq/gitlabhq/issues/2071