2013-08-28 58 views
2

我已經閱讀了幾篇關於SO的文章,討論在GemFile中使用:git,但這些解決方案似乎不適合我。Elastic Beanstalk - 使用Github Gems進行Rails部署

這裏是我的.ebextensions/ruby​​.config文件:

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 

這裏的一個地方,我在我的Gemfile使用Github上:

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

最後,錯誤我得到了生產.log與此寶石相關的不在此處:

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' 

但是,我可以清楚地看到寶石是裝在/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 

這裏是我的全部日誌文件的快照:https://gist.github.com/holtkampw/255d7bb00407fc615c76

什麼我可以做任何想法得到這個正常工作?也許我的.ebextenions文件不正確?

回答

1

This gist將使它的行爲與您在大多數rails環境中的預期一致。我開始在我們的部署中使用它,當我遇到來自git repo的gem時出現同樣的問題。

從我的理解(至少我記得),理由是git位置是不可信的來源,可能會危及或使您的部署不穩定/不可重現,因爲實例被添加/回收。雖然我同意,但我仍然希望可以在需要時使用它們。

+0

這是一個非常有用的起點。通過幾個container_commands,我能夠解決我的問題。 – holtkampw

2

我與活動管理員有同樣的問題。您可以將寶石放入供應商文件夾。爲我工作。

把這個在你的寶石文件:

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

您需要維護這些代碼到你的/.ebextensions/ruby.config文件:

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

不要忘記提取的git寶石內容分爲供應商/ themes_for_rails文件夾。

相關問題