docker-gitlab icon indicating copy to clipboard operation
docker-gitlab copied to clipboard

issues with missing icons (assets) via using GITLAB_RELATIVE_URL_ROOT

Open bne86 opened this issue 11 years ago • 31 comments

Hi, version 8.2 worked well but since version 8.2.1 icons in side-bar and header are not showing up sidebar. The JavaScript console shows that it is ignoring the relative url and looking for something in ROOT/assets/... I don't know whether this is a GitLab, Docker Image or Apache issue, but because it worked well until now i hope its a Docker Image issue. :)

Thanks for the Image, until now it worked very well and made the deployment very easy.

bne86 avatar Dec 01 '15 08:12 bne86

I do not see this issue. For the test I used the sample docker-compose.yml file with GITLAB_RELATIVE_URL_ROOT=/gitlab

sameersbn avatar Dec 01 '15 09:12 sameersbn

Are you using apache as a load balancer?

sameersbn avatar Dec 01 '15 09:12 sameersbn

we are using apache as reverse proxy, thats all we have configured:

ProxyRequests Off ProxyPass /gitlab http://localhost:10080/gitlab <Location /gitlab> ProxyPassReverse http://localhost:10080/gitlab </Location>

Strange, because beside of the gitlab image (it was updated) nothing changed. I will see whether i can find another reason for this behaviour. Thanks for your fast answer.

bne86 avatar Dec 01 '15 10:12 bne86

can you try connecting directly to http://localhost:10080/gitlab to verify in the urls are correct? p.s. i think ProxyPassReverse http://localhost:10080/gitlab should be ProxyPassReverse http://localhost:10080. not a 100% sure.

sameersbn avatar Dec 01 '15 13:12 sameersbn

bypassing the proxy works. i will see what else the reason for this issue is, strange that this did not happen before. thanks for the pointer, sorry for the noise.

bne86 avatar Dec 02 '15 06:12 bne86

In case you have not tried already, please clear the browser cache and retry.

sameersbn avatar Dec 02 '15 15:12 sameersbn

This was done with different browsers and of course a cache clear. ;) Beside of bypassing the proxy the current workaround is to add a separate proxy rule for the "/asset" path to "/gitlab/asset". But i think this is a local and no general issue. Once again, thanks for this great image and your fast help.

bne86 avatar Dec 02 '15 16:12 bne86

