Saturday, February 23, 2013

Asset pipeline flowing smoothly...

Finished my testing with the changes for an addition to my existing app and decided it was time to get this into production.  Only hitch was that my app was running on bamboo and you need to be on cedar if you want to implement the asset pipeline. The Heroku folks have a good introduction to how to do this here and here. Well laid out and gave me everything I needed to create a new, test app to deploy to.

First problem I ran into was Heroku complaining that it couldn't install sqlite3. Now this is a well-documented problem which requires that you make sure that your sqlite gem is only available in test and development but not in production as Heroku no longer supports that. It's a simple fix:

 gem sqlite3, :group => [:development, :test] 

I dutifully made the change and pushed to my test app but it continued to fail. After an embarrasingly long time, I remembered that I was working on branch 'cedar' (isolating these changes) but the push was going to 'master'. This was a quick fix:

git push test-app HEAD:master

pushes the current HEAD to master on Heroku... problem solved.

Then I ran into a further complication; Bundler worked fine but the Heroku assets:procompile was failing with

could not connect to server: Connection refused
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port xxxx?

This was a simple solution, found in the previous reference in the 'Troubleshooting' section; just add this to my application.rb file:
config.assets.initialize_on_precompile = false
Now I could run my migrations, install the sendgrid addon, and my test-app was up and running. Hopefully this can save someone a bit of time.

No comments:

Post a Comment