SlideShare una empresa de Scribd logo
1 de 16
Yury Pliashkou 
CTO, IdeaSoft 
pliashkou@gmail.com 
Minsk, 2014
Requirements: 
ruby, rubygems 
Installation: 
gem install capifony 
Setup project: 
cd path/to/your/project 
capifony .
Deployment strategies: deployment → scm → production 
# deploy.rb 
set :application, "My App" 
set :deploy_to, "/var/www/my-app.com" 
set :domain, "my-app.com" 
set :scm, :git 
set :repository, "ssh-gitrepo-domain.com:/path/to/repo.git" 
role :web, domain 
role :app, domain, :primary => true 
set :use_sudo, false 
set :keep_releases, 3
Deployment strategies: deployment → scm → production 
In this case, on every cap deploy, capifony will: 
● ssh to production (my-app.com) 
● create a new release path (/var/www/my-app.com/releases/...) 
● clone the latest project version from the remote git repo (ssh-gitrepo- 
domain.com) 
● copy the source code, pulled from git, into the release path 
● run deployment hooks (cache:warmup, cc, etc.)
Deployment strategies: deployment → production (via copy) 
# deploy.rb 
set :application, "My App" 
set :deploy_to, "/var/www/my-app.com" 
set :domain, "my-app.com" 
set :scm, :git 
set :repository, "file:///Users/deployer/sites/my-app" 
set :deploy_via, :copy 
role :web, domain 
role :app, domain, :primary => true 
set :use_sudo, false 
set :keep_releases, 3
Deployment strategies: deployment → production (via copy) 
In this case, on every cap deploy, capifony will: 
● ssh to production (my-app.com) 
● create a new release path (/var/www/my-app.com/releases/...) 
● clone the latest project version from the local git repo 
● copy the source code, pulled from git, onto the production 
server via wires 
● run deployment hooks (cache:warmup, cc, etc.) 
Deploy is very expensive and slow! Solution: 
gem install capistrano_rsync_with_remote_cache 
set :deploy_via, :rsync_with_remote_cache
Setup server: 
cap deploy:setup 
This command will create the following approximate directory structure : 
`-- /var/www/my-app.com 
|-- current → /var/www/my-app. 
com/releases/20100512131539 
|-- releases 
| `-- 20100512131539 
| `-- 20100509150741 
| `-- 20100509145325 
`-- shared 
|-- web 
| `-- uploads 
|-- log 
`-- config 
`-- databases.yml
Deploy! 
cap deploy 
Something went wrong??? 
cap deploy:rollback
Symfony2 Deployment 
First, add the following to your app/config/deploy.rb file so 
that theparameters.yml file is shared between all 
deployments: 
set :shared_files, ["app/config/parameters.yml"] 
Next, share the vendor directory between all deployments to make deploying 
faster: 
set :shared_children, [app_path + "/logs", web_path + "/uploads", "vendor"] 
To install your vendors, capifony will rely on bin/vendors by default. But the 
recommended dependency manager is now Composer. In order to use it, just add 
the following configuration: 
set :use_composer, true 
set :update_vendors, true
Useful Tasks 
If you need to deploy and run your migrations you can call: 
cap deploy:migrations 
To run your test suite on the production server, just invoke: 
cap deploy:test_all 
You can invoke tasks/commands by calling: 
cap symfony 
If you want to see all available tasks, you can run: 
cap -vT
Symfony 2 Configuration Reference 
All symfony tasks run using the default php binary on the production 
server. You can change this via: 
set :php_bin, "/path/to/php" 
All symfony tasks also run inside the prod environment on production 
server. You can change this via: 
set :symfony_env_prod, "staging" 
If you use AsseticBundle with Symfony2, then you probably want to dump 
assets on every deploy: 
set :dump_assetic_assets, true
Recipe: Automatically set proper permissions 
set :writable_dirs, ["app/cache", "app/logs"] 
set :webserver_user, "www-data" 
set :permission_method, :acl 
set :use_set_permissions, true 
Recipe: Speeding up deploy 
before 'symfony:composer:install', 'composer:copy_vendors' 
before 'symfony:composer:update', 'composer:copy_vendors' 
namespace :composer do 
task :copy_vendors, :except => { :no_release => true } do 
run "vendorDir=#{current_path}/vendor; if [ -d $vendorDir ] || [ -h 
$vendorDir ]; then cp -a $vendorDir #{latest_release}/vendor; fi;" 
end 
end
Recipe: How to keep Symfony2 sessions after deploy 
In order to change sessions save path change the save_path parameter 
under a framework node in your application’s config.yml 
framework: 
session: 
save_path: "%kernel.root_dir%/sessions/" 
You have to add also your sessions directory to Capifony’s :shared_children 
# deploy.rb 
set :shared_children, [log_path, ..., app_path + "/sessions"]
Recipe: Working with databases 
Dump remote database, and download this dump to local backups/ folder: 
cap database:dump:remote 
Dump local database, and put this dump to local backups/ folder: 
cap database:dump:local 
Dump remote database, and populate this dump on local machine: 
cap database:copy:to_local 
Dump local database, and populate this dump on remote server: 
cap database:copy:to_remote
Demo
Questions ? 
Yury Pliashkou 
CTO, IdeaSoft 
pliashkou@gmail.com

