SlideShare a Scribd company logo
Using Capifony for
Symfony apps deployment
Žilvinas Kuusas
KaunasPHP v.23, 2015-02-11 / http://kaunasphp.lt
Žilvinas Kuusas
lead developer at Estina / iSign.io
t: @kuusas
e: zilvinas@kuusas.lt
Who am I?
What I do?
I write code.
Co-organize:
NoTrollsAllowed.com
VilniusPHP.lt
Symfony.lt
Symfony app
deployment
Deployment...
Code
● FTP
● $ vim
● $ rsync
● $ git pull
Database
● Manually manage DB
fields
● phpMyAdmin
● $ mysql < changes.sql
Infrastructure...
Symfony - heavy
Many many deployment steps:
● git pull
● assets:install
● assetic:dump
● doctrine:migrations:migrate
● cache:clear
● cache:warmup
● restart some services
● ...
What if …
… you forgot one of the
steps? Forgot to clear
cache...
Don’t Repeat Yourself
AUTOMATE!
Goals for solid deployment
● One-click deployment
● Deploy in one transaction
● Rollback
● Automated tasks
● Notifications
● 0 downtime
● Confidence
Capistrano
Capifony
What Capistrano is?
● Capistrano is an open source tool for running scripts on
multiple servers
● Primary use - application deployment
● Capifony - set of instructions called “recipes” for
Symfony applications deployment
● Built to make your job a lot easier
Why Capifony?
● Fully supports Symfony features
● Actively maintained since 2009
● 6 active contributors
● >100 total
● last commit 16 days ago
What do we need?
● Symfony2 application
● Capifony
● SSH access to server (ssh-key recommended)
● Minor changes in web server configuration
Folder structure on web server
Web server configuration
Setup
$ sudo gem install capifony
$ cd /path/to/your/project
$ capifony .
$ capifony .
$ vi app/config/deploy.rb
$ vi app/config/deploy.rb
$ cap deploy
$ cap deploy
Main deployment commands
$ cap deploy
…
$ cap deploy:migrations
...
$ cap deploy:rollback
Deployment strategies
deployment > scm > production
Deployment strategies
scm > deployment > production
Behind scenes
What else Capifony can do?
● Execute Symfony commands on server
● Execute shell commands on server
● Dump remote database and download
● Tail logs
● Turn on/off maintenance page
$ cap -vT # Lists all tasks available
$ cap deploy:check
$ cap database:copy:to_local
$ cap deploy:cold
$ cap deploy:pending
$ cap deploy:web:disable
$ cap deploy:web:enable
$ cap symfony:logs:tail
$ cap symfony
...
Database deployment
To deploy database schema updates in...
● SAFE
● EASY
● STANDARDIZED
way…
Use database migrations!
DoctrineMigrationsBundle
$ app/console doctrine:migrations:diff
Deploying with migrations:
$ cap deploy:migrations
Rolling-back migrations:
$ cap symfony -S task_arguments="doctrine:
migrations:migrate 20150205170707 --no-interaction"
$ cap deploy:migrations
OPcache
● Create temp file accessible via www
● Make curl request (x5)
● Remove file
Capistrano recipe for that:
https://github.com/occitech/capistrano-recipes/blob/master/Opcache-Recipe.rb
Keeping Symfony sessions
Multistage extension
Enables deployment to multiple servers
$ cap STAGE_NAME deploy
Multistage extension:
https://github.com/capistrano/capistrano/wiki/2.x-Multistage-Extension
Deploying release package
● CI server builds release package (zip)
● Capifony deploys
● Only in Capistrano v2.15
Capistrano deploy strategy called “archive”:
https://github.com/sorccu/capistrano-deploy-strategy-archive
Symfony related configuration
Extending Capistrano
It’s Ruby!
Override Capistrano recipes
Listen to events
Debugging
$ cap deploy -d
cap deploy:migrations -s branch=master
cap deploy:migrations -S my_var=value
Arguments in CLI
Other deployment tools
● Fabric (Python)
● Idephix
● Magellanes
● Deployer
● Laravel / Envoy
● Rocketeer
● Ansible + Tower
Final thoughts
Don’t use FTP
Final thoughts
Don’t repeat yourself
Final thoughts
AUTOMATE
Questions?
AČIŪ
Credits for image authors. “what if…” gif taken from devopsreactions.tumblr.com, deployment strategies - from capifony.org.
Couldn’t find the real authors of lizzard and kitty - so if its your’s - THANK YOU.

