Code Monkey home page Code Monkey logo

Comments (29)

axilleas avatar axilleas commented on August 29, 2024

@sag47 any comments on this?

from gitlab-recipes.

samrocketman avatar samrocketman commented on August 29, 2024

@sajattack There's not enough information. Please provide:

  • The OS distribution and version
  • Version of Apache httpd
  • The output of the following commands...
sudo -i -u git
cd gitlab
#post output of following command
bundle exec rake gitlab:env:info RAILS_ENV=production
#post output of following command
bundle exec rake gitlab:check RAILS_ENV=production

Also please provide your exact steps to reproduce the problem (i.e. what elements you clicked before hand and which upload form to use in the web interface of GitLab). Without that information it will be difficult to accurately debug and give you meaningful feedback relative to your setup.

from gitlab-recipes.

sajattack avatar sajattack commented on August 29, 2024

Ubuntu 13.10
Apache 2.4.6

System information
System: Ubuntu 13.10
Current User: root
Using RVM: no
Ruby Version: 2.0.0p299
Gem Version: 2.0.7
Bundler Version:1.3.5
Rake Version: 10.1.0

GitLab information
Version: 6.2.3
Revision: b490fde
Directory: /home/git/gitlab
DB Adapter: mysql2
URL: http://gitlab.lumagaizen.com
HTTP Clone URL: http://gitlab.lumagaizen.com/some-project.git
SSH Clone URL: [email protected]:some-project.git
Using LDAP: no
Using Omniauth: no

GitLab Shell
Version: 1.7.6
Repositories: /home/git/repositories/
Hooks: /home/git/gitlab-shell/hooks/
Git: /usr/bin/git

Checking Environment ...

Git configured for git user? ... yes
Has python2? ... yes
python2 is supported version? ... yes

Checking Environment ... Finished

Checking GitLab Shell ...

GitLab Shell version >= 1.7.4 ? ... OK (1.7.6)
Repo base directory exists? ... yes
Repo base directory is a symlink? ... no
Repo base owned by git:git? ... yes
Repo base access is drwxrws---? ... yes
update hook up-to-date? ... yes
update hooks in repos are links: ...
Paul Sajna / lumagrades-android ... ok
Paul Sajna / lumapp ... ok
Taylor Love / LumaGrades API ... repository is empty
Running /home/git/gitlab-shell/bin/check
Check GitLab API access: FAILED. code: 404

Check directories and files:
/home/git/repositories: OK
/home/git/.ssh/authorized_keys: OK
gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Sidekiq ...

Running? ... yes
Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Checking GitLab ...

Database config exists? ... yes
Database is SQLite ... no
All migrations up? ... yes
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Init script exists? ... yes
Init script up-to-date? ... no
Try fixing it:
Redownload the init script
For more information see:
doc/install/installation.md in section "Install Init Script"
Please fix the error above and rerun the checks.
projects have namespace: ...
Paul Sajna / lumagrades-android ... yes
Paul Sajna / lumapp ... yes
Taylor Love / LumaGrades API ... yes
Projects have satellites? ...
Paul Sajna / lumagrades-android ... yes
Paul Sajna / lumapp ... yes
Taylor Love / LumaGrades API ... yes
Redis version >= 2.0.0? ... yes
Your git bin path is "/usr/bin/git"
Git version >= 1.7.10 ? ... yes (1.8.3)

Checking GitLab ... Finished

It says there's a problem with the init script, but there's not, I just had to modify it because my git user uses git-shell so I had to use sudo -u "$app_user" -H instead of sudo -u "$app_user" -H -i Trust me, this is completely unrelated to the problem.

Steps to reproduce:

  1. set up gitlab on apache by using the configuration file given in the recipe
  2. upload an avatar to your user
  3. you will see a broken image symbol, right click it, copy the url, and paste it into your address bar
  4. This will take you to the error 502 page.

Basically what happens, is the proxy tries to redirect the image url and breaks it.

from gitlab-recipes.

samrocketman avatar samrocketman commented on August 29, 2024

@sajattack Also possibly unrelated is the following...

Running /home/git/gitlab-shell/bin/check
Check GitLab API access: FAILED. code: 404

