我正在尝试将我的symfony2应用程序部署到我的ec2实例。我配置了deploy.rb文件,我可以使用cap deploy:setup初始化服务器目录。但是,当我运行cap deploy时,我收到此错误:failed "sh -c 'cd /var/www/html/capifonytest/releases/20110920052019 && php app/console cache:warmup --env=prod'" on xxx.xx.xxx.xx
。这是我的deploy.rb文件:
set :application, "capifonytest"
default_run_options[:pty] = true
set :scm, :git
set :deploy_to, "/var/www/html/#{application}"
set :repository, "git@github.com:myname/myrepo.git"
set :branch, "master"
set :ssh_options, { :forward_agent => true }
set :user, "ec2-user"
set :domain, "xxx.xx.xxx.xx"
ssh_options[:keys] = [File.join(ENV["AWS_HOME"], "tsmith.pem")]
role :web, domain # Your HTTP server, Apache/etc
role :app, domain # This may be the same as your `Web` server
role :db, domain, :primary => true # This is where Rails migrations will run
set :use_sudo, true
set :keep_releases, 3
有没有人知道将symfony2应用程序部署到ec2实例或使用capifony / capistrano这样做的好教程/资源?此外,任何使symfony2在ec2实例上工作的提示或技巧都会被大大占用。我正在运行amazon linux ami 64bit,我认为它基于centos。
以下是输出的更详细摘录:
服务器:[“107.20.247.96”]
[107.20.247.96]执行命令
** [out :: 107.20.247.96] find:/var/www/html/capifonytest/releases/2011092118<br /> 2846/web/css': No such file or directory<br /> ** [out :: 107.20.247.96] find:
/ var / www / html / capifonytest / releases / 2011092118
2846 / web / images':没有这样的文件或目录
** [out :: 107.20.247.96] find:/var/www/html/capifonytest/releases/2011092118<br /> 2846/web/js': No such file or directory<br /> command finished in 358ms<br /> triggering after callbacks for
deploy:finalize_update'
*执行`symfony:cache:warmup'
*执行“cd / var / www / html / capifonytest / releases / 20110921182846&amp;&amp; php app /
console cache:warmup --env = prod“
服务器:[“107.20.247.96”]
[107.20.247.96]执行命令
** [out :: 107.20.247.96] PHP警告:require_once(/ var / www / html / capifonytest
/releases/20110921182846/app/../vendor/symfony/src/Symfony/Component/Locale/Reso
urces / stubs / functions.php):无法打开流:没有这样的文件或目录 第25行上的/var/www/html/capifonytest/releases/20110921182846/app/autoload.php
** [out :: 107.20.247.96] PHP致命错误:require_once():打开请求失败
ired'/var/www/html/capifonytest/releases/20110921182846/app/../vendor/symfony/s
rc / Symfony / Component / Locale / Resources / stubs / functions.php'(include_path ='。:/ usr
/ share / pear:/ usr / share / php')/ var / www / html / capifonytest / releases / 201109211828
第25行/ 46 / app / autoload.php
命令在302ms完成
* [deploy:update_code]回滚
*执行“rm -rf / var / www / html / capifonytest / releases / 20110921182846; true”
服务器:[“107.20.247.96”]
[107.20.247.96]执行命令
命令在280ms完成
失败:“sh -c'cd / var / www / html / capifonytest / releases / 20110921182846&amp;&amp; php app
/ console cache:warmup --env = prod'“on 107.20.247.96
答案 0 :(得分:1)
有点晚了,但是......
如果您使用部署用户递归chown
和chgrp
部署目录(在您的情况下为/var/www/html/#{application}
),则capifony应该能够清除缓存。换句话说:
sudo chown -R ec2-user /var/www/html/#{application}
sudo chgrp -R ec2-user /var/www/html/#{application}
答案 1 :(得分:0)
您的cache
和logs
文件夹最不可能是可写的。查看Symfony2 book中的Setting up Permissions
部分,了解有关如何在各种环境中进行设置的详细信息。