1

I am using symfony2.1 ,github and capfony(for deployment)

When I start the project these combination works very well.

However,Since I added SonataUserBundle and FOSUserbundle to project

cap deploy

command returns error such as

PHP Fatal error: Class 'Sonata\AdminBundle\SonataAdminBundle' not found in /var/www/html/muty/releases/20130410144941/app/AppKernel.php on line 26

But I have SonataAdminBundle here.

[application name]/vendor/sonata-project/admin-bundle/Sonata/AdminBundle and in AppKernel.php

public function registerBundles()
{
    $bundles = array(
     .....
        new Sonata\AdminBundle\SonataAdminBundle(),
        new Sonata\CacheBundle\SonataCacheBundle(),
        new Sonata\BlockBundle\SonataBlockBundle(),
        new Sonata\jQueryBundle\SonatajQueryBundle(),
        new Knp\Bundle\MenuBundle\KnpMenuBundle(),
        new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
        new FOS\UserBundle\FOSUserBundle(),
    .....
    );
}

These structure works well on local,but can't be deploy

I use composer not vendor.

IMHO, it seems that vendor folder is not correctly deployed,am I correct? or There are other places to check? please give me ideas!

thanks a lot

My deploy.rb is

set :application, "myapplication"
set :domain,      "myapplication"
set :deploy_to,   "/var/www/html/myapplication"
set :app_path,    "app"

set :repository,  "git@github.com:myname/myapplication.git"
set :scm,         :git
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `subversion`, `mercurial`, `perforce`, or `none`

set :default_shell,         "TERM=dumb sudo -u app /bin/sh"
set :branch, "master"
set :scm_username, "myname"
set :scm_passphrase, "mypass"
set   :use_sudo,      false
set :user, 'app'
set :model_manager, "doctrine"
# Or: `propel`

role :web,        "49.212.***.***"                         # Your HTTP server, Apache/etc
role :app,        "49.212.***.***"                         # This may be the same as your     `Web` server
role :db,         "49.212.***.***", :primary => true       # This is where Symfony2     migrations will run

set  :keep_releases,  3
set :clear_controllers,     false #app_dev.php should be deployed
#set :shared_files,        ["app/config/parameters.yml"]
#set :shared_children,     [app_path + "/logs", web_path + "/uploads"]

set :use_composer, true
set :update_vendors, true
set :deploy_via,            :remote_cache

set :writable_dirs,       ["app/cache", "app/logs"]
set :permission_method,   :chown #
set :use_set_permissions, false

# Be more verbose by uncommenting the following line
logger.level = Logger::MAX_LEVEL
whitebear
  • 11,200
  • 24
  • 114
  • 237

1 Answers1

1

I think the problem is that SonataAdminBundle isn't installed by the time composer tries to interact with your application (most likely warming up cache), which triggers the error.

First thing to try is to add vendor to shared_children, like this:

set :shared_children, [app_path + "/logs", web_path + "/uploads", "vendor"]

Second, updating vendors every time you deploy might not be a good idea (and could actually cause the problem because of incompatible dependencies):

set :update_vendors, false

If both of those fail, try to deploy from scratch to a new folder (with settings above) and see if it throws any errors.

Inoryy
  • 8,365
  • 2
  • 39
  • 40
  • it solved my problem!I dont know why my vendor directory was not updated(maybe cache related as you told though.....).thanks a lot!!!Finally I can deploy! – whitebear Apr 12 '13 at 22:02