Más contenido relacionado

La actualidad más candente

Cloud focker を試してみた public
Cloud focker を試してみた   publicCloud focker を試してみた   public
Cloud focker を試してみた public
Takehiko Amano
 
Aeon mike guide transparent ssl filtering (1)
Aeon mike guide transparent ssl filtering (1)Aeon mike guide transparent ssl filtering (1)
Aeon mike guide transparent ssl filtering (1)
Conrad Cruz
 
Aeon mike guide transparent ssl filtering
Aeon mike guide transparent ssl filteringAeon mike guide transparent ssl filtering
Aeon mike guide transparent ssl filtering
Conrad Cruz
 
NLIT 2011: Chef & Capistrano
NLIT 2011: Chef & CapistranoNLIT 2011: Chef & Capistrano
NLIT 2011: Chef & Capistrano
nickblah
 

La actualidad más candente (19)

Capistrano 3 Deployment
Capistrano 3 DeploymentCapistrano 3 Deployment
Capistrano 3 Deployment
 
How to install and configure LEMP stack
How to install and configure LEMP stackHow to install and configure LEMP stack
How to install and configure LEMP stack
 
A quick intro to Ansible
A quick intro to AnsibleA quick intro to Ansible
A quick intro to Ansible
 
Dockerizing WordPress
Dockerizing WordPressDockerizing WordPress
Dockerizing WordPress
 
Cloud focker を試してみた public
Cloud focker を試してみた   publicCloud focker を試してみた   public
Cloud focker を試してみた public
 
Installing and running Postfix within a docker container from the command line
Installing and running Postfix within a docker container from the command lineInstalling and running Postfix within a docker container from the command line
Installing and running Postfix within a docker container from the command line
 
Watch Me Install Alfresco
Watch Me Install AlfrescoWatch Me Install Alfresco
Watch Me Install Alfresco
 
Deployment with capistrano
Deployment with capistranoDeployment with capistrano
Deployment with capistrano
 
Quickly extending into testing with docker
Quickly extending into testing with dockerQuickly extending into testing with docker
Quickly extending into testing with docker
 
Ansible intro
Ansible introAnsible intro
Ansible intro
 
Aeon mike guide transparent ssl filtering (1)
Aeon mike guide transparent ssl filtering (1)Aeon mike guide transparent ssl filtering (1)
Aeon mike guide transparent ssl filtering (1)
 
Aeon mike guide transparent ssl filtering
Aeon mike guide transparent ssl filteringAeon mike guide transparent ssl filtering
Aeon mike guide transparent ssl filtering
 
Infrastructure = code - 1 year later
Infrastructure = code - 1 year laterInfrastructure = code - 1 year later
Infrastructure = code - 1 year later
 
Capistrano
CapistranoCapistrano
Capistrano
 
SaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
SaltConf14 - Ben Cane - Using SaltStack in High Availability EnvironmentsSaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
SaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
 
NLIT 2011: Chef & Capistrano
NLIT 2011: Chef & CapistranoNLIT 2011: Chef & Capistrano
NLIT 2011: Chef & Capistrano
 
