(English) GitLab on an Ubuntu 10.04 server with Apache

Αναρτήθηκε στις Ιούν 24, 2012 στις Όλα τα Άρθρα, Linux και Ανοιχτό Λογισμικό, Τεχνολογία

Αυτή η καταχώρηση είναι διαθέσιμη μόνο στα English.

Share

29 Σχόλια

  1. Thanks so much. This worked great for me on Ubuntu 12.04.

    One question though: When I create a local repo and then try to push to my remote Ubuntu git/Gitlab install, tortoiseGit keeps asking for a password for user “git”, but I notice in Gitlab’s instructions the git user password is “–disabled-password” . My SSH keys are setup fine and working. What have I missed?

  2. Hi Brian, thanks for the comment.

    git user indeed doesn’t have a password so you have to login using your ssh key. We usually encrypt ssh keys with a password (called a passphrase) and you have to unlock them before you are able to use them.
    So maybe tortoiseGit asks you for the passphrase you used when you created your ssh key.

    I can’t be of much help because I am on Linux and ssh is kind of a native function for us.

    Provided that you added your public ssh key to your gitlab account, I would suggest to google for a ssh – tortoiseGit guide, maybe in conjunction with github.

    I found this one which may help you:
    http://dbanck.de/2009/10/08/github-windows-and-tortoisegit-part-1-installing-pulling/

  3. Thanks again Marios for your advice.

    I sorted it out. Rookie mistake. I pasted the wrong format of my public key into gitlab ssh keys section. The answer was documented here https://github.com/gitlabhq/gitlabhq/issues/293#issuecomment-5125487

  4. Thanks! I just finished the set up and all work well! I just want to ask one thing though. I want all the traffic streamed through ssl but when I log in, firefox “complains” that the page is partially encrypted. Could it be that something is missing in gitlab vhost?

  5. I just tried with the nginx config example provided in the wiki and I hadn’t this problem.

  6. I didn’t show this in my guide but it is simple. You can add a rewrite rule to the non ssl virtual host to request the ssl versions of the URIs.

    So, in the guide the non SSL virtual host is:

    <VirtualHost *:80>
    ServerName gitlab.myserver.com
    ServerAlias www.gitlab.myserver.com
    DocumentRoot /home/gitlab/gitlab/public
    ErrorLog /var/log/apache2/gitlab.myserver.com_error_log
    CustomLog /var/log/apache2/gitlab.myserver.com_access_log combined

    <Proxy balancer://unicornservers>
    BalancerMember http://127.0.0.1:8080
    </Proxy>

    <Directory /home/gitlab/gitlab/public>
    AllowOverride All
    Options -MultiViews
    </Directory>

    RewriteEngine on
    RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
    RewriteRule ^/(.*)$ balancer://unicornservers%{REQUEST_URI} [P,QSA,L]

    ProxyPass / balancer://unicornservers/
    ProxyPassReverse / balancer://unicornservers/
    ProxyPreserveHost on

    <Proxy *>
    Order deny,allow
    Allow from all
    </Proxy>
    </VirtualHost>

    Replace proxy directives with a rewrite rule to change every URI request to https like this:

    <VirtualHost *:80>
    ServerName gitlab.myserver.com
    ServerAlias www.gitlab.myserver.com
    DocumentRoot /home/gitlab/gitlab/public
    ErrorLog /var/log/apache2/gitlab.myserver.com_error_log
    CustomLog /var/log/apache2/gitlab.myserver.com_access_log combined

    <Directory /home/gitlab/gitlab/public>
    AllowOverride All
    Options -MultiViews
    </Directory>

    RewriteEngine on
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

    </VirtualHost>

  7. It seems it doesn’t redirect all the traffic to ssl. I had already put a rewrite rule, I even tried your example but again I get the same output. Here’s what I mean

    with apache > http://i.imgur.com/B27ux.png
    with nginx > http://i.imgur.com/Mwv9R.png

  8. I would guess that the problem exists because of gravatar. If you check, this is the only unencrypted URI in your pages. Even if you haven’t a gravatar, your browser will download the default. I don’t think this as a serious problem, so I won’t try fixing it, but I reckon you could do a grep in your gitlab installation to find where gravatar is mentioned and change these lines to use https.

  9. You are right! This is gravatar’s fault! This was supposed to have been fixed with this commit https://github.com/ariejan/gitlabhq/commit/4dbed7ca88c2fe8f127deb752f82a5ee9ab4cade but that’s not the case (at least with apache). I replaced “http://www.gravatar.com” with “https://secure.gravatar.com” and problem solved :) Thanks for your time!

  10. The virtualhost config in 3.3 seems to have lost the various tags that look like HTML tags, probably stripped away automatically for that same reason.

    I think I managed to insert them correctly:

    ServerName gitlab.devserver.local
    ServerAlias gitlab.devserver.local
    DocumentRoot /home/gitlab/gitlab/public
    ErrorLog /var/log/apache2/gitlab.myserver.com_error_log
    CustomLog /var/log/apache2/gitlab.myserver.com_access_log combined

    BalancerMember http://127.0.0.1:8000

    AllowOverride All
    Options -MultiViews

    RewriteEngine on
    RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
    RewriteRule ^/(.*)$ balancer://unicornservers%{REQUEST_URI} [P,QSA,L]

    ProxyPass / balancer://unicornservers/
    ProxyPassReverse / balancer://unicornservers/
    ProxyPreserveHost on

    Order deny,allow
    Allow from all

    But anyway this guide probably saved me a lot of time, thanks!

  11. The virtualhost config in 3.3 seems to have lost the various tags that look like HTML tags, probably stripped away automatically for that same reason.

    I think I managed to insert them correctly:


    <VirtualHost *:8000--
    ServerName gitlab.devserver.local
    ServerAlias gitlab.devserver.local
    DocumentRoot /home/gitlab/gitlab/public
    ErrorLog /var/log/apache2/gitlab.myserver.com_error_log
    CustomLog /var/log/apache2/gitlab.myserver.com_access_log combined
    <Proxy balancer://unicornservers--
    BalancerMember http://127.0.0.1:8000
    </Proxy--
    <Directory /home/gitlab/gitlab/public--
    AllowOverride All
    Options -MultiViews
    </Directory--
    RewriteEngine on
    RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
    RewriteRule ^/(.*)$ balancer://unicornservers%{REQUEST_URI} [P,QSA,L]

    ProxyPass / balancer://unicornservers/
    ProxyPassReverse / balancer://unicornservers/
    ProxyPreserveHost on
    <Proxy *--
    Order deny,allow
    Allow from all
    </Proxy--
    </VirtualHost--

    But anyway this guide probably saved me a lot of time, thanks!

    *Repost: Yup, mine got stripped away just now, even when wrapping it all in a code block. Replacing the > in the tags with — this time.

  12. Ok, now I feel silly for not having read the comments thoroughly.. Feel free to delete all of my comments, including this one.

  13. No, you are correct indeed! Because there are some special characters for html (like greater > and less < than symbols) in the code section, wordpress destroyed them when I updated the article. Thank you. I’ll fix them. :)

  14. For some reason your page isn’t displaying any content in my browser, the article is just empty. I’m running the latest version of Google Chrome, just thought I’d let you know. I’m going to try it with another browser.

  15. Interestingly, when I added that comment the article appeared in full. I’m not sure what would be causing this.

  16. I’m getting a 404 not found error when trying to view Gitlab attachments. I found this gitlab issue https://github.com/gitlabhq/gitlabhq/issues/348#issuecomment-5645250 and added ProxyPass /uploads ! to VirtualHost then restarted apache, but it made no difference. Any ideas?

  17. I have the same problem. I hadn’t use this functionality until now and only because of your comment I checked it out.

    The link you gave though, works for me. I just added the ProxyPass /uploads ! directive before the other ProxyPass directives for both http and https.

    So, Apache’s virtualhost configuration part:
    ProxyPass / balancer://unicornservers/
    ProxyPassReverse / balancer://unicornservers/
    ProxyPreserveHost on

    Became:
    ProxyPass /uploads !
    ProxyPass / balancer://unicornservers/
    ProxyPassReverse / balancer://unicornservers/
    ProxyPreserveHost on

    I updated the article too with this. Thank you!

  18. Thanks Marios. I had the directives in the wrong order. When I put the negate first it worked. The relevant info I found under “Ordering ProxyPass Directives” in http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypass “exclusions must come before the general ProxyPass directives”.

  19. Thanks for the post. This helped me set up for hosting through Apache httpd. I thought I’d drop one more comment in here on the git user asking for password. By default on Ubuntu 12.04 server, only users in the SSH group can connect. After I added the git and gitlab users to this group and restarted sshd, the password prompt went away for me. Hopefully this helps someone else out there.

  20. The current setup seems to dump on my box. I can run GitLab just fine with Thin, but as soon as I do the setup with unicorn and Apache it doesn’t do much of anything.

    In the Apache error log I get:

    [Wed Aug 29 06:14:41 2012] [error] [client 50.113.62.116] (20014)Internal error: proxy: error reading status line from remote server 127.0.0.1:4242
    [Wed Aug 29 06:14:41 2012] [error] [client 50.113.62.116] proxy: Error reading from remote server returned by /

  21. Ian, a bit late maybe but I ran into the same errors.
    I solved it by changing this line in my virtualhost config file

    DocumentRoot /home/gitlab/gitlab/public

    changed to :

    DocumentRoot /home/gitlab/gitlab

  22. Hi, sorry I didn’t respond to the last messages, got a bit distracted with work.

    Anyway, you may noticed that Gitlab 3 is out. For you who want to upgrade, I would suggest to upgrade first gitolite. I think many of us installed gitolite v2, but now this is bumped too at v3.

    Check these links from GitLab’s official documentation:
    Update gitolite: https://github.com/gitlabhq/gitlabhq/wiki/Update-gitolite
    Update GitLab from 2.9 to 3.0: https://github.com/gitlabhq/gitlabhq/wiki/From-2.9-to-3.0
    Update GitLab from 2.6 to 3.0: https://github.com/gitlabhq/gitlabhq/wiki/From-2.6-to-3.0

    Also the last sed commands of the upgrade guide may have some problems, so check this gist too: https://gist.github.com/3946188

    Cheers! :D

  23. Thanks for your instructions, they worked perfectly!
    I created an issue at gitlabhq to update installation instructions to cover both nginx/apache.

  24. Glad I helped! My next milestone is to transfer my installation to a Gentoo system and maybe convert the database from MySQL to sqlite.

    PS. I think Gitlab 3.1 just got out.

  25. Hi, I just installed Gitlab (latest stable version) on my dedicated server (Debian 6 Squeeze). I have followed the gitlabhq installation guide and your guide but I always have this message from apache :

    Proxy Error

    The proxy server received an invalid response from an upstream server.
    The proxy server could not handle the request GET /users/sign_in.

    Reason: Error reading from remote server

    Any idea ?

    Thank you.

  26. Worked perfectly. Thanks.

  27. Thanks Andrew! Ismael sorry but I can’t think of something. :-/

    A small update that probably interests axil.
    We had a problem, where gravatars were served always from the non-ssl gravatar host, thus the browser SSL notification warned the user for mixed ssl and non-ssl content.

    We fixed it by hardcoding the SSL gravatar host to Gitlab but this isn’t the best solution as the problem lies elsewhere; Gitlab doesn’t know that it is being served through SSL.
    The proper solution is to configure Apache to set a https header, so that Gitlab will know that it is being served through SSL.

    On Apache’s SSL configuration section, we have this code:

    <Proxy balancer://unicornservers>
    BalancerMember http://127.0.0.1:8080
    </Proxy>

    So, we just add a https header:

    <Proxy balancer://unicornservers>
    BalancerMember http://127.0.0.1:8080
    Header add X-Forwarded-Proto "https"
    </Proxy>

  28. Am getting error “Error, unicorn not running!” after following the steps mentioned above.

  29. This guide is old. At the time of the writing, we had Gitlab 2.6.0. Now we are at 5.3 and many – many things have changed. Amongst the changes is that the Gitlab team now uses Puma instead of unicorn.

    Have a look at the official instructions for the currently latest stable version: https://github.com/gitlabhq/gitlabhq/blob/5-3-stable/doc/install/installation.md

Αφήστε μια απάντηση

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>