巴西Symfony朋友 / sync-content-bundle
Symfony BFOSSyncContentBundle
v1.0.4
2014-07-07 14:42 UTC
Requires
- php: >=5.3.2
- symfony/console: >=2.1
- symfony/finder: >=2.2.0
- symfony/framework-bundle: >=2.2
Requires (Dev)
- phpunit/phpunit: 3.7.*
This package is not auto-updated.
Last update: 2024-09-28 15:54:45 UTC
README
这个Symfony 2组件可以帮助您同步远程服务器上的内容。它还可以部署您的应用程序。
这个组件受到了Punk'Ave的sfSyncContentPlugin和MadalynnPlumBundle的启发。
安装
您需要在deps文件上安装子模块:
// deps
[BFOSSyncContentBundle]
git=git://github.com/BrazilianFriendsOfSymfony/BFOSSyncContentBundle.git
target=/bundles/BFOS/SyncContentBundle
然后:
bash$ php bin/vendors install
配置
将以下内容添加到app/autoload.php中:
// app/autoload.php
$loader->registerNamespaces(array(
// ...
'BFOS' => __DIR__.'/../vendor/bundles',
// ...
));
将以下内容添加到app/AppKernel.php中:
// app/AppKernel.php
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new BFOS\SyncContentBundle\BFOSSyncContentBundle();
}
将以下内容添加到app/config/config_dev.yml中:
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"
deployment_sync_content.yml 示例
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"
rsync_exclude.txt 示例
# 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
使用方法
如何使用
php app/console bfos:sync-content:to dev@staging
php app/console bfos:sync-content:to prod@production
php app/console bfos:deploy staging