體驗 Hhvm
體驗 Hhvm體驗 Hhvm
體驗 Hhvm
 
Creating and Deploying Static Sites with Hugo
Creating and Deploying Static Sites with HugoCreating and Deploying Static Sites with Hugo
Creating and Deploying Static Sites with Hugo
 
Capistrano, Puppet, and Chef
Capistrano, Puppet, and ChefCapistrano, Puppet, and Chef
Capistrano, Puppet, and Chef
 

Similar a Capifony. Minsk PHP MeetUp #11

Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshare
tomcopeland
 
Node.js basics
Node.js basicsNode.js basics
Node.js basics
Ben Lin
 

Similar a Capifony. Minsk PHP MeetUp #11 (20)

Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
 
Composer
ComposerComposer
Composer
 
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)
 
Deploying Rails applications with Moonshine
Deploying Rails applications with MoonshineDeploying Rails applications with Moonshine
Deploying Rails applications with Moonshine
 
Symfony2 for Midgard Developers
Symfony2 for Midgard DevelopersSymfony2 for Midgard Developers
Symfony2 for Midgard Developers
 
Capistrano Overview
Capistrano OverviewCapistrano Overview
Capistrano Overview
 
Capistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient wayCapistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient way
 
macos installation automation
macos installation automationmacos installation automation
macos installation automation
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshare
 
MeaNstack on Docker
MeaNstack on DockerMeaNstack on Docker
MeaNstack on Docker
 
Control your deployments with Capistrano
Control your deployments with CapistranoControl your deployments with Capistrano
Control your deployments with Capistrano
 
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
 
Varnish Configuration Step by Step
Varnish Configuration Step by StepVarnish Configuration Step by Step
Varnish Configuration Step by Step
 
IOS 11 setup with appium latest
IOS 11 setup with appium  latestIOS 11 setup with appium  latest
IOS 11 setup with appium latest
 
AWS CodeDeploy - basic intro
AWS CodeDeploy - basic introAWS CodeDeploy - basic intro
AWS CodeDeploy - basic intro
 
Node.js basics
Node.js basicsNode.js basics
Node.js basics
 
Running Symfony
Running SymfonyRunning Symfony
Running Symfony
 
Getting instantly up and running with Docker and Symfony
Getting instantly up and running with Docker and SymfonyGetting instantly up and running with Docker and Symfony
Getting instantly up and running with Docker and Symfony
 
Magento 2 Development
Magento 2 DevelopmentMagento 2 Development
Magento 2 Development
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 

Último

在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
ydyuyu
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
ydyuyu
 
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
ydyuyu
 
PowerDirector Explination Process...pptx
PowerDirector Explination Process...pptxPowerDirector Explination Process...pptx
PowerDirector Explination Process...pptx
galaxypingy
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Monica Sydney
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Monica Sydney
 
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
gajnagarg
 
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsRussian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Monica Sydney
 
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
ayvbos
 
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
ayvbos
 

Último (20)

best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
 
Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
 
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
 
PowerDirector Explination Process...pptx
PowerDirector Explination Process...pptxPowerDirector Explination Process...pptx
PowerDirector Explination Process...pptx
 
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
 
Best SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency DallasBest SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency Dallas
 
Power point inglese - educazione civica di Nuria Iuzzolino
Power point inglese - educazione civica di Nuria IuzzolinoPower point inglese - educazione civica di Nuria Iuzzolino
Power point inglese - educazione civica di Nuria Iuzzolino
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
 
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac RoomVip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
 
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
 
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsRussian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
 
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
 
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
 

