*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/8541b7c0-d712-49c6-b2c1-72788b5ae12a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Attachment: capfile
Description: Binary data

Attachment: deploy.rb
Description: Binary data

Attachment: production.rb
Description: Binary data

Attachment: production.rb
Description: Binary data

Reply via email to