SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Tendances

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
 

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

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

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

Dernier

💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
nirzagarg
 
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
nilamkumrai
 
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
nilamkumrai
 
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
Call Girls In Delhi Whatsup 9873940964 Enjoy Unlimited Pleasure
 
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 

Dernier (20)

💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
 
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls DubaiDubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
 
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
 
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
Russian Call Girls in %(+971524965298  )#  Call Girls in DubaiRussian Call Girls in %(+971524965298  )#  Call Girls in Dubai
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
 
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
 
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
 
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort ServiceBusty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
 
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
 
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
 
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
 
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
 
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
 
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
 
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
 
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
 

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