3

I'm trying to deploy my Symfony2 application to my development server which is hosted externally, using capifony, however I'm getting the following error:

--> 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

Am I missing something from my deployment script? Here is my deploy.rb file:

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

And here is my development.rb file:

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
user1961082
  • 1,015
  • 17
  • 41
  • I had to remove the cache before deploying and then it worked. Should I add a hook into my deployment script to clear the cache before deploying? – user1961082 Mar 27 '13 at 10:58

1 Answers1

3

You should not share app/cache between releases. Keep it like this:

set :shared_files,        ["app/config/parameters.yml"]
set :shared_children,     [app_path + "/logs", web_path + "/uploads"]
Anton Babenko
  • 6,586
  • 2
  • 36
  • 44
  • OK and remove "vendor" too? I'll give it a try now. – user1961082 Mar 27 '13 at 12:37
  • I still have a problem with my cache directory when I deploy. I get the error `RuntimeException: Failed to write cache file "/var/www/xyz.co.uk/app/cache/dev/classes.php".` unless I remove all cache then it works ok. Any idea why this is? I haven't got app/cache/ symlinked like I have with /app/logs/ – user1961082 Mar 27 '13 at 12:49
  • You should not symlink `app/cache`, because each release has its own code and requires clear cache, so this is fine. Your problem is related to permissions, which you have to set as described here - http://symfony.com/doc/current/book/installation.html#configuration-and-setup . The easiest way is to add `umask(0000);` to `app/console` and `web/app*.php`. – Anton Babenko Mar 27 '13 at 20:46