It could either mean that you don't have config.yml configured in the gitlab-shell directory or it just meant you ran the rake task when gitlab was shut down. Thanks for providing the information. I'll try reproducing it now in my setup as our configurations are similar minus Ubuntu and the Apache version (but similar in gitlab software versions).

I'll post my results when I have them.

from gitlab-recipes.

samrocketman avatar samrocketman commented on August 29, 2024

Could not reproduce

I could not reproduce the problem. It works fine on my system. I'm using this gitlab-ssl.conf configuration with RHEL 6.4, Apache httpd 2.2.15, GitLab 6.2.3, and gitlab-shell 1.7.5.

  • I am able to successfully upload an avatar to my profile.
  • When I view the image directly the URL is https://myserver.drexel.edu/uploads/user/avatar/30/Zaraki_KFC.jpg
  • When I log in via SSH I can manually see the file at /home/git/gitlab/public/uploads/user/avatar/30/Zaraki_KFC.jpg. It exists with proper permissions.

Other Notes:

  • I have SELinux enforcing with a firewall. I needed to set up SELinux contexts for my Apache to read the public directory. This was done when I first set up GitLab.
  • I originally uploaded Zaraki KFC.jpg (with a space) but GitLab automatically replaced it with an underscore as Zaraki_KFC.jpg
  • I did not have to make any system changes in order to get file uploading to work. It worked outright for me.

What can you troubleshoot next?

Possible out of date config

Which Apache config are you using specifically? (link the exact version) It could be you set it up a while ago and it's out of date compared to the latest master.

Possible Apache permissions problem

A few questions:

  • Do you have a /home/git/gitlab/public/upload folder?
  • Does your Apache user (in Ubuntu I think the user is www-data) have read access to /home/git/gitlab/public?
  • Does your Apache user have read/write access to /home/git/gitlab/public/uploads?

Have you checked your Apache logs? What do they say? If it says permission denied then it is likely your Apache user doesn't have read permissions.

If it is a permissions problem then you can resolve it with the following commands (Note I assume your Apache user is www-data).

sudo -i -u git
mkdir -p /home/git/gitlab/public/upload
chmod 750 /home/git
chmod 750 /home/git/gitlab
chmod 755 /home/git/gitlab/public
chmod 775 /home/git/gitlab/public/upload

Now add the www-data user to the git user group.

usermod -a -G git www-data

Check to make sure www-data is in the git group.

groups www-data

My conclusion

I don't think there is an error with the Apache configuration. I think there's an error in your system configuration.

Visit the following URL... https://gitlab.yourserver.com/deploy.html. If you don't see a special gitlab deployment message (and instead see a 502 or 404) then your system is configured incorrectly.

from gitlab-recipes.

sajattack avatar sajattack commented on August 29, 2024

OK. My server is down for the moment due to an unrelated problem, but I'll try some of the fixes you suggested later. I know the files are being uploaded properly; I found them when I ssh'd, but for some reason the proxy rule seemed to break it.

from gitlab-recipes.

samrocketman avatar samrocketman commented on August 29, 2024

If you truly believe it's the proxy rule then you should keep this open and provide feedback on your progress. That would be ideal. A good test would be to remove the proxy entirely and just try serving static HTML files from the gitlab/public directory. You can still use this ticket to try to resolve your problem even if it's not the configuration.

ProTip - Initialize a git repository in your Apache config so that you can branch and test changes. Discard if bad and merge if you found the solution.

from gitlab-recipes.

axilleas avatar axilleas commented on August 29, 2024

He probably closed it by accident so I reopened it. @sag47 thanks for the help.

from gitlab-recipes.

sajattack avatar sajattack commented on August 29, 2024

This is what I get when I try to go to /deploy.html

Proxy Error

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

Reason: DNS lookup failure for: 127.0.0.1:8080deploy.html

Without the proxy, I can't access files. I tried all the permission commands you entered.

from gitlab-recipes.

samrocketman avatar samrocketman commented on August 29, 2024

Can you link the specific Apache config you're using @sajattack?

from gitlab-recipes.

sajattack avatar sajattack commented on August 29, 2024

Well, it serves other sites too. Here's the gitlab part:

