In typical fashion, I think I have solved this after creating the discussion.
In config/initializers/assets.rb I had Rails.application.config.assets.precompile = ['*.js', '*.css'] but removing that seemed to do the trick, after finding a few discussions related to that exact bootstrap sass error it seems like you don't want the above line at all if you are precompiling assets which seems counter-intuitive to me (as the asset pipeline usually is to me). Aswell as this, I don't actually think the bundler capistrano gem alone is enough for precompilation of assets so I added require 'capistrano/rails/assets' to my Capfile and everything seems ok for now (already had the gem installed). Cheers, Martin On Friday, October 2, 2015 at 12:02:15 PM UTC+1, Martin Carlin wrote: > > *Summary:* > > Trying to have assets precompiled as part of the deploy to production. > > *Issue:* > > Visiting my app after the deploy, the css is off and there are no assets. > > If I run the following in [rails app root] /current > > rm -rf tmp/* > > rm -rf public/assets/* > > > Then that seems to fix it. > > > If I run (on the server) > > > bundle exec rake assets:precompile > > > then I get an error because one of the .js.erb files uses records from the > database and it's trying to connect to dev, so if I then run: > > > RAILS_ENV=production bundle exec rake assets:precompile > > > Then that works but errors out when it gets to the bootstrap/_alerts.scss > from the bootstrap gem which I don't even need and have uninstalled locally > (I am using bootstrap and jQuery but I don't use the actual gems, I prefer > handling them manually in the application.js/.css. Not sure why this gem > exists on production when I've removed it locally and committed. > > > The question is, what's the proper way to precompile assets for production > during a deploy? > > As far as I understand it, the capistrano-bundler gem (1.1.4 installed > locally) should take care of this automatically but maybe there's something > I'm missing or gotten confused about > > > I am just looking for the proper configuration. > > > In my environments/production.rb I have > > > config.serve_static_files = true > > config.assets.compress = true > > config.assets.initialize_on_precompile = true > > config.assets.compile = true > > config.assets.digest = true > > > > *Versions:* > > - Ruby - ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux] > - Capistrano - Capistrano Version: 3.4.0 (Rake Version: 10.3.2) > - Rails - Rails 4.2.1 > - Rake - rake, version 10.4.2 > > *Platform:* > > - Mac OS X Yosemite > - CentOS7 > > *Logs:* > > If I run cap production deploy, everything seems fine. > > > *Asides:* > > rbenv is installed on my laptop but I'm running rvm on the web server, I > started off by having the rvm capistrano gem installed but I realised this > was a bit confusing and left it out as I don't think I actually need it. > > The .bundle/config in my current directory is > > --- > > BUNDLE_FROZEN: '1' > > BUNDLE_PATH: "/var/www/rails.4playtheband.co.uk/shared/bundle" > > BUNDLE_WITHOUT: development:test > > BUNDLE_DISABLE_SHARED_GEMS: '1' > > > If other information is needed then I can provide it but even just an > example of someone else's config would be a great help. > > > Martin > -- You received this message because you are subscribed to the Google Groups "Capistrano" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web, visit https://groups.google.com/d/msgid/capistrano/f8153aca-b41c-415d-85c8-49f5b6e781e1%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
