无法创建符号链接

时间:2013-03-11 14:38:45

标签: symfony deployment capistrano symlink capifony

我正在尝试将“develop”分支部署到我的开发服务器,但是当我运行cap development deploy时,我收到以下错误:

executing "ln -nfs /var/www/xyz.co.uk/shared/web/media /var/www/xyz.co.uk/releases/20130311143220/web/media"
    servers: ["x.xx.xx.xxx"]
    [x.xx.xx.xxx] executing command
*** [err :: x.xx.xx.xxx] ln:
*** [err :: x.xx.xx.xxx] failed to create symbolic link `/var/www/xyz.co.uk/releases/20130311143220/web/media'
*** [err :: x.xx.xx.xxx] : No such file or directory
*** [err :: x.xx.xx.xxx] 
    command finished in 44ms
*** [deploy:update_code] rolling back

当我查看服务器时/var/www/xyz.co.uk/shared/web/media已创建并且/var/www/xyz.co.uk/releases/20130311143220已创建,但是一旦符号链接失败,则20130311143220将被删除,因为它已回滚。有任何想法吗?我是ssh'ing root。

Capifony配置

deploy.rb

set :stage_dir, 'app/config/deploy' # needed for Symfony2 only
set :stages, %w(production staging development)

set :application, "xyz.co.uk"

set :user, "root"  # The server's user for deploys
set :repository, "git@github.com:xyz/#{application}.git"
set :scm,         :git

set :keep_releases,  3
set :use_sudo,       false
set :shared_files,      ["app/config/parameters.yml"]
set :shared_children,   [app_path + "/logs", web_path + "/media", "vendor"]
set :use_composer, true
set :update_vendors, true
set :dump_assetic_assets, true

require 'capistrano/ext/multistage'
logger.level = Logger::MAX_LEVEL

development.rb

server 'x.xx.xx.xxx', :app, :web, :primary => true
ssh_options[:port] = xxxx
ssh_options[:forward_agent] = true
set :deploy_to, "/var/www/xyz.co.uk/"
set :symfony_env_prod, "test"

更新

实际的错误消息是:

failed: "sh -c 'ln -nfs /var/www/xyz.co.uk/shared/web/media /var/www/xz.co.uk/releases/20130312135615/web/media'" on x.xx.xx.xxx

此外,这是我的.gitignore文件:

/web/bundles/
/app/bootstrap*
/app/cache/*
/app/logs/*
/vendor/
/app/config/parameters.yml
composer.phar
/.idea/
/web/media/*

从我的git存储库中提取的用户名和密码在我的开发服务器上是否与在我部署的本地计算机上不同有什么不同?

2 个答案:

答案 0 :(得分:1)

原因是因为我没有设置set_branch来开发所以它使用的是空的!

答案 1 :(得分:0)

在您的存储库服务器(bitbucked,github)中,媒体文件夹已被推送?似乎capifony试图将共享设置为不存在的文件夹。