I have the same problem. In the generated CSS files the wrong asset path is referenced. E.g.: @font-face{font-family:'FontAwesome';src:url("/assets/fontawesome-webfont-....eot?v=4.4.0"); But GITLAB_RELATIVE_URL_ROOT is set to "/git".

@sameersbn You still can't reproduce this?

mlewe avatar Dec 07 '15 09:12 mlewe

fixed in latest tag

sameersbn avatar Dec 09 '15 17:12 sameersbn

Thanks for fixing it for version 8.2.3, it's working there nicely with relative url & reverse proxy. But in latest version 8.3.0 I'm facing the same problem again. Is this a known bug of this version?

pylight avatar Dec 22 '15 11:12 pylight

@pylight can you please share your docker-compose.yml or docker run command. I testing using the sample docker-compose.yml with GITLAB_RELATIVE_URL_ROOT=/gitlab and everything seems to be working fine.

sameersbn avatar Dec 22 '15 13:12 sameersbn

Sure:

    postgres:
      image: localhost:5000/postgres
      environment:
        - POSTGRES_USER=gitlab
        - POSTGRES_PASSWORD=<somePW>
      ports:
        - "127.0.0.1:5432:5432"
    redis:
      image: localhost:5000/redis
      ports:
        - "127.0.0.1:6379:6379"
    service:
      image: sameersbn/gitlab:8.2.3
      links:
        - redis:redisio
        - postgres:postgresql
      ports:
        - "127.0.0.1:11080:80"
        - "11022:22"
      environment:
        - TZ=Europe/Berlin
        - SMTP_ENABLED=true
        - SMTP_DOMAIN=www.ourDomain.net
        - SMTP_HOST=www.ourDomain.net
        - SMTP_PORT=25
        - GITLAB_TIMEZONE=Berlin
        - GITLAB_HOST=ourDomain.net
        - GITLAB_HTTPS=true
        - GITLAB_PORT=443
        - GITLAB_SSH_PORT=11022
        - GITLAB_SSH_HOST=subdomain.ourDomain.net
        - GITLAB_RELATIVE_URL_ROOT=/gitlab
        - [email protected]
        - [email protected]
        - GITLAB_EMAIL_DISPLAY_NAME=Shared Gitlab
        - GITLAB_BACKUPS=daily
        - GITLAB_BACKUP_TIME=01:00
        - GITLAB_GRAVATAR_ENABLED=false
        - GITLAB_SECRETS_DB_KEY_BASE=<someKey>
        - DB_TYPE=postgres
        - DB_NAME=gitlab
        - DB_USER=gitlab
        - DB_PASS=<somePW>
        - http_proxy=<corporateProxy>
        - https_proxy=<corporateProxy>
        - no_proxy="<list of some internal servers>"
      volumes:
        - /var/run/docker.sock:/run/docker.sock
        - /usr/bin/docker:/bin/docker
        - /data/gitlab/:/home/git/data/
        - /data/gitlab/gitlab/:/var/log/gitlab

Note: I've upgraded from gitlab 7.10.4 (and just replaces the "image" setting of "service" + added a GITLAB_SECRETS_DB_KEY_BASE)

Nginx configuration (reverse proxy with https):

server {
    listen 443;
    server_name  ourDomain.net;

    ssl_certificate           /etc/nginx/ssl/cert.crt;
    ssl_certificate_key       /etc/nginx/ssl/cert.key;

    client_max_body_size 1G;

    ssl on;
    ssl_session_cache  builtin:1000  shared:SSL:10m;
    ssl_protocols  TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
    ssl_prefer_server_ciphers on;

    access_log            /var/log/nginx/nginx.access.log;

    location /gitlab/ {
      proxy_set_header        Host $host;
      proxy_set_header        X-Real-IP $remote_addr;
      proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header        X-Forwarded-Proto $scheme;

      proxy_pass              http://localhost:11080;
      proxy_read_timeout      180;
      proxy_redirect          http:// https://;
   }

I also thing that the message "GITLAB_RELATIVE_URL_ROOT in use, recompiling assets, this could take a while..." did only appear in version 8.2.3 but not in 8.3.0, but I'm not sure about it...

pylight avatar Dec 23 '15 10:12 pylight

@pylight since you have created a new issue #553, you may want to copy the docker-compose.yml spec to that issue. I have commented on that issue. I will investigate depending on your response to my comment. Thank you.

sameersbn avatar Dec 23 '15 14:12 sameersbn

The other issue was solved by upgrading diffently but this problem still persists with 8.3.0 - in 8.2.3 everything is fine, but in 8.3.0 all icons are broken.

pylight avatar Dec 23 '15 14:12 pylight

@pylight can you connect directly to the gitlab container i.e. http://localhost:11080 and check if the issue persists?

sameersbn avatar Dec 23 '15 15:12 sameersbn

I think the issue could be related to the load balancer configuration. Please check the behaviour with http://localhost:11080. Also open the browser debug console to check the assets the browser is not able to fetch.

sameersbn avatar Dec 23 '15 15:12 sameersbn

You're right it's really working without nginx when directly accessing it. But why did it work in 8.2.3 with nginx then? When looking at the console, I see that gitlab is not using the relative url for assets, example:

https://myDomain.net/assets/icon-search-8ee9d986522a0935babd4119ea11df90.png Failed to load resource: the server responded with a status of 404 (Not Found)

Instead it should look at https://myDomain.net/gitlab/assets/ normally. A quick and dirty fix is adding a rewrite rule in the nginx configuration:

location /assets/ {
    rewrite ^(/assets)(.*)$   https://myDomain.net/gitlab/assets/$2 permanent;
 }

But of course I would be thankful for better solutions - do I have to change my nginx configuration?

pylight avatar Dec 23 '15 21:12 pylight

GitLab is slowly moving the serving of all http requests to the gitlab-workhorse component with very little left to be handled by nginx itself. While this handoff is not yet complete, but a major part of it took place in the 8.3.0 release. See "Decoupling GitLab from NGINX" section of GitLab 8.3.0 Release Announcement

Getting back to the issue. When you access Gitlab using relative url, the access to the static assets should go through gitlab-workhorsefor the the urls in the css, etc. to the correct urls. If the change in your nginx config at the load balancer fixes the issue then you should be good.

sameersbn avatar Dec 24 '15 05:12 sameersbn

Still strange because the URLs are not correct for assets. Of course my aim is to have as less exceptional handling outside of the container as possible. I hope this will get better in future releases. Right now I'll stay with 8.2.3 :) Am 24.12.2015 06:00 schrieb "Sameer Naik" [email protected]:

GitLab is slowly moving the serving of all http requests to the gitlab-workhorse component with very little left to be handled by nginx itself. While this handoff is not yet complete, but a major part of it took place in the 8.3.0 release. See "Decoupling GitLab from NGINX" section of GitLab 8.3.0 Release Announcement https://about.gitlab.com/2015/12/22/gitlab-8-3-released/

Getting back to the issue. When you access Gitlab using relative url, the access to the static assets should go through gitlab-workhorsefor the the urls in the css, etc. to the correct urls. If the change in your nginx config at the load balancer fixes the issue then you should be good.

— Reply to this email directly or view it on GitHub https://github.com/sameersbn/docker-gitlab/issues/521#issuecomment-167042721 .

pylight avatar Dec 24 '15 06:12 pylight

I believe the source of the problem could be the location /gitlab/ block. I cannot say for sure. I will try with my load balancer and let you know if I can come up will a clean config.

sameersbn avatar Dec 24 '15 07:12 sameersbn