I'm building a VPS, and it's deployed via Capistrano, database connected etc, but there are no assets available to the page - it is basic html only.
The assets appear to be compiled, and exist in the shared directory.
From the page html:
<link href="/assets/application-a1b5d69aeaff709fd3dce163c559b38b.css" media="all" rel="stylesheet" type="text/css" />
<script src="/assets/application-0ebd07089629f8c6880dddfb688d525d.js" type="text/javascript"></script>
The asset files appear to exist in the shared directory:
assay@assaypipeline:~/apps/assay/shared/assets$ ls application- a1b5d69aeaff709fd3dce163c559b38b.css
application-a1b5d69aeaff709fd3dce163c559b38b.css
When I view, source and then click on the hyperlink to the asset path, I get a 404 not found from Nginx.
SOLUTION
Thanks to Martin M (accepted answer) for help. The steps I took, from the ~/apps/(app name)/current directory on the server.
$ bundle install
$ RAILS_ENV=production bundle exec rake assets:precompile
$ sudo service nginx restart
Obviously it would be better to include this in the Capistrano recipe.
*EDIT - Capfile *
load 'deploy'
load 'deploy/assets'
load 'config/deploy'
Your precompiled assets should reside in
public/assets
, see rails guidesnormally you create them by running
as part of your deployment.
The shared stuff is to provide old stuff over several deploys.
See also this question
The problem might not be in asset compilation and deployment. Try changing nginx root /home/deploy/app_name/public; to /home/deploy/app_name/current/public; in nginx configuration file /etc/nginx/sites-enabled/default.
following is my configuration file
Hope this helps