【发布时间】:2013-09-30 21:12:24
【问题描述】:
我刚刚完成了从 Symfony2 2.0 到 2.3.4 的升级。这现在正在我的本地开发服务器上运行,我正在寻找使用 Capifony 部署它。
Symfony 的一个重大变化是从 /bin/vendor 转向 Composer 来管理依赖项。
我已更新 Capistrano,因此“cap -V”提供了“Capistrano v2.15.5”
还有 Capifony,这样 'capifony -v' 会给出 'capifony v2.4.0'
问题是
cap deploy
从不尝试运行与 Composer 相关的任何内容。它坚持尝试使用/bin/vendor:
* 2013-09-29 23:16:58 executing `symfony:vendors:reinstall'
* executing "cd /vhosts/domains/mysite.com/public/releases/20130929221446 && php bin/vendors install --reinstall"
我的“deploy.rb”有:
set :use_composer, true
这是我的完整 deploy.rb
set :application, "mysite"
set :domain, "#{application}.com"
set :deploy_to, "/vhosts/domains/#{domain}/public"
set :app_path, "app"
#ssh stuff
ssh_options[:port] = 12345
ssh_options[:username] = "myuser"
ssh_options[:forward_agent] = true
set :scm, :git
set :branch, "master"
set :deploy_via, :rsync_with_remote_cache
#set :deploy_via, :remote_cache
set :user, "admin" # SSH login user
set :port, 12345 # For Capistrano
#set :use_sudo, true # admin is sufficiently privileged
# Set logging to max for debugging
#logger.level = Logger::MAX_LEVEL
# Advised to add this to fix an error message
default_run_options[:pty] = true
set :repository, "/vhosts/domains/mysite.com/public/current" # Local means Vagrant
set :model_manager, "doctrine"
# Or: `propel`
# Server roles
role :web, domain # Web server
#role :app, domain # App server (could be different)
#role :db, domain, :primary => true # DB server (primary means primary DB)
set :keep_releases, 12
# Added 29Sep13 as advised by current capifony docs
set :shared_files, ["app/config/parameters.yml"]
# directories that will be shared between all releases
set :shared_children, [app_path + "/logs", "customer_uploads", "vendor"]
set :use_composer, true
set :update_vendors, true
# Share /vendor between deployments
#set :copy_vendors, true
# Run post-scripts from composer install
#set :composer_options, "--no-dev --verbose --prefer-dist --optimize-autoloader"
# Below doesn't work with composer, is deprecated as only worked for bin/vendors
#set :vendors_mode, "reinstall"
# Assets install (to web directory as files rather than symlinks). Don't uncomment, set to 'false'.
set :assets_install, false
# Regenerate Assetic assets (JS, CSS). Don't uncomment, set to 'false'.
set :dump_assetic_assets, false
# Whether to run cache warmup. Don't uncomment, set to 'false'.
set :cache_warmup, true
# Note this can fail (e.g. to find and download a necessary Git repo) and deployment still proceeds.
# Change ACL on the app/logs and app/cache directories
# Works without this and when enabled gives error if sudo set to false above.
after 'deploy', 'deploy:update_acl'
# Adam added to try and enforce keep_releases automatically
after "deploy", "deploy:cleanup"
# Custom task to set the ACL on the app/logs and app/cache directories
namespace :deploy do
task :update_acl, :roles => :app do
shared_dirs = [
app_path + "/logs",
app_path + "/cache"
]
# add group write permissions
#run "chmod -R g+w #{shared_dirs.join(' ')}"
# Allow directories to be writable by webserver and this user
run "cd #{latest_release} && setfacl -R -m u:www-data:rwx -m u:#{user}:rwx #{shared_dirs.join(' ')}"
run "cd #{latest_release} && setfacl -dR -m u:www-data:rwx -m u:#{user}:rwx #{shared_dirs.join(' ')}"
end
end
Edit1 30Sep13 14:04 UTC 回应评论
位于我的项目根目录中的 Capfile 的内容是
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
Dir['vendor/bundles/*/*/recipes/*.rb'].each { |bundle| load(bundle) }
load Gem.find_files('symfony2.rb').last.to_s
load 'app/config/deploy'
另外,为什么要问其他问题,例如下面显示了使用 Capifony 时更漂亮的打印效果。我的输出看起来根本不像这样:没有滴答声,更混乱
Capifony failed reinstalling vendors with Symfony2.1
就好像 Capistrano 或 Capifony 不是最新的,因此无法识别使用 Composer 的指令 - 但为什么会这样?
提前致谢,
【问题讨论】:
-
你能把
Capfile文件的内容包含在你项目的根目录下吗? -
@kunal 完成了。我确实检查了它是否使用了我认为是的 deploy.rb,并且我在上面包含了它,它似乎是。
-
啊@kunal 我想你已经回答了。我需要更改 Capfile 的内容来升级 Capifony github.com/everzet/capifony/blob/master/UPGRADE.md。将其列为答案,以便我可以接受?
-
对我来说 capifony 2.4 不起作用,我降级到 2.3 并且一切运行良好。
标签: symfony symfony-2.3 capifony