2017-01-18 154 views
0

我有一個AWS Opsworks安裝程序,我需要在實例啓動和應用程序部署上安裝composer,但安裝失敗。任何人都可以幫我解決這個問題。 我運行此廚師配方:Opsworks安裝作曲家錯誤

node[:deploy].each do |app_name, deploy| 
    script "install_composer" do 
    interpreter "bash" 
    user "ubuntu" 
    cwd "#{deploy[:deploy_to]}/current" 
    code <<-EOH 
    curl -sS https://getcomposer.org/installer | php 
    php composer.phar install --no-dev 
    EOH 
    only_if { ::File.exists?("#{deploy[:deploy_to]}/current/composer.json") } 
    end 
end 

我收到以下錯誤(其中線21是一個與script "install_composer" do)。

[2017-01-18T11:16:38+00:00] ERROR: Running exception handlers 
[2017-01-18T11:16:38+00:00] ERROR: Exception handlers complete 
[2017-01-18T11:16:38+00:00] FATAL: Stacktrace dumped to /var/lib/aws/opsworks/cache.stage2/chef-stacktrace.out 
[2017-01-18T11:16:38+00:00] ERROR: script[install_composer] (composer::install line 21) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1' 
---- Begin output of "bash" "/tmp/chef-script20170118-1672-16lyp81" ---- 
STDOUT: All settings correct for using Composer 
The installation directory "/srv/www/[app_name]/releases/20170113140255" is not writable 
Could not open input file: composer.phar 
STDERR: 
---- End output of "bash" "/tmp/chef-script20170118-1672-16lyp81" ---- 
Ran "bash" "/tmp/chef-script20170118-1672-16lyp81" returned 1 
[2017-01-18T11:16:38+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1) 

我使用的這些實例的組合來構建腳本:

https://github.com/awslabs/opsworks-example-cookbooks/blob/master/phpapp/recipes/appsetup.rb https://github.com/onema/opsworks-chef-cookbooks/blob/master/composer/recipes/install.rb

的設置在Ubuntu實例運行。實例報告爲setup_failed。如果我禁用自定義食譜,實例就會正常啓動。

The installation directory "/srv/www/[app_name]/releases/20170113140255" is not writable中顯示的應用程序名稱是我的應用程序列表中的第4個應用程序,但是它實際上應該安裝composer(包含composer.json)的第一個應用程序。

希望你能幫助我。謝謝。

回答

0

當我意識到用戶在配方中應該是「root」而不是「ubuntu」時,我解決了這個問題。 ubuntu用戶根本沒有足夠的權利在release文件夾中創建新的文件夾。