#########################################################
#                       Gitlab                          #
#########################################################
#This configuration has been tested on GitLab 6.0.0 and GitLab 6.0.1
#Note this config assumes unicorn is listening on default port 8080.
#Module dependencies
#  mod_rewrite
#  mod_proxy
#  mod_proxy_http
<VirtualHost 198.15.77.235:80>
  ServerName gitlab.lumagaizen.com
  ServerSignature Off

  ProxyPreserveHost On

  <Location />
    Order deny,allow
    Allow from all

    ProxyPass http://127.0.0.1:8080
    ProxyPassReverse http://gitlab.lumagaizen.com:8080
  </Location>

  #apache equivalent of nginx try files
  # http://serverfault.com/questions/290784/what-is-apaches-equivalent-of-nginxs-try-files
  # http://stackoverflow.com/questions/10954516/apache2-proxypass-for-rails-app-gitlab
  RewriteEngine on
  RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
  RewriteRule .* http://127.0.0.1:8080%{REQUEST_URI} [P,QSA]

  # needed for downloading attachments
  DocumentRoot /home/git/gitlab/public

  #Set up apache error documents, if back end goes down (i.e. 503 error) then a maintenance/deploy page is thrown up.
  ErrorDocument 404 /404.html
  ErrorDocument 422 /422.html
  ErrorDocument 500 /500.html
  ErrorDocument 503 /deploy.html

  LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b" common_forwarded
  ErrorLog  /var/log/apache2/gitlab.lumagaizen.com_error.log
  CustomLog /var/log/apache2/gitlab.lumagaizen.com_forwarded.log common_forwarded
  CustomLog /var/log/apache2/gitlab.lumagaizen.com_access.log combined env=!dontlog
  CustomLog /var/log/apache2/gitlab.lumagaizen.com.log combined

</VirtualHost>

from gitlab-recipes.

sajattack avatar sajattack commented on August 29, 2024

I realized I was disabling everything when I was trying to disable just the proxy. Now when I do it properly, and with the permissions you gave, I get 403s.

from gitlab-recipes.

samrocketman avatar samrocketman commented on August 29, 2024

I just meant you could link it in the gitlab-recipes folder. In any case this line is what does the proxying. To disable proxying entirely just comment out these three lines.

403 is permission denied. So it's still a permissions issue for you.

Does the following command show your www-data user in the git group?

groups www-data

It should show something along the lines of... www-data : www-data git.

from gitlab-recipes.

sajattack avatar sajattack commented on August 29, 2024

Yep.

from gitlab-recipes.

samrocketman avatar samrocketman commented on August 29, 2024

You'll have to walk through the directory path checking the permissions through /home/git/gitlab/public/upload. Do you have apparmor enabled for Apache? If so then you'll have to write your own policy for GitLab. Check your apache error logs. It will likely give you feedback so you can follow up on it (though sometimes not useful).

What are the permissions of the files? ls -l /home/git/gitlab/public

from gitlab-recipes.

sajattack avatar sajattack commented on August 29, 2024
root@node0:~# ls -l /home/git/gitlab/public
total 52
-rwxr-xr-x 1 git git   357 Nov 10 18:43 404.html
-rwxr-xr-x 1 git git   399 Nov 10 18:43 422.html
-rwxr-xr-x 1 git git   356 Nov 10 18:43 500.html
-rwxr-xr-x 1 git git   374 Nov 10 18:43 deploy.html
-rwxr-xr-x 1 git git  1150 Nov 10 18:43 favicon.ico
-rwxr-xr-x 1 git git 17388 Nov 10 18:43 gitlab_logo.png
-rwxr-xr-x 1 git git   204 Nov 10 18:43 robots.txt
-rwxr-xr-x 1 git git   518 Nov 10 18:43 static.css
drwxrwxr-x 4 git git  4096 Nov 11 22:34 uploads

from gitlab-recipes.

samrocketman avatar samrocketman commented on August 29, 2024

Well, there's not much more I can direct you on other than search through your permissions and try to find the anomaly. Perhaps post your Apache logs and I can direct you further (redacting personal information). It's best to use a service like pastebin for doing that rather than posting your raw (and likely very large) logs in this issue tracker.

