The BFOSSyncContentBundle
This Symfony 2 bundle helps you synchronize your content with your remote server. It also deploys your application., (*1)
This bundle was inspired by sfSyncContentPlugin by Punk'Ave and MadalynnPlumBundle., (*2)
Installation
You need to install de submodule on the deps file::, (*3)
// deps
[BFOSSyncContentBundle]
    git=git://github.com/BrazilianFriendsOfSymfony/BFOSSyncContentBundle.git
    target=/bundles/BFOS/SyncContentBundle
And then::, (*4)
bash$ php bin/vendors install
Configuration
Add this to app/autoload.php::, (*5)
// app/autoload.php
$loader->registerNamespaces(array(
  // ...
  'BFOS'              => __DIR__.'/../vendor/bundles',
  // ...
));
And this to app/AppKernel.php::, (*6)
// app/AppKernel.php
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
    $bundles[] = new BFOS\SyncContentBundle\BFOSSyncContentBundle();
}
And this to your app/config/config_dev.yml, (*7)
bfos_sync_content:
    options: # Global options
        deployment:
            rsync_exclude: 
                - "%kernel.root_dir%/config/rsync_exclude.txt"
            pre_local_commands:
                - 'php app/console assetic:dump'
            post_local_commands:
                - 'rm -rf web/js web/css'
            #pre_remote_commands:
            #    - './c'
            post_remote_commands:
                - 'php app/console cache:clear --env=prod --no-debug --no-warmup'
                - 'php app/console doctrine:schema:update --force --env=prod'
                - 'php app/console assets:install web --symlink'
        sync_content:
            content:
                - "web/uploads"
    servers: "%kernel.root_dir%/config/deployment_sync_content.yml"
Example of deployment_sync_content.yml :, (*8)
servers:
    staging:
        host: staging.mysite.com
        port: 22
        user: mysite
        dir: /home/user/mysite
        options : # Server options, override the globals
            rsync_options: '-azC --force --delete --verbose --progress'
            deployment:
                rsync_exclude: 
                    - "%kernel.root_dir%/config/rsync_exclude.txt"
    production:
        host: www.mysite.com
        port: 22
        user: mysite
        dir: /home/user/mysite
        options : # Server options, override the globals
            rsync_options: '-azC --force --delete --verbose --progress'
            deployment:
                rsync_exclude: 
                    - "%kernel.root_dir%/config/rsync_exclude.txt"
                    - "%kernel.root_dir%/config/rsync_exclude_prod.txt"
Example of rsync_exclude.txt :, (*9)
# Project files
# rsync doesn't need this explicit rule, but our cloud deployment tools do
*/.svn/*
/web/uploads/*
/web/bundles/*
/app/cache/*
/app/logs/*
/web/*_dev.php
# Separate version on the server allows both prod and dev to be tested locally with the
# local one. Neither version is checked into svn for security reasons since this is a public repo
/app/config/parameters.yml
/app/config/deployment_sync_content.yml
/app/config/parameters.ini
# SCM files
.arch-params
.bzr
_darcs
.git
.hg
.monotone
.svn
.idea
CVS
Usage
How to use:, (*10)
php app/console bfos:sync-content:to dev@staging, (*11)
php app/console bfos:sync-content:to prod@production, (*12)
php app/console bfos:deploy staging, (*13)