2011-09-20 93 views
2

我試圖將我的symfony2應用程序部署到我的ec2實例。我配置了我的deploy.rb文件,並且可以使用cap deploy:setup來初始化服務器目錄。但是,當我運行cap部署時出現此錯誤:failed "sh -c 'cd /var/www/html/capifonytest/releases/20110920052019 && php app/console cache:warmup --env=prod'" on xxx.xx.xxx.xx。這是我的deploy.rb文件:使用Capifony將Symfony2應用程序部署到ec2

set :application, "capifonytest" 

default_run_options[:pty] = true 
set :scm, :git 

set :deploy_to, "/var/www/html/#{application}" 

set :repository, "[email protected]: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實例上工作的任何提示或技巧都將被極大地佔用。我正在運行亞馬遜linux ami 64bit,我相信它基於centos。


下面是一個輸出的更詳細的片斷:

servers: ["107.20.247.96"]
[107.20.247.96] executing command
** [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': No such file or directory
** [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'
* executing `symfony:cache:warmup'
* executing "cd /var/www/html/capifonytest/releases/20110921182846 && php app/
console cache:warmup --env=prod"
servers: ["107.20.247.96"]
[107.20.247.96] executing command
** [out :: 107.20.247.96] PHP Warning: require_once(/var/www/html/capifonytest
/releases/20110921182846/app/../vendor/symfony/src/Symfony/Component/Locale/Reso
urces/stubs/functions.php): failed to open stream: No such file or directory in
/var/www/html/capifonytest/releases/20110921182846/app/autoload.php on line 25
** [out :: 107.20.247.96] PHP Fatal error: require_once(): Failed opening requ
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') in /var/www/html/capifonytest/releases/201109211828
46/app/autoload.php on line 25
command finished in 302ms
* [deploy:update_code] rolling back
* executing "rm -rf /var/www/html/capifonytest/releases/20110921182846; true"
servers: ["107.20.247.96"]
[107.20.247.96] executing command
command finished in 280ms
failed: "sh -c 'cd /var/www/html/capifonytest/releases/20110921182846 && php app
/console cache:warmup --env=prod'" on 107.20.247.96

回答

1

有點晚,但是......

如果遞歸chownchgrp您的部署目錄(在你的情況/var/www/html/#{application})與部署用戶,capifony應該能夠清除緩存。換句話說:

sudo chown -R ec2-user /var/www/html/#{application} 
sudo chgrp -R ec2-user /var/www/html/#{application} 
0

cachelogs文件夾是不是最容易寫。有關更多信息,請在Symfony2 book中查看部分Setting up Permissions以瞭解如何在各種環境中進行設置。

相關問題