What is clear is that there is a permissions problem somewhere in your system. You need to review the logs and be sure the Apache user has permissions to view those files and assets.

from gitlab-recipes.

samrocketman avatar samrocketman commented on August 29, 2024

@sajattack Did you resolve your issue? What was the problem?

from gitlab-recipes.

sajattack avatar sajattack commented on August 29, 2024

I don't know what was up with the permissions, we moved to a new server and stopped getting 403s. I think the main problem was having

    ProxyPass http://127.0.0.1:8080
    ProxyPassReverse http://gitlab.lumagaizen.com:8080

Instead of

    ProxyPassReverse http://127.0.0.1:8080
    ProxyPassReverse http://gitlab.lumagaizen.com:8080

from gitlab-recipes.

samrocketman avatar samrocketman commented on August 29, 2024

Ah I must have missed that ProxyPass. That definitely would have done it.

from gitlab-recipes.

jonas-b-r avatar jonas-b-r commented on August 29, 2024

Had a similar Problem. (403, then 500)
In my case I only enabled Apache mod_proxy, also enabling mod_proxy_http solved it for me
(ubuntu: a2enmod proxy proxy_http)

from gitlab-recipes.

marvinosswald avatar marvinosswald commented on August 29, 2024

I know it's a very old issue but I've got the same issue, after using sajattack's solution it works fine but I can't access gitlab from git.baseurl.com instead I have to use git.baseurl.com:8080

<VirtualHost 85.214.240.73:80>
      ServerName git.baseurl.com
      # !!! Be sure to point DocumentRoot to 'public'!
      DocumentRoot /home/git/gitlab
      <Directory /home/git/gitlab>
         # This relaxes Apache security settings.
         AllowOverride all
         # MultiViews must be turned off.
         Options -MultiViews
      </Directory>
        ProxyRequests Off
        ProxyPreserveHost On
        ProxyPassReverse / http:127.0.0.1:8080/
        ProxyPassReverse / http://git.baseurl.com:8080/
        <Location />
                ProxyPassReverse /
                Order deny,allow
                Allow from all
        </Location>
   </VirtualHost>

from gitlab-recipes.

samrocketman avatar samrocketman commented on August 29, 2024

Please use the official Apache config for gitlab...

https://github.com/gitlabhq/gitlab-recipes/blob/master/web-server/apache/gitlab.conf

There's an SSL variant there too. There are several things incorrect with your config but it would be easier for me to simply point you to the official config and have you use that. To learn more about setting up Apache for GitLab there's a readme. You might want to look at the architecture overview doc to better understand gitlab.

from gitlab-recipes.

marvinosswald avatar marvinosswald commented on August 29, 2024

Thanks, man didn't even know something like this exists. But at the moment gitlab didn't even start, so I have to fix this first..

EDIT: I've tried your suggested config but now nothing works, apache don't start too..

from gitlab-recipes.

marvinosswald avatar marvinosswald commented on August 29, 2024

Ok, fixed it.. gitlab and apache are up and running again. But gitlab is only available from port 8080, under port 80 I get a page saying Deploy in progress. Guess I've missed something..

from gitlab-recipes.

axilleas avatar axilleas commented on August 29, 2024

I guess that's the deploy.html under public/? It's probably named index.html now, try removing/renaming it. I wonder how you got this...

from gitlab-recipes.

marvinosswald avatar marvinosswald commented on August 29, 2024

No, it's still deploy.html and even after I renamed deploy.html to d.html nothing changed.

I've tried to push a repo to gitlab, ignoring my problem with the port but it says The requested URL returned error: 503 i think this problem is also triggered by the port problem..

from gitlab-recipes.

samrocketman avatar samrocketman commented on August 29, 2024

Right, because if you read the apache config "Deploy in progress" page shows up with 503 internal server error. As I mentioned accessing gitlab over 8080 is incorrect and should be avoided. At this point I don't think it is an issue with the default config or with GitLab itself. You're better off seeking help in the mailing list or in the #gitlab channel on freenode.

from gitlab-recipes.

marvinosswald avatar marvinosswald commented on August 29, 2024

I've just reinstalled it and cleaned my postgressql, works fine now 👍

from gitlab-recipes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.