【问题标题】:Capifony cache error when deploying to development server部署到开发服务器时出现 Capifony 缓存错误
【发布时间】:2013-03-27 10:29:25
【问题描述】:

我正在尝试使用 capifony 将 Symfony2 应用程序部署到我在外部托管的开发服务器上,但是我收到以下错误:

--> Updating code base with remote_cache strategy
--> Creating cache directory................................✔
--> Creating symlinks for shared directories................✔
--> Creating symlinks for shared files......................✔
--> Copying Composer from previous release..................✔
--> Updating Composer.......................................✔
--> Updating Composer dependencies..........................✔
--> Building bootstrap file.................................✔
--> Dumping an optimized autoloader.........................✔
--> Installing bundle's assets..............................✔
--> Warming up cache........................................✔
--> Dumping all assets to the filesystem....................✘
*** [err :: x.xx.xx.xxx] PHP Fatal error:  Class 'Ivory\GoogleMap\Templating\Helper\Base\CoordinateHelper' not found in /var/www/dev.xyz.co.uk/shared/app/cache/dev/appDevProjectContainer.php on line 462

我的部署脚本中是否缺少某些内容?这是我的 deploy.rb 文件:

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

set :application,           "xyz.co.uk"
set :user,                  "root"  # The server's user for deploys

set :normalize_asset_timestamps, false

set :repository,            "git@github.com:xyz/xyz.co.uk.git"
set :scm,                   :git
set :keep_releases,         3
set :use_sudo,              false
set :shared_files,          ["app/config/parameters.yml"]
set :web_path,              "web"
set :shared_children,       [app_path + "/logs", app_path + "/cache", web_path + "/uploads", "vendor"]
set :use_composer,          true
set :update_vendors,        true
set :dump_assetic_assets,   true
set :deploy_via,            :remote_cache

#logger.level = Logger::MAX_LEVEL

这是我的 development.rb 文件:

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

# Need to clear *_dev controllers
set :clear_controllers,     false

【问题讨论】:

  • 我必须在部署之前删除缓存,然后它才能工作。我应该在部署脚本中添加一个钩子以在部署之前清除缓存吗?

标签: php caching symfony capistrano capifony


【解决方案1】:

您不应在版本之间共享app/cache。保持这样:

set :shared_files,        ["app/config/parameters.yml"]
set :shared_children,     [app_path + "/logs", web_path + "/uploads"]

【讨论】:

  • 确定并删除“供应商”?我现在就试一试。
  • 部署时缓存目录仍然存在问题。我收到错误RuntimeException: Failed to write cache file "/var/www/xyz.co.uk/app/cache/dev/classes.php".,除非我删除所有缓存,否则它可以正常工作。知道这是为什么吗?我没有像 /app/logs/ 那样对 app/cache/ 进行符号链接
  • 你不应该符号链接app/cache,因为每个版本都有自己的代码并且需要清除缓存,所以这很好。您的问题与权限有关,您必须按照此处所述进行设置 - symfony.com/doc/current/book/… 。最简单的方法是将umask(0000); 添加到app/console 和web/app*.php。
猜你喜欢
  • 2014-05-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-04-16
  • 2019-12-01
  • 2013-03-09
  • 1970-01-01
相关资源
最近更新 更多