繁体   English   中英

Opsworks安装Composer错误

[英]Opsworks install composer error

我有一个AWS Opsworks设置,需要在实例启动和应用程序部署时安装composer,但是安装失败。 谁能帮我解决这个问题。 我正在运行以下厨师食谱:

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显示在The installation directory "/srv/www/[app_name]/releases/20170113140255" is not writable中的应用程序是我应用程序列表中的第4个应用程序,但实际上应在其上安装composer的第一个应用程序(包含composer.json )。

希望你能帮助我。 谢谢。

当我意识到用户在配方中应该是“ root”用户而不是“ ubuntu”用户时,我就解决了。 ubuntu用户根本没有足够的权限在release文件夹中创建新文件夹。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM