Elastic Beanstalk – Rails Deploy using Github Gems

I’ve read a couple of other threads on SO discussing using :git in a GemFile but those solutions don’t seem to be working for me.

Here’s my .ebextensions/ruby.config file:

option_settings:
  - option_name: BUNDLE_DISABLE_SHARED_GEMS
    value: "1"
  - option_name: BUNDLE_PATH
    value: "vendor/bundle"

packages:
  yum:
    git: []

container_commands:
  01bundle:
    command: bundle --deployment

Here’s the one place I’m using Github in my GemFile:

gem 'themes_for_rails', :git => 'https://github.com/digitalmoksha/themes_for_rails.git'

And finally, the error I get in production.log that is related to this gem not being here:

I, [2013-08-28T13:29:26.979524 #26738]  INFO -- : Start adding themes to assets [true]
I, [2013-08-28T13:30:36.528844 #26808]  INFO -- : Start adding themes to assets [true]
I, [2013-08-28T13:32:47.069202 #26901]  INFO -- : Start adding themes to assets [true]
I, [2013-08-28T13:32:48.254604 #26913]  INFO -- : Started GET "/" for 123.456.789.10 at 2013-08-28 13:32:48 +0000
I, [2013-08-28T13:32:48.299025 #26913]  INFO -- : Processing by StaticController#index as HTML
I, [2013-08-28T13:32:48.323622 #26913]  INFO -- :   Rendered static/index.html.erb within layouts/application (0.7ms)
I, [2013-08-28T13:32:48.331925 #26913]  INFO -- : Completed 500 Internal Server Error in 32ms
F, [2013-08-28T13:32:48.334631 #26913] FATAL -- : 
ActionView::Template::Error (undefined method `base_theme_stylesheet_path' for #<StaticController:0x00000003e16a10>):
    3: <head>
    4:   <title>Boundless</title>
    5:   <%= stylesheet_link_tag     "application", media: "all", "data-turbolinks-track" => true %>
    6:   <%= stylesheet_link_tag     current_theme_stylesheet_path('application'), media: "all", "data-turbolinks-track" => true %>
    7:   <%= javascript_include_tag  "application", "data-turbolinks-track" => true %>
    8:   <%= javascript_include_tag  current_theme_javascript_path('application'), "data-turbolinks-track" => true %>
    9:   <%= csrf_meta_tags %>
  app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb__2276887207485791953_34113280'

However, I can clearly see that the gems are packed in /var/log/eb-tools.log

Using themes_for_rails (0.5.2) from https://github.com/digitalmoksha/themes_for_rails.git (at master) 
Using turbolinks (1.3.0) 
Using uglifier (2.2.0) 
Your bundle is complete! It was installed into ./vendor/bundle

Here’s my full log file snapshot: https://gist.github.com/holtkampw/255d7bb00407fc615c76

Any ideas on what I can do to get this working correctly? Perhaps my .ebextenions file is incorrect?

  • What if any source code of a rails project should be obscured even for an open source project?
  • `git push heroku master` fails because it is using the wrong email address
  • Heroku push failed when i run git push heroku master command
  • Backing up my locally hosted rails apps in preparation for OS upgrade
  • How to deal with file names which contain spaces in Ruby(In Git Bash)
  • Heroku: how to “git pull” after 'git push -f'
  • How to install the add ons called pgbackups using git command on git version 1.9.5?
  • Nginx and Heroku. Serving Static Files
  • 2 Solutions collect form web for “Elastic Beanstalk – Rails Deploy using Github Gems”

    This gist will make it behave as you would expect from most rails environments. I started using this in our deployments when I ran into the same problem with a gem sourced from a git repo.

    From my understanding (at least as I recall), the rationale is that a git location is an untrusted source and could compromise or make your deployment unstable/not reproducible as instances are added/recycled. While I agree, I still want the option to use them when I want.

    I had the same problem with active admin. You can put the gem into your vendor folder. Worked for me.

    Put this in your gem file:

    gem 'themes_for_rails', path: 'vendor/themes_for_rails', require: 'themes_for_rails'
    

    You need to maintain this code into your /.ebextensions/ruby.config file:

    option_settings:
      - option_name: BUNDLE_DISABLE_SHARED_GEMS
      value: "1"
      - option_name: BUNDLE_PATH
      value: "vendor/bundle"
    

    Don’t forget to extract the git content of the gem into vendor/themes_for_rails folder.

    Git Baby is a git and github fan, let's start git clone.