More Related Content

PPTX
Deploying Symfony2 app with Ansible
PDF
Ansible 101
PDF
Ansible Automation to Rule Them All
PDF
Getting instantly up and running with Docker and Symfony
ODP
ansible why ?
PDF
Automation with ansible
PPT
Learn basic ansible using docker
PDF
Ansible - Introduction
Deploying Symfony2 app with Ansible
Ansible 101
Ansible Automation to Rule Them All
Getting instantly up and running with Docker and Symfony
ansible why ?
Automation with ansible
Learn basic ansible using docker
Ansible - Introduction

What's hot (20)

PDF
IT Automation with Ansible
PDF
Dockerizing Symfony Applications - Symfony Live Berlin 2014
 
PDF
A quick intro to Ansible
PDF
Deploying PHP Applications with Ansible
ODP
Introduction to Ansible
PDF
Ansible Introduction - Ansible Brno #1 - David Karban
PDF
Ansible 2.0 - How to use Ansible to automate your applications in AWS.
PDF
Application Deployment Using Ansible
PDF
Ansible - Swiss Army Knife Orchestration
PDF
Introduction to ansible
PPTX
Dockerizing a Symfony2 application
PDF
Docker up and running
PDF
Jenkins and ansible reference
PDF
Ansible, best practices
PDF
docker build with Ansible
ODP
Fabric: A Capistrano Alternative
PPTX
Introduction to ansible
PPTX
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
PDF
JavaCro'15 - Conquer the Internet of Things with Java and Docker - Johan Jans...
PPTX
Ansible intro
IT Automation with Ansible
Dockerizing Symfony Applications - Symfony Live Berlin 2014
 
A quick intro to Ansible
Deploying PHP Applications with Ansible
Introduction to Ansible
Ansible Introduction - Ansible Brno #1 - David Karban
Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Application Deployment Using Ansible
Ansible - Swiss Army Knife Orchestration
Introduction to ansible
Dockerizing a Symfony2 application
Docker up and running
Jenkins and ansible reference
Ansible, best practices
docker build with Ansible
Fabric: A Capistrano Alternative
Introduction to ansible
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
JavaCro'15 - Conquer the Internet of Things with Java and Docker - Johan Jans...
Ansible intro
Ad

Viewers also liked (20)

PDF
Autonomic Application Delivery with Tonomi
PPT
технология селективной изоляции водопритока
PPTX
Questionnaire results
PPT
طريقنا الى القلوب!
PDF
Silabus osn geografi_2013
PPTX
IT Nation 2014 breakout
PPT
طريقنا الى القلوب!
PPTX
Aleksander Królikowski
PPT
презентация по технологии лпп
PDF
Autonomic Management of Cloud Applications with Tonomi, Gluecon Keynote, 2015
PPT
طريقنا الى القلوب!
PPT
установка колонн летучек
PPTX
Creativity Lego เอก
PPTX
High availability is not a luxury webcast
PPTX
My perfect vacation
PPTX
New zealand Tourism
PDF
Hand wrist exercises
PPTX
Informal invitation
PPTX
Лабораторна робота LR4-5_4-5.1_kozachenko
Autonomic Application Delivery with Tonomi
технология селективной изоляции водопритока
Questionnaire results
طريقنا الى القلوب!
Silabus osn geografi_2013
IT Nation 2014 breakout
طريقنا الى القلوب!
Aleksander Królikowski
презентация по технологии лпп
Autonomic Management of Cloud Applications with Tonomi, Gluecon Keynote, 2015
طريقنا الى القلوب!
установка колонн летучек
Creativity Lego เอก
High availability is not a luxury webcast
My perfect vacation
New zealand Tourism
Hand wrist exercises
Informal invitation
Лабораторна робота LR4-5_4-5.1_kozachenko
Ad

