2017-08-26 26 views
1

我想部署一個ruby應用程序來codedeploy,當它去安裝Sinatra時,它不斷給我一個錯誤,它需要更高版本的ruby然後安裝服務器 。我如何指定要使用的版本?如何在我的appspec文件中爲aws代碼指定ruby版本codedeploy

我有它在我的Gemfile規定,試圖

LifecycleEvent - BeforeInstall 
Script - scripts/install_dependencies 
[stdout]Successfully installed bundler-1.15.4 
[stdout]Parsing documentation for bundler-1.15.4 
[stdout]Done installing documentation for bundler after 5 seconds 
[stdout]1 gem installed 
[stdout]Updating installed gems 
[stdout]Nothing to update 
[stderr]ERROR: Error installing sinatra: 
[stderr] rack requires Ruby version >= 2.2.2. 

我在appspec.yml文件」

language: ruby 
rvm: 
    - 2.4.1 
    - jruby-head 
Before_install: # For jruby-head to work. 
    - gem install bundler 
    - gem update bundler 

任何形式的幫助將嘗試這種在appspecfile的幾種方法太棒了謝謝

這裏是我的版本的appspec.yml然後嘗試我發現以上

version: 0.0 
os: linux 
files: 
    - source: /. 
    destination: /var/www/html/ 
hooks: 
    BeforeInstall: 
    - location: scripts/install_dependencies 
     timeout: 300 
     runas: root 
    - location: app.rb 
     timeout: 300 
     runas: root 
    ApplicationStop: 
    - location: app.rb 
     timeout: 300 
     runas: root 
    ApplicationStart: 
    - location: app.rb 
     timeout: 300 
     runas: root 

的Gemfile

source 'https://rubygems.org' 
ruby "~> 2.3.0" 
gem 'sinatra', '2.0.0' 

回答

0

CodeDeploy appspec並不需要支持選項實際上,對於每一個生命週期事件將ENV紅寶石運行的腳本。如果你想運行一個特定版本的ruby,可能你可以在其中一個生命週期事件的某個腳本中將其更改爲默認ruby版本,例如BeforeInstall。

相關問題