Question

Gitlabs droplet for other uses

Posted November 5, 2014 3.6k views

I have a gitlab DO droplet which is working well but is underused.

I would like to use it for some other nodejs purposes but is there anything I need to think about to not kill gitlabs before I start to deploy node and nginx?

1 comment

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

2 answers

I’d recommend spinning up another temporary GitLab instance to do some testing first. It will allow you to break things without worrying about your production instance. Since you’re only charged for what you use, it will only cost pennies to do a few hours of testing.

In general, one thing to be aware of is that the GitLab one-click app uses their “omnibus” installation. It’s really designed to run in a self contained manner and installs it own libraries including Nginx under /opt that are managed using Chef. So you’ll need to override some things in /etc/gitlab/gitlab.rb To use the system Nginx that you plan on installing, add:

nginx['enable'] = false
web_server['external_users'] = ['www-data']

Then reconfigure GitLab with: sudo gitlab-ctl reconfigure

Then install Nginx as normal and set up a proxy pass to serve GitLab through it. Your Nginx configuration will need something like:

upstream gitlab {
    server unix:/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket;
}

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /usr/share/nginx/html;
    index index.html index.htm;
    server_name localhost;

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_pass http://gitlab;
    }
}
  • With this configuration, gitlab shows up when accessing http://mydomain.com/. If I want it to use a subdirectory, mydomain.com/gitlab - and I changed the location to

        location /gitlab/ {
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_redirect off;
            proxy_pass http://gitlab;
        }
    

    I get a 404 when accessing mydomain.com/gitlab. What am I doing wrong?

Submit an Answer