Similar to Using Capifony for Symfony apps deployment (updated) (20)

PDF
Using Capifony for Symfony apps deployment.
PDF
Capistrano deploy Magento project in an efficient way
PPTX
Retrofitting Continuous Delivery
PDF
Beyond Puppet
ODP
Capifony. Minsk PHP MeetUp #11
PDF
Deploying Symfony | symfony.cat
PDF
Setting up Notifications, Alerts & Webhooks with Flux v2 by Alison Dowdney
PDF
Deploying Rails Apps with Chef and Capistrano
PDF
Deploy made easy (even on Friday)
PDF
Sprint 17
PPTX
drupal ci cd concept cornel univercity.pptx
PPTX
Deployment with capifony
PDF
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
PDF
Php Inside - confoo 2011 - Derick Rethans
PDF
Rock Solid Deployment of Web Applications
PPTX
Deployment with capistrano
ODP
From Code to Cloud - PHP on Red Hat's OpenShift
PDF
Pyramid Deployment and Maintenance
ZIP
Deploying Rails applications with Moonshine
ODP
It gilde 20150209
Using Capifony for Symfony apps deployment.
Capistrano deploy Magento project in an efficient way
Retrofitting Continuous Delivery
Beyond Puppet
Capifony. Minsk PHP MeetUp #11
Deploying Symfony | symfony.cat
Setting up Notifications, Alerts & Webhooks with Flux v2 by Alison Dowdney
Deploying Rails Apps with Chef and Capistrano
Deploy made easy (even on Friday)
Sprint 17
drupal ci cd concept cornel univercity.pptx
Deployment with capifony
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Php Inside - confoo 2011 - Derick Rethans
Rock Solid Deployment of Web Applications
Deployment with capistrano
From Code to Cloud - PHP on Red Hat's OpenShift
Pyramid Deployment and Maintenance
Deploying Rails applications with Moonshine
It gilde 20150209

More from Žilvinas Kuusas (9)

PDF
Use Symfony Messenger Component and CQRS!
PDF
Ansible: infrastructure automation for everyone
PDF
Automated cryptocurrency trading
PDF
Continuous delivery
PDF
Continuously delivering value
PDF
Code reviews
PDF
Baby steps to Domain-Driven Design
PDF
Community and open source
PDF
Microservice architecture
Use Symfony Messenger Component and CQRS!
Ansible: infrastructure automation for everyone
Automated cryptocurrency trading
Continuous delivery
Continuously delivering value
Code reviews
Baby steps to Domain-Driven Design
Community and open source
Microservice architecture

Recently uploaded (20)

PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Encapsulation theory and applications.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Machine learning based COVID-19 study performance prediction
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Electronic commerce courselecture one. Pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Approach and Philosophy of On baking technology
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
Spectral efficient network and resource selection model in 5G networks
Encapsulation theory and applications.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
20250228 LYD VKU AI Blended-Learning.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Machine learning based COVID-19 study performance prediction
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Chapter 3 Spatial Domain Image Processing.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Mobile App Security Testing_ A Comprehensive Guide.pdf
Electronic commerce courselecture one. Pdf
Encapsulation_ Review paper, used for researhc scholars
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Approach and Philosophy of On baking technology
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Dropbox Q2 2025 Financial Results & Investor Presentation
Understanding_Digital_Forensics_Presentation.pptx
Building Integrated photovoltaic BIPV_UPV.pdf

Using Capifony for Symfony apps deployment (updated)