Capistrano Symfony目前的符号链接不起作用

时间:2017-04-05 11:38:30

标签: symfony deployment capistrano symlink

我正在部署Symfony应用程序,我在当前目录中遇到了符号链接问题。

当我删除符号链接并且我再次部署时,它是有效的,它是使用符号链接失败的更新!

我测试了这些解决方案:

Deploy:symlink on capistrano points the "current" directory to previous release

但它不起作用,有我的部署文件:

set :application, 'aci'
set :repo_url, 'git@bitbucket.org:myrepo/repo.git'

set :scm, :git

set :composer_install_flags, '--no-interaction --optimize-autoloader'

# Symfony console commands will use this environment for execution
set :symfony_env,  "prod"

# Set this to 2 for the old directory structure
set :symfony_directory_structure, 3
# Set this to 4 if using the older SensioDistributionBundle
set :sensio_distribution_version, 5

# symfony-standard edition directories
set :app_path, "app"
set :web_path, "web"
set :var_path, "var"
set :bin_path, "app"

# The next 3 settings are lazily evaluated from the above values, so take care
# when modifying them
set :app_config_path, "app/config"
set :log_path, "app/logs"
set :cache_path, "app/cache"

set :symfony_console_path, "app/console"
set :symfony_console_flags, "--no-debug"

# Remove app_dev.php during deployment, other files in web/ can be specified here
set :controllers_to_clear, ["app_*.php"]

# asset management
set :assets_install_path, "web"
set :assets_install_flags,  '--symlink'

# Share files/directories between releases
set :linked_files, []
set :linked_dirs, ["app/logs"]

# Set correct permissions between releases, this is turned off by default
set :file_permissions_paths, ["app"]
set :permission_method, false

# Share files/directories between releases
set :linked_files, %w{app/config/parameters.yml}
set :linked_dirs, %w{app/logs web/uploads}

after 'deploy:starting', 'composer:install_executable'
after 'deploy:updated', 'symfony:assets:install'
after 'deploy', 'deploy:symlink:release'

1 个答案:

答案 0 :(得分:0)

我找到了解决方案

这不是一个符号链接问题,而是一个APC问题所以有2个解决方案:

首先>速度和肮脏:

/etc/init.d/apache2 restart 

第二个>更长更清晰:

  • 安装https://github.com/ornicar/ApcBundle
  • 在你的.rake上添加:

    命名空间:symfony做   desc"清除apc缓存"   任务:clear_apc做      在角色(:app)做             symfony_console" apc:clear"      结束   结束 端

在deploy.rb上添加此内容

after "deploy", "symfony:clear_apc"

现在,您需要在每次部署后清除apc缓存,并且项目是最新的。