我有以下简单的capifony脚本将本地项目复制到我的服务器:
set :application, "project"
set :domain, "88.88.88.88"
set :deploy_to, "/var/www/project"
set :app_path, "app"
set :user, "root"
set :scm, :git
set :repository, "file:///Users/berlin/vagrant-workspace/essen"
set :deploy_via, :capifony_copy_local
set :use_composer, true
set :use_composer_tmp, false
set :copy_vendors, true
role :web, domain
role :app, domain, :primary => true
set :use_sudo, false
set :keep_releases, 3
logger.level = Logger::MAX_LEVEL
这是我的上限输出:deploy:setup:
* 2014-10-06 21:55:38 executing `deploy:setup'
* executing "mkdir -p /var/www/project /var/www/project/releases /var/www/project/shared"
servers: ["88.88.88.88"]
[88.88.88.88] executing command
command finished in 119ms
* executing "chmod g+w /var/www/project /var/www/project/releases /var/www/project/shared"
servers: ["88.88.88.88"]
[88.88.88.88] executing command
command finished in 144ms
然后我因为丢失文件夹而无法部署。看起来脚本不会在发布版本中创建文件夹。
上限
* 2014-10-06 21:55:59 executing `deploy'
* 2014-10-06 21:55:59 executing `deploy:update'
** transaction: start
* 2014-10-06 21:55:59 executing `deploy:update_code'
triggering before callbacks for `deploy:update_code'
--> Updating code base with capifony_copy_local strategy
--> Using Copy Local Strategy
executing locally: "git ls-remote file:///Users/berlin/vagrant-workspace/project HEAD"
command finished in 12ms
* getting (via checkout) revision a7ba07ac38fee4b5375c6d383886a906c1a551d5 to /var/folders/l6/ptd6l19s2vb98z6bbnb1k7b00000gq/T/20141006195559
executing locally: git clone -q file:///Users/berlin/vagrant-workspace/project /var/folders/l6/ptd6l19s2vb98z6bbnb1k7b00000gq/T/20141006195559 && cd /var/folders/l6/ptd6l19s2vb98z6bbnb1k7b00000gq/T/20141006195559 && git checkout -q -b deploy a7ba07ac38fee4b5375c6d383886a906c1a551d5
command finished in 72ms
* 2014-10-06 21:55:59 executing `symfony:composer:install'
triggering before callbacks for `symfony:composer:install'
* 2014-10-06 21:55:59 executing `symfony:composer:copy_vendors'
--> Copying vendors from previous release
* executing "vendorDir=/var/www/project/current/vendor; if [ -d $vendorDir ] || [ -h $vendorDir ]; then cp -a $vendorDir /var/www/project/releases/20141006195559; fi;"
servers: ["88.88.88.88"]
[88.88.88.88] executing command
command finished in 103ms
* 2014-10-06 21:56:00 executing `symfony:composer:get'
* executing "if [ -e /var/www/project/releases/20141006195559/composer.phar ]; then echo 'true'; fi"
servers: ["88.88.88.88"]
[88.88.88.88] executing command
command finished in 90ms
--> Downloading Composer
* executing "sh -c 'cd /var/www/project/releases/20141006195559 && curl -s http://getcomposer.org/installer | php'"
servers: ["88.88.88.88"]
[88.88.88.88] executing command
*** [err :: 88.88.88.88] sh: line 0: cd: /var/www/project/releases/20141006195559: No such file or directory
command finished in 106ms
*** [deploy:update_code] rolling back
* executing "rm -rf /var/www/project/releases/20141006195559; true"
servers: ["88.88.88.88"]
[88.88.88.88] executing command
command finished in 102ms
failed: "sh -c 'sh -c '\\''cd /var/www/project/releases/20141006195559 && curl -s http://getcomposer.org/installer | php'\\'''" on 88.88.88.88
我找不到任何解决方案。 有人对我的问题有所了解吗?非常感谢你。
答案 0 :(得分:0)
如果有人会遇到同样的问题。这是我的工作脚本:
set :application, "project"
set :domain, "88.88.88.88"
set :deploy_to, "/var/www/project"
set :app_path, "app"
set :user, "root"
set :scm, :git
set :repository, "file:///Users/berlin/vagrant-workspace/project"
set :deploy_via, :capifony_copy_local
set :use_composer, true
set :use_composer_tmp, true
role :web, domain
role :app, domain, :primary => true
set :use_sudo, false
set :keep_releases, 3
set :shared_files, ["app/config/parameters.yml"]
set :shared_children, [app_path + "/logs"]
#logger.level = Logger::MAX_LEVEL
after "deploy:finalize_update" do
capifony_pretty_print "--> Set permissions for writable directories"
run "chown -R www-data:www-data #{latest_release}/#{cache_path}"
run "chown -R www-data:www-data #{latest_release}/#{log_path}"
run "chmod -R 777 #{latest_release}/#{cache_path}"
puts "✔"
end
我不确切地知道差异,但这个片段工作正常。