Fixing CSS/Paver update_assets/Sass/Ruby version issues on ISC prod - Appsembler

Fixing CSS/Paver update_assets/Sass/Ruby version issues on ISC prod

We ran into an issue noticed Tue Aug 4 2015 with the proper CSS not displaying on ISC production Studio.

The basic CSS files the CMS, like
cms-style-app-extend1.43aaf67f47ef.css were missing from /edx/var/staticfiles/43aaf67f47ef/ and the like. The immediate reason was that the CSS hadn’t been generated from the scss files by Sass.
We needed to run
paver update_assets --settings=aws but this was failing to complete with an error message that sass could not be found when executing the shell command called by pavelib/assets.py. which sass was returning /usr/bin/sass, the wrong version. There was a bundler installed sass in /edx/app/edxapp/edx-platform/bin/sass which is the correct location. But running that bin/sass gave errors like: Could not find addressable-2.3.5 in any of the sources. This is the same error message we saw when trying to run bundle install as the edxapp user. The bin/sass executable was calling sass with /usr/bin/env ruby1.8, the wrong Ruby version. Turns out we had some things installed with ruby 1.8 and some things installed with the correct Ruby 1.9.3 in use in named-release/aspen.1.
The following steps fixed the situation: 


sudo su edxapp -s /bin/bash

cd ~ source edxapp_env
which ruby
... /edx/app/edxapp/.rbenv/shims/ruby
/usr/bin/env ruby -v
... ruby 1.9.3p374 (2013-01-15 revision 38858) [x86_64-linux]
gem install bundler
rm -rf /edx/app/edxapp/edx-platform/bin/*
bundle install
which sass
... /edx/app/edxapp/edx-platform/bin/sass
paver update_assets --settings=aws

If running
update_assets you get a message that Ruby 1.8 doesn’t support setting an encoding type (calling sass), your edx-platform/bin/sass is still using the wrong Ruby. Delete the contents of your edx-platform/bin directory and rerun bundle install. Make sure which bundle outputs /edx/app/edxapp/.gem/bin/bundle.