Skip to content

Loading…

Can't load static files. #116

Closed
luismanolo opened this Issue · 34 comments
@luismanolo

Hello:
I change the nginx default port to 8091 and can't load static files like:
/assets/application-7270767b2a9e9fff880aa5de378ca791.css
or
/assets/application-a75826a1b83d599001bf9096faef61c7.js

And the logout page send me a 404 error... "The page you were looking for doesn't exist."

The url of the server is: [http://emergest.sytes.net:8091]

Many thanks.

@b45ch1

I'm experiencing the same issues using Apache2 and hosting gitlab_ci in a subfolder.
Could also be a misconfiguration from my side.

My /etc/apache2/sites-enabled/gitlab::

<VirtualHost *:80>
  ServerName servername.tld
  DocumentRoot /var/www
  AddHandler cgi-script .cgi

  RailsBaseURI /gitlab
  RailsBaseURI /gitlab_ci
  CustomLog /home/gitlab/apache2.log combined
  RailsEnv production
  <Directory /var/www/gitlab>
     Options -MultiViews
  </Directory>
  <Directory /var/www/gitlab_ci>
     Options -MultiViews
  </Directory>


  PassengerPreStart http://servername.tld
  PassengerMinInstances 1
  PassengerMaxPoolSize 4

</VirtualHost>
@david-forever

I have the same issue with gitlab-ci 2.0 install from here: https://github.com/gitlabhq/gitlab-ci/blob/master/doc/installation.md

The behavior I'm seeing is that the HTML loads in the browser, but CSS and JS static files are not being loaded because they have a UUID appended to their names in the URIs:

<link href="/assets/application-7270767b2a9e9fff880aa5de378ca791.css" media="all" rel="stylesheet" type="text/css" />
<script src="/assets/application-a75826a1b83d599001bf9096faef61c7.js" type="text/javascript"></script>
<meta content="authenticity_token" name="csrf-param" />
<meta content="abb6jkeWpuAaNvUUTKJLGek6vc6z2CbEb0S/5OWLDVA=" name="csrf-token" />
<link href="/assets/favicon-45093d78d3587f6a876ff6849fb457e5.ico" rel="shortcut icon" type="image/vnd.microsoft.icon" />

I am running gitlab-2.0 on Ubuntu 12.04 LTS with the latest updates and nginx in front of rails.

@engrost

Just installed gitlab-2.0 stable on Ubuntu 12.04 with ngix as server.
Have similar/same issue as david-forever assets look same in head.
What I noticed they do not give HTTP 404. They are just empty files.

@david-forever

Has anybody run gitlab-2.0 on ruby 2.0? I noted that ruby 2.0 was released Sunday the 24th of February and the ruby 2.0 installer did have some problems with bundler which I fixed. Just wondered if the two are causally correlated?

@engrost

I'm using one from install notes:

ruby 2.0.0p0 (2013-02-24 revision 39474) [i686-linux]

@engrost

Found out that in:
config/environments/production.rb
there is setting:
# Generate digests for assets URLs
config.assets.digest = false
true by default, after setting it to false static files paths are now bit more sane.
but still having empty css file.
now url is: /assets/application.css

@mongris

I am running gitlab-2.0 on ruby 1.9.2 meet same issue.

ruby 1.9.2p320 (2012-04-20 revision 35421) [x86_64-linux]
@mongris

I cleanup gems and resintall 1.9.3, re-create tmp folder, then working now.

@engrost

Diched rvm installed ruby 1.9.3 from ubuntu repository, bundler system wide and rest of packages
and works like charm.

@kadkins

You should probably try cleaning and recompiling the assets:
su - gitlab_ci
cd /home/gitlab_ci/gitlab_ci
RAILS_ENV=production bundle exec rake assets:clean assets:precompile

@spawn-lv

I have done a clean install from the installation.md. The assets are empty, no styling, except when loading "Background Jobs", but the menu are is still without formatting. Any suggestions how to solve this?

@kadkins

Did you try the commands I mentioned above? When I first cloned the project the assets needed to be re-compiled. Run the commands above on the gitlab ci server and you may also need to do (as root):

/etc/init.d/gitlab_ci restart
/etc/init.d/nginx/restart

And you might need to clear your browsers cache as well

@kadkins

To summarize what worked for me (I would do these in this order):
1. Reboot the server and make sure that did not fix it by chance
2. login as root and:

su - gitlab_ci
cd /home/gitlab_ci/gitlab_ci
RAILS_ENV=production bundle exec rake assets:clean
RAILS_ENV=production bundle exec rake assets:precompile
exit

now that you are back as root

/etc/init.d/gitlab_ci restart
/etc/init.d/nginx/restart

Clear your browsers cache (or try with another browser).

@jgrowl

Cleaning and precompiling did not fix it for me. Switching to 1.9.3 fixed css but javascript is still broke:

rvm install 1.9.3
rvm use ruby-1.9.3-p392
RAILS_ENV=production bundle exec rake assets:clean
RAILS_ENV=production bundle exec rake assets:precompile
@kadkins

might want to try getting gitlab ci from the master branch and updating if you have not already. What rails version are you showing?:

su - gitlab_ci
cd /home/gitlab_ci/gitlab_ci
RAILS_ENV=production bundle exec rails -v

It should probably be 3.2.12. If not, you will likely want to update. I did (rails had some pretty major exploits in 3.2.10 and above, and some big fixes came out in 3.2.12. A lot of gem vendors has since upgraded their code as well. I would switch from the 2.0 stable branch and pull from master (or manually upgrade your gems). I would also let gitlab ci run with ruby 2.0. You can use other rubies in your projects, but I suspect sidekiq will want ruby 2. So don't change the rvm --default. Anyway, this should get you upgraded:

su - gitlab_ci
cd /home/gitlab_ci/gitlab_ci
git fetch --all
git checkout master
git pull
RAILS_ENV=production bundle update
RAILS_ENV=production bundle exec rake rails:update
RAILS_ENV=production bundle exec rake db:migrate
exit
/etc/init.d/gitlab_ci restart
/etc/init.d/nginx restart

I am not sure how well sidekiq will play with any MRI ruby version prior to 2.0 due to multi-threading issues.

I had to play around to get mine working. If you are still having issues, you might want to look around the various log files for errors:

cd /var/log/nginx/
cd /home/gitlab_ci/gitlab_ci/log/

IE:

tail -n 100 /var/log/nginx/gitlab_ci_error.log
tail -n 100 /home/gitlab_ci/gitlab-ci/log/unicorn.stderr.log
tail -n 100 /home/gitlab_ci/gitlab-ci/log/production.log

You may also have a permissions error.. to double check that (as root):

chown -R gitlab_ci:gitlab_ci /home/gitlab_ci/gitlab_ci

Hope some of this helps!

@spawn-lv

Followed kadkins suggestions and now it works, thank you.

@jgrowl

Checked out master and works correctly.

@dosire
GitLab member

Can this issue be closed?

@kadkins

I would advise updating the docs to point to master instead of the 2.0 branch

@dosire
GitLab member

@kadkins Can you maybe send a pull request to do this?

@kadkins
@dosire
GitLab member

@kadkins can you have a look at this?

@minhoryang

Same happened to me:
CI 2.0.0 74c831f
ruby 2.0.0p0 (2013-02-24 revision 39474) [i686-linux]

I tried to restart nginx/gitlab/gitlab_ci and assets:clean/recompile, but won't worked.

@kadkins

I have been slammed, but I really like this project and will contribute (update the install docs) when I get some time. Hopefully this week.

@minhoryang did you follow my instructions above? (16 days ago)

@minhoryang

I followed all your instructions.

I noticed several things:

  • Before upgrading, I found that I used to use Rails 3.2.8 .

gitlab_ci@git4:~/gitlab-ci$ RAILS_ENV=production bundle exec rails -v
Rails 3.2.8

  • After upgrading,

gitlab_ci@git4:~/gitlab-ci/log$ RAILS_ENV=production bundle exec rails -v
Rails 3.2.12

  • After upgrading, I can't connect to my server. Just 404. I found those logs at logs/production.log

Started GET "/" for 127.0.0.1 at 2013-03-21 00:53:11 +0900
 
ActionController::RoutingError (No route matches [GET] "/"):
actionpack (3.2.12) lib/action_dispatch/middleware/debug_exceptions.rb:21:in call'
actionpack (3.2.12) lib/action_dispatch/middleware/show_exceptions.rb:56:in
call'
railties (3.2.12) lib/rails/rack/logger.rb:32:in call_app'
railties (3.2.12) lib/rails/rack/logger.rb:16:in
block in call'
activesupport (3.2.12) lib/active_support/tagged_logging.rb:22:in tagged'
railties (3.2.12) lib/rails/rack/logger.rb:16:in
call'
actionpack (3.2.12) lib/action_dispatch/middleware/request_id.rb:22:in call'
rack (1.4.5) lib/rack/methodoverride.rb:21:in
call'
rack (1.4.5) lib/rack/runtime.rb:17:in call'
activesupport (3.2.12) lib/active_support/cache/strategy/local_cache.rb:72:in
call'
rack (1.4.5) lib/rack/lock.rb:15:in call'
rack-cache (1.2) lib/rack/cache/context.rb:136:in
forward'
rack-cache (1.2) lib/rack/cache/context.rb:245:in fetch'
rack-cache (1.2) lib/rack/cache/context.rb:185:in
lookup'
rack-cache (1.2) lib/rack/cache/context.rb:66:in call!'
rack-cache (1.2) lib/rack/cache/context.rb:51:in
call'
railties (3.2.12) lib/rails/engine.rb:479:in call'
railties (3.2.12) lib/rails/application.rb:223:in
call'
railties (3.2.12) lib/rails/railtie/configurable.rb:30:in method_missing'
rack (1.4.5) lib/rack/builder.rb:134:in
call'
rack (1.4.5) lib/rack/urlmap.rb:64:in block in call'
rack (1.4.5) lib/rack/urlmap.rb:49:in
each'
rack (1.4.5) lib/rack/urlmap.rb:49:in call'
unicorn (4.4.0) lib/unicorn/http_server.rb:535:in
process_client'
unicorn (4.4.0) lib/unicorn/http_server.rb:610:in worker_loop'
unicorn (4.4.0) lib/unicorn/http_server.rb:491:in
spawn_missing_workers'
unicorn (4.4.0) lib/unicorn/http_server.rb:141:in start'
unicorn (4.4.0) bin/unicorn_rails:209:in
'
/home/gitlab_ci/.rvm/gems/ruby-2.0.0-p0/bin/unicorn_rails:23:in load'
/home/gitlab_ci/.rvm/gems/ruby-2.0.0-p0/bin/unicorn_rails:23:in

'
/home/gitlab_ci/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in eval'
/home/gitlab_ci/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in
'

And I got a mail from localhost:

From gitlab_ci@git4.cnu.sogang.ac.kr Thu Mar 21 01:00:04 2013
Return-Path: gitlab_ci@git4.cnu.sogang.ac.kr
X-Original-To: gitlab_ci
Delivered-To: gitlab_ci@git4.cnu.sogang.ac.kr
Received: by git4.cnu.sogang.ac.kr (Postfix, from userid 1002)
id D8E9E221E75; Thu, 21 Mar 2013 01:00:03 +0900 (KST)
From: root@git4.cnu.sogang.ac.kr (Cron Daemon)
To: gitlab_ci@git4.cnu.sogang.ac.kr
Subject: Cron gitlab_ci@git4 /bin/bash -l -c 'cd /home/gitlab_ci/gitlab-ci && script/rails runner -e production > '\''Scheduler.new.perform'\'''
Content-Type: text/plain; charset=ANSI_X3.4-1968
X-Cron-Env:
X-Cron-Env:
X-Cron-Env:
X-Cron-Env:
Message-Id: 20130320160003.D8E9E221E75@git4.cnu.sogang.ac.kr
Date: Thu, 21 Mar 2013 01:00:03 +0900 (KST)

/home/gitlab_ci/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.12/lib/rails/commands/runner.rb:53:in eval': uninitialized > constant Scheduler (NameError)
from /home/gitlab_ci/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.12/lib/rails/commands/runner.rb:53:in
eval'
from /home/gitlab_ci/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.12/lib/rails/commands/runner.rb:53:in <top (required)>'
from /home/gitlab_ci/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.12/lib/rails/commands.rb:64:in
require'
from /home/gitlab_ci/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.12/lib/rails/commands.rb:64:in <top (required)>'
from script/rails:6:in
require'
from script/rails:6:in `

'

@rsaikali

Same as @minhoryang ... got a 404 after upgrading with the same messages...

@minhoryang

@rsaikali Thanks for confirming :+1:

@rsaikali

Switched to master branch... everything is OK...

@alexwhittemore

I followed the install instructions exactly, got the CSS/JS issues. Upgraded as per @kadkins above (so also switched to master) and now I'm getting the rails-served 404. This is pretty frustrating, for as smooth (if complicated) as the gitlab install went.

@alexwhittemore

Interestingly, on master I get the 404, but can precompile the assets. On 2-0-stable, I get content, but no CSS/JS. Copying the CSS by hand from the successful precompile to a running 2-0-stable gets me an ALMOST right-looking interface. Of course, some things are still broken.

@alexwhittemore

huh, weird. I just blew out the database and code directory, redownloaded the code (never checking out anything, so should be working on master:head), and redid the DB with rake, and now everything seems to work just fine.

@dosire dosire closed this
@NahimNasser

Followed down the same path as minhoryang. Getting a turquoise 404 page. What did you guys do to resolve this? Also tried wiping the database code directory -- redownloading, and remaking the db.

@minhoryang

@NahimNasser I resolved this by remaking a new VM for this... :( Sorry for loss.

@xaionaro

Same problem. When trying to sign-out with "/users/sign_out", getting "404 The page you were looking for doesn't exist.".

$ ruby --version
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
$ rails --version
Rails 3.2.16

=> Booting WEBrick
=> Rails 3.2.16 application starting in production on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2013-12-09 17:22:20] INFO WEBrick 1.3.1
[2013-12-09 17:22:20] INFO ruby 1.9.3 (2013-11-22) [x86_64-linux]
[2013-12-09 17:22:20] INFO WEBrick::HTTPServer#start: pid=1831 port=3000
Started GET "/users/sign_out" for 85.143.112.127 at 2013-12-09 17:22:28 +0400
Processing by ProjectsController#show as HTML
Parameters: {"id"=>"users/sign_out"}
Rendered public/404.html (15.0ms)
Filter chain halted as :project rendered or redirected
Completed 404 Not Found in 474.6ms (Views: 298.2ms | ActiveRecord: 3.8ms)
Started GET "/static.css" for 85.143.112.127 at 2013-12-09 17:22:29 +0400

ActionController::RoutingError (No route matches [GET] "/static.css"):
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.16/lib/action_dispatch/middleware/debug_exceptions.rb:21:in call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.16/lib/action_dispatch/middleware/show_exceptions.rb:56:in
call'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.16/lib/rails/rack/logger.rb:32:in call_app'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.16/lib/rails/rack/logger.rb:16:in
block in call'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.16/lib/active_support/tagged_logging.rb:22:in tagged'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.16/lib/rails/rack/logger.rb:16:in
call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.16/lib/action_dispatch/middleware/request_id.rb:22:in call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/methodoverride.rb:21:in
call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/runtime.rb:17:in call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/lock.rb:15:in
call'
vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in forward'
vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:in
fetch'
vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:in lookup'
vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in
call!'
vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in call'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.16/lib/rails/engine.rb:484:in
call'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.16/lib/rails/application.rb:231:in call'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.16/lib/rails/railtie/configurable.rb:30:in
method_missing'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:134:in call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/urlmap.rb:64:in
block in call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/urlmap.rb:49:in each'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/urlmap.rb:49:in
call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/content_length.rb:14:in call'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.16/lib/rails/rack/log_tailer.rb:17:in
call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/handler/webrick.rb:59:in service'
/usr/lib/ruby/1.9.1/webrick/httpserver.rb:138:in
service'
/usr/lib/ruby/1.9.1/webrick/httpserver.rb:94:in run'
/usr/lib/ruby/1.9.1/webrick/server.rb:191:in
block in start_thread'

Started GET "/favicon.ico" for 85.143.112.127 at 2013-12-09 17:22:29 +0400

ActionController::RoutingError (No route matches [GET] "/favicon.ico"):
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.16/lib/action_dispatch/middleware/debug_exceptions.rb:21:in call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.16/lib/action_dispatch/middleware/show_exceptions.rb:56:in
call'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.16/lib/rails/rack/logger.rb:32:in call_app'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.16/lib/rails/rack/logger.rb:16:in
block in call'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.16/lib/active_support/tagged_logging.rb:22:in tagged'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.16/lib/rails/rack/logger.rb:16:in
call'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.16/lib/action_dispatch/middleware/request_id.rb:22:in call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/methodoverride.rb:21:in
call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/runtime.rb:17:in call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/lock.rb:15:in
call'
vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in forward'
vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:in
fetch'
vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:in lookup'
vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in
call!'
vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in call'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.16/lib/rails/engine.rb:484:in
call'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.16/lib/rails/application.rb:231:in call'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.16/lib/rails/railtie/configurable.rb:30:in
method_missing'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:134:in call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/urlmap.rb:64:in
block in call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/urlmap.rb:49:in each'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/urlmap.rb:49:in
call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/content_length.rb:14:in call'
vendor/bundle/ruby/1.9.1/gems/railties-3.2.16/lib/rails/rack/log_tailer.rb:17:in
call'
vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/handler/webrick.rb:59:in service'
/usr/lib/ruby/1.9.1/webrick/httpserver.rb:138:in
service'
/usr/lib/ruby/1.9.1/webrick/httpserver.rb:94:in run'
/usr/lib/ruby/1.9.1/webrick/server.rb:191:in
block in start_thread'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.