Capifony. Minsk PHP MeetUp #11

  • 1. Yury Pliashkou CTO, IdeaSoft pliashkou@gmail.com Minsk, 2014
  • 2. Requirements: ruby, rubygems Installation: gem install capifony Setup project: cd path/to/your/project capifony .
  • 3. Deployment strategies: deployment → scm → production # deploy.rb set :application, "My App" set :deploy_to, "/var/www/my-app.com" set :domain, "my-app.com" set :scm, :git set :repository, "ssh-gitrepo-domain.com:/path/to/repo.git" role :web, domain role :app, domain, :primary => true set :use_sudo, false set :keep_releases, 3
  • 4. Deployment strategies: deployment → scm → production In this case, on every cap deploy, capifony will: ● ssh to production (my-app.com) ● create a new release path (/var/www/my-app.com/releases/...) ● clone the latest project version from the remote git repo (ssh-gitrepo- domain.com) ● copy the source code, pulled from git, into the release path ● run deployment hooks (cache:warmup, cc, etc.)
  • 5. Deployment strategies: deployment → production (via copy) # deploy.rb set :application, "My App" set :deploy_to, "/var/www/my-app.com" set :domain, "my-app.com" set :scm, :git set :repository, "file:///Users/deployer/sites/my-app" set :deploy_via, :copy role :web, domain role :app, domain, :primary => true set :use_sudo, false set :keep_releases, 3
  • 6. Deployment strategies: deployment → production (via copy) In this case, on every cap deploy, capifony will: ● ssh to production (my-app.com) ● create a new release path (/var/www/my-app.com/releases/...) ● clone the latest project version from the local git repo ● copy the source code, pulled from git, onto the production server via wires ● run deployment hooks (cache:warmup, cc, etc.) Deploy is very expensive and slow! Solution: gem install capistrano_rsync_with_remote_cache set :deploy_via, :rsync_with_remote_cache
  • 7. Setup server: cap deploy:setup This command will create the following approximate directory structure : `-- /var/www/my-app.com |-- current → /var/www/my-app. com/releases/20100512131539 |-- releases | `-- 20100512131539 | `-- 20100509150741 | `-- 20100509145325 `-- shared |-- web | `-- uploads |-- log `-- config `-- databases.yml
  • 8. Deploy! cap deploy Something went wrong??? cap deploy:rollback
  • 9. Symfony2 Deployment First, add the following to your app/config/deploy.rb file so that theparameters.yml file is shared between all deployments: set :shared_files, ["app/config/parameters.yml"] Next, share the vendor directory between all deployments to make deploying faster: set :shared_children, [app_path + "/logs", web_path + "/uploads", "vendor"] To install your vendors, capifony will rely on bin/vendors by default. But the recommended dependency manager is now Composer. In order to use it, just add the following configuration: set :use_composer, true set :update_vendors, true
  • 10. Useful Tasks If you need to deploy and run your migrations you can call: cap deploy:migrations To run your test suite on the production server, just invoke: cap deploy:test_all You can invoke tasks/commands by calling: cap symfony If you want to see all available tasks, you can run: cap -vT
  • 11. Symfony 2 Configuration Reference All symfony tasks run using the default php binary on the production server. You can change this via: set :php_bin, "/path/to/php" All symfony tasks also run inside the prod environment on production server. You can change this via: set :symfony_env_prod, "staging" If you use AsseticBundle with Symfony2, then you probably want to dump assets on every deploy: set :dump_assetic_assets, true
  • 12. Recipe: Automatically set proper permissions set :writable_dirs, ["app/cache", "app/logs"] set :webserver_user, "www-data" set :permission_method, :acl set :use_set_permissions, true Recipe: Speeding up deploy before 'symfony:composer:install', 'composer:copy_vendors' before 'symfony:composer:update', 'composer:copy_vendors' namespace :composer do task :copy_vendors, :except => { :no_release => true } do run "vendorDir=#{current_path}/vendor; if [ -d $vendorDir ] || [ -h $vendorDir ]; then cp -a $vendorDir #{latest_release}/vendor; fi;" end end
  • 13. Recipe: How to keep Symfony2 sessions after deploy In order to change sessions save path change the save_path parameter under a framework node in your application’s config.yml framework: session: save_path: "%kernel.root_dir%/sessions/" You have to add also your sessions directory to Capifony’s :shared_children # deploy.rb set :shared_children, [log_path, ..., app_path + "/sessions"]
  • 14. Recipe: Working with databases Dump remote database, and download this dump to local backups/ folder: cap database:dump:remote Dump local database, and put this dump to local backups/ folder: cap database:dump:local Dump remote database, and populate this dump on local machine: cap database:copy:to_local Dump local database, and populate this dump on remote server: cap database:copy:to_remote
  • 15. Demo
  • 16. Questions ? Yury Pliashkou CTO, IdeaSoft pliashkou@gmail.com