SlideShare a Scribd company logo
Adopt Devops philosophy on your
              Symfony projects
                An introduction to Devops
                         by Fabrice Bernhard
Me
Fabrice Bernhard
@theodo
fabriceb@theodo.fr
Co-founder / CTO of Theodo and Allomatch.com
Theodo creates web-based applications

with open-source web technologies, agile methodologies and the highest
standards of quality

to guarantee rapid application development, risk-free deployment and easy
maintenance for every client.
@skoop: Now, let's look for a bar in Paris where I could watch the FC Utrecht match
:)
Allomatch.com is the website for watching sports in bars in France and Spain
(sportandbar.es)

Allomatch is used by 500 barmen (clients) and visited by more than 200,000
unique visitors per month

Peaks on the biggest days can go up to 20,000 people in the 2 hours preceding
the game

Allomatch.com is hosted on a cluster of 6 servers
What is DevOps?
        Introduction
How many here consider themselves SysAdmins?
How many here have never deployed an application on a
                     server?
Wikipedia
Definition of DevOps


DevOps is a set of processes, methods and systems for communication,
collaboration and integration between departments for Development
(Applications/Software Engineering), Technology Operations and Quality Assurance
(QA).
It relates to the emerging understanding of the interdependence of development
and operations in meeting a business' goal to producing timely software products
and services
The fundamental DevOps contradiction
Devs VS Ops

  Developers are asked to deliver new value, often and fast

  Operations people are asked to protect the current value

  Pro-Change VS Pro-Stability
Silos
Break the silos
DevOps do RADD
DevOps create the infrastructure that empower devs from
    the first line of code to the delivery
How to be DevOps?

  Configuration management for rapid, repeatable server setup

  Deployment scripts to abstract sysadmin tasks and empower developers

  Development VMs with prod configuration to ensure consistency and avoid
  unexpected system-related bugs

  Continuous deployment to make it fast!
DevOps is spreading agility to the whole IT project lifecycle
Rapid and repeatable server setup
          Configuration management with Puppet
What is configuration management?

Writing the system configuration of your servers in files

Applying these files automatically

That's it!
Why do configuration management?

To do fast cluster deployment: who wants to manually setup 50 EC2 servers???

To do fast crash-recovery: configuration management is the best documentation
for a server's setup

To have consistent environments for development and production
Puppet or Chef
Configuration management tools

  Two popular recent tools for configuration management: Puppet and Chef

  A master server contains different "recipes" describing system configurations

  Client servers connect to the master server, read their recipe, and apply the
  configuration
Puppet
Puppet references
Let us create a Symfony-ready server with Puppet
          Introduction to Puppet manifests
class lighttpd
{
    package { "apache2.2-bin":
      ensure => absent,
    }
    package { "lighttpd":
      ensure => present,
    }
    service { "lighttpd":
      ensure => running,
      require => Package["lighttpd", "apache2.2-bin"],
    }

}
class lighttpd-phpmysql-fastcgi inherits lighttpd
{

    package { "php5-cgi":
      ensure => present,
    }

    package { "mysql-server":
      ensure => present,
    }

    exec { "lighttpd-enable-mod fastcgi":
      path    => "/usr/bin:/usr/sbin:/bin",
      creates => "/etc/lighttpd/conf-enabled/10-fastcgi.conf",
      require => Package["php5-cgi", "lighttpd"],
    }

}
class symfony-server inherits lighttpd-phpmysql-fastcgi
{

    package { ["php5-cli", "php5-sqlite"]:
      ensure => present,
      notify => Service["lighttpd"],
    }
    package { "git-core":
      ensure => present,
    }

    exec { "git clone git://github.com/symfony/symfony1.git":
      path    => "/usr/bin:/usr/sbin:/bin",
      cwd => "/var/www",
      creates => "/var/www/symfony1",
      require => Package["lighttpd", "git-core"],
    }

}
class symfony-live-server inherits symfony-server
{
    file { "/etc/lighttpd/conf-available/99-hosts.conf":
      source => "/vagrant/files/conf/hosts.conf",
      notify => Service["lighttpd"],
    }
    exec { "lighttpd-enable-mod hosts":
      path => "/usr/bin:/usr/sbin:/bin",
      creates => "/etc/lighttpd/conf-enabled/99-hosts.conf",
      require => File["/etc/lighttpd/conf-available/99-hosts.conf"],
      notify => Service["lighttpd"],
    }

}

include symfony-live-server
notice("Symfony server is going live!")
Why not use shell scripts?


Shell scripts are for administrators. Is all your team composed of admin experts?

Even for admin experts, Puppet and Chef recipes are more readable

Puppet and Chef make inheritance and modules easy

Puppet and Chef are idempotent: running them twice in a row will not break
your system
Develop and test on the same
environment as in production!
            VM provisioning with Vagrant
Develop on local Virtual Machines
Vagrant

  Vagrant is a tool to create local VirtualBox VMs, configured automatically by your
  Chef recipe or Puppet manifest

  It ensures you test on the same environment as your production server

  It is VERY easy
All you need is:
Vagrant



  A Puppet manifest

  A few system config files

  A Vagrant conf file
Demonstration
Vagrant


  $ git clone git://github.com/fabriceb/sflive2011vm.git .
  $ git clone git://github.com/fabriceb/sflive2011.git
  $ vagrant up


  http://127.0.0.1:2011/
Give developers the power to deploy
                       themselves
                       Scripted deployment
Deployment

Deployment is a very critical task usually done by admins

Remember Murphy's law: "If anything can go wrong, it will"

W hen things go wrong, most of the time developers have the solution

So give the developers the responsibility to deploy, rollback, correct and deploy
again!
Scripting deployment can be VERY easy
Simple Fabric script example
  # fabfile.py
  from fabric.api import *
  env.hosts = ['theodo@myserver.com']

  def deploy():
    with cd('/theodo/sflive2011'):
      run('git pull')
      run('./symfony doc:build --all --no-confirmation')
      run('./symfony cc')


  $ fab deploy
A good practise: scripting a rollback
Another Fabric example
  # fabfile.py
  def deploy():
    tag = "prod/%s" % strftime("%Y/%m-%d-%H-%M-%S")
    local('git tag -a %s -m "Prod"' % tag)
    local('git push --tags')
    with cd(path):
      run('git fetch')
      tag = run('git tag -l prod/* | sort | tail -n1')
      run('git checkout ' + tag)

  def rollback(num_revs=1):
    with cd(path):
      run('git fetch')
      tag = run('git tag -l prod/* | sort | tail -n' + 
            str(1 + int(num_revs)) + ' | head -n1')
      run('git checkout ' + tag)
And why not let Jenkins deploy
                      himself?
                Continuous deployment
The Holy Grail of Rapid App Development & Deployment:
           Automate everything low value-added




                        and relax
Isn't it dangerous to trust a machine?
Errare humanum est

  Of course you need continuous integration with MANY tests

  Of course you need some serious monitoring on the production server

  Of course you need some good rollback scripts

  But aren't that good things to do anyway ?

  Good continuous integration is more reliable than a human!
You need to separate dev, pre-prod and prod...
Continuous deployment howto
For example with git:

   features/* branches for small projects

   dev branch for merging team development

   master branch for production-ready code

   prod/* tags for production
And you need a deployment script + Jenkins
Continuous deployment howto

  Deployment script using Fabric (for example)

  Jenkins (formerly known as Hudson) to test and deploy
Create a new Jenkins project testing only branch master
Specify "Build other projects" in the post-build actions
Don't forget to activate Chuck Norris
Create a second Jenkins project to execute the deploy script
That's it!
Next step
Links

docs.puppetlabs.com

fabfile.org

vagrantup.com

github.com/fabriceb/sflive2011vm
DevOps meetups

groups.google.com/group/paris-devops

and many more devops meetups around the world
Many thanks to Samuel @smaftoul Maftoul, organiser of the
 Paris DevOps meetup, who bootstrapped me on DevOps!
Questions?



   @theodo
fabriceb@theodo.fr

More Related Content

What's hot

Juc boston2014.pptx
Juc boston2014.pptxJuc boston2014.pptx
Juc boston2014.pptx
Brandon Mueller
 
Writing Fast Code - PyCon HK 2015
Writing Fast Code - PyCon HK 2015Writing Fast Code - PyCon HK 2015
Writing Fast Code - PyCon HK 2015
Younggun Kim
 
Azure Functions
Azure FunctionsAzure Functions
Azure Functions
Rodolfo Finochietti
 
Vagrant, Ansible and Docker - How they fit together for productive flexible d...
Vagrant, Ansible and Docker - How they fit together for productive flexible d...Vagrant, Ansible and Docker - How they fit together for productive flexible d...
Vagrant, Ansible and Docker - How they fit together for productive flexible d...
Samuel Lampa
 
C#: Past, Present and Future
C#: Past, Present and FutureC#: Past, Present and Future
C#: Past, Present and Future
Rodolfo Finochietti
 
Webinar - Continuous Integration with GitLab
Webinar - Continuous Integration with GitLabWebinar - Continuous Integration with GitLab
Webinar - Continuous Integration with GitLab
OlinData
 
SciPipe - A light-weight workflow library inspired by flow-based programming
SciPipe - A light-weight workflow library inspired by flow-based programmingSciPipe - A light-weight workflow library inspired by flow-based programming
SciPipe - A light-weight workflow library inspired by flow-based programming
Samuel Lampa
 
[Container X mas Party with flexy] Machine Learning Lifecycle with Kubeflow o...
[Container X mas Party with flexy] Machine Learning Lifecycle with Kubeflow o...[Container X mas Party with flexy] Machine Learning Lifecycle with Kubeflow o...
[Container X mas Party with flexy] Machine Learning Lifecycle with Kubeflow o...
Naoki (Neo) SATO
 
Les nouveautés de C# 7
Les nouveautés de C# 7Les nouveautés de C# 7
Les nouveautés de C# 7
Microsoft
 
Common design patterns (migang 16 May 2012)
Common design patterns (migang 16 May 2012)Common design patterns (migang 16 May 2012)
Common design patterns (migang 16 May 2012)
Steven Smith
 
GitLab - Java User Group
GitLab - Java User GroupGitLab - Java User Group
GitLab - Java User Group
PhilippWestphalen
 
Building a high-performance, scalable ML & NLP platform with Python, Sheer El...
Building a high-performance, scalable ML & NLP platform with Python, Sheer El...Building a high-performance, scalable ML & NLP platform with Python, Sheer El...
Building a high-performance, scalable ML & NLP platform with Python, Sheer El...
Pôle Systematic Paris-Region
 
Is Python still production ready ? Ludovic Gasc
Is Python still production ready ? Ludovic GascIs Python still production ready ? Ludovic Gasc
Is Python still production ready ? Ludovic Gasc
Pôle Systematic Paris-Region
 
From Python to smartphones: neural nets @ Saint-Gobain, François Sausset
From Python to smartphones: neural nets @ Saint-Gobain, François SaussetFrom Python to smartphones: neural nets @ Saint-Gobain, François Sausset
From Python to smartphones: neural nets @ Saint-Gobain, François Sausset
Pôle Systematic Paris-Region
 
Front-end development automation with Grunt
Front-end development automation with GruntFront-end development automation with Grunt
Front-end development automation with Grunt
benko
 
20151117 IoT를 위한 서비스 구성과 개발
20151117 IoT를 위한 서비스 구성과 개발20151117 IoT를 위한 서비스 구성과 개발
20151117 IoT를 위한 서비스 구성과 개발
영욱 김
 
Ondřej Procházka - Deployment podle Devel.cz
Ondřej Procházka - Deployment podle Devel.czOndřej Procházka - Deployment podle Devel.cz
Ondřej Procházka - Deployment podle Devel.cz
Develcz
 
How to rewrite the OS using C by strong type
How to rewrite the OS using C by strong typeHow to rewrite the OS using C by strong type
How to rewrite the OS using C by strong type
Kiwamu Okabe
 
Wonders of Golang
Wonders of GolangWonders of Golang
Wonders of Golang
Kartik Sura
 
Beachhead implements new opcode on CLR JIT
Beachhead implements new opcode on CLR JITBeachhead implements new opcode on CLR JIT
Beachhead implements new opcode on CLR JIT
Kouji Matsui
 

What's hot (20)

Juc boston2014.pptx
Juc boston2014.pptxJuc boston2014.pptx
Juc boston2014.pptx
 
Writing Fast Code - PyCon HK 2015
Writing Fast Code - PyCon HK 2015Writing Fast Code - PyCon HK 2015
Writing Fast Code - PyCon HK 2015
 
Azure Functions
Azure FunctionsAzure Functions
Azure Functions
 
Vagrant, Ansible and Docker - How they fit together for productive flexible d...
Vagrant, Ansible and Docker - How they fit together for productive flexible d...Vagrant, Ansible and Docker - How they fit together for productive flexible d...
Vagrant, Ansible and Docker - How they fit together for productive flexible d...
 
C#: Past, Present and Future
C#: Past, Present and FutureC#: Past, Present and Future
C#: Past, Present and Future
 
Webinar - Continuous Integration with GitLab
Webinar - Continuous Integration with GitLabWebinar - Continuous Integration with GitLab
Webinar - Continuous Integration with GitLab
 
SciPipe - A light-weight workflow library inspired by flow-based programming
SciPipe - A light-weight workflow library inspired by flow-based programmingSciPipe - A light-weight workflow library inspired by flow-based programming
SciPipe - A light-weight workflow library inspired by flow-based programming
 
[Container X mas Party with flexy] Machine Learning Lifecycle with Kubeflow o...
[Container X mas Party with flexy] Machine Learning Lifecycle with Kubeflow o...[Container X mas Party with flexy] Machine Learning Lifecycle with Kubeflow o...
[Container X mas Party with flexy] Machine Learning Lifecycle with Kubeflow o...
 
Les nouveautés de C# 7
Les nouveautés de C# 7Les nouveautés de C# 7
Les nouveautés de C# 7
 
Common design patterns (migang 16 May 2012)
Common design patterns (migang 16 May 2012)Common design patterns (migang 16 May 2012)
Common design patterns (migang 16 May 2012)
 
GitLab - Java User Group
GitLab - Java User GroupGitLab - Java User Group
GitLab - Java User Group
 
Building a high-performance, scalable ML & NLP platform with Python, Sheer El...
Building a high-performance, scalable ML & NLP platform with Python, Sheer El...Building a high-performance, scalable ML & NLP platform with Python, Sheer El...
Building a high-performance, scalable ML & NLP platform with Python, Sheer El...
 
Is Python still production ready ? Ludovic Gasc
Is Python still production ready ? Ludovic GascIs Python still production ready ? Ludovic Gasc
Is Python still production ready ? Ludovic Gasc
 
From Python to smartphones: neural nets @ Saint-Gobain, François Sausset
From Python to smartphones: neural nets @ Saint-Gobain, François SaussetFrom Python to smartphones: neural nets @ Saint-Gobain, François Sausset
From Python to smartphones: neural nets @ Saint-Gobain, François Sausset
 
Front-end development automation with Grunt
Front-end development automation with GruntFront-end development automation with Grunt
Front-end development automation with Grunt
 
20151117 IoT를 위한 서비스 구성과 개발
20151117 IoT를 위한 서비스 구성과 개발20151117 IoT를 위한 서비스 구성과 개발
20151117 IoT를 위한 서비스 구성과 개발
 
Ondřej Procházka - Deployment podle Devel.cz
Ondřej Procházka - Deployment podle Devel.czOndřej Procházka - Deployment podle Devel.cz
Ondřej Procházka - Deployment podle Devel.cz
 
How to rewrite the OS using C by strong type
How to rewrite the OS using C by strong typeHow to rewrite the OS using C by strong type
How to rewrite the OS using C by strong type
 
Wonders of Golang
Wonders of GolangWonders of Golang
Wonders of Golang
 
Beachhead implements new opcode on CLR JIT
Beachhead implements new opcode on CLR JITBeachhead implements new opcode on CLR JIT
Beachhead implements new opcode on CLR JIT
 

Similar to Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)

A Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy SystemA Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy System
adrian_nye
 
DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)
Soshi Nemoto
 
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
biicode
 
The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer Toolbox
Pablo Godel
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
Pablo Godel
 
From Code to Cloud - PHP on Red Hat's OpenShift
From Code to Cloud - PHP on Red Hat's OpenShiftFrom Code to Cloud - PHP on Red Hat's OpenShift
From Code to Cloud - PHP on Red Hat's OpenShift
Eric D. Schabell
 
Deployment Tactics
Deployment TacticsDeployment Tactics
Deployment Tactics
Ian Barber
 
Comment améliorer le quotidien des Développeurs PHP ?
Comment améliorer le quotidien des Développeurs PHP ?Comment améliorer le quotidien des Développeurs PHP ?
Comment améliorer le quotidien des Développeurs PHP ?
AFUP_Limoges
 
Developing and Deploying PHP with Docker
Developing and Deploying PHP with DockerDeveloping and Deploying PHP with Docker
Developing and Deploying PHP with Docker
Patrick Mizer
 
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Bastian Feder
 
Continuous Integration & Development with Gitlab
Continuous Integration & Development with GitlabContinuous Integration & Development with Gitlab
Continuous Integration & Development with Gitlab
Ayush Sharma
 
All the Laravel things: up and running to making $$
All the Laravel things: up and running to making $$All the Laravel things: up and running to making $$
All the Laravel things: up and running to making $$
Joe Ferguson
 
Release with confidence
Release with confidenceRelease with confidence
Release with confidence
John Congdon
 
PHP on Heroku: Deploying and Scaling Apps in the Cloud
PHP on Heroku: Deploying and Scaling Apps in the CloudPHP on Heroku: Deploying and Scaling Apps in the Cloud
PHP on Heroku: Deploying and Scaling Apps in the Cloud
Salesforce Developers
 
TIAD - DYI: A simple orchestrator built step by step
TIAD - DYI: A simple orchestrator built step by stepTIAD - DYI: A simple orchestrator built step by step
TIAD - DYI: A simple orchestrator built step by step
The Incredible Automation Day
 
Fullstack workshop
Fullstack workshopFullstack workshop
Fullstack workshop
Assaf Gannon
 
Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024
Henry Schreiner
 
Virtualize and automate your development environment for fun and profit
Virtualize and automate your development environment for fun and profitVirtualize and automate your development environment for fun and profit
Virtualize and automate your development environment for fun and profit
Andreas Heim
 
Improve your Java Environment with Docker
Improve your Java Environment with DockerImprove your Java Environment with Docker
Improve your Java Environment with Docker
HanoiJUG
 
Lean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushLean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and Drush
Pantheon
 

Similar to Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011) (20)

A Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy SystemA Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy System
 
DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)
 
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
 
The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer Toolbox
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
 
From Code to Cloud - PHP on Red Hat's OpenShift
From Code to Cloud - PHP on Red Hat's OpenShiftFrom Code to Cloud - PHP on Red Hat's OpenShift
From Code to Cloud - PHP on Red Hat's OpenShift
 
Deployment Tactics
Deployment TacticsDeployment Tactics
Deployment Tactics
 
Comment améliorer le quotidien des Développeurs PHP ?
Comment améliorer le quotidien des Développeurs PHP ?Comment améliorer le quotidien des Développeurs PHP ?
Comment améliorer le quotidien des Développeurs PHP ?
 
Developing and Deploying PHP with Docker
Developing and Deploying PHP with DockerDeveloping and Deploying PHP with Docker
Developing and Deploying PHP with Docker
 
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
 
Continuous Integration & Development with Gitlab
Continuous Integration & Development with GitlabContinuous Integration & Development with Gitlab
Continuous Integration & Development with Gitlab
 
All the Laravel things: up and running to making $$
All the Laravel things: up and running to making $$All the Laravel things: up and running to making $$
All the Laravel things: up and running to making $$
 
Release with confidence
Release with confidenceRelease with confidence
Release with confidence
 
PHP on Heroku: Deploying and Scaling Apps in the Cloud
PHP on Heroku: Deploying and Scaling Apps in the CloudPHP on Heroku: Deploying and Scaling Apps in the Cloud
PHP on Heroku: Deploying and Scaling Apps in the Cloud
 
TIAD - DYI: A simple orchestrator built step by step
TIAD - DYI: A simple orchestrator built step by stepTIAD - DYI: A simple orchestrator built step by step
TIAD - DYI: A simple orchestrator built step by step
 
Fullstack workshop
Fullstack workshopFullstack workshop
Fullstack workshop
 
Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024
 
Virtualize and automate your development environment for fun and profit
Virtualize and automate your development environment for fun and profitVirtualize and automate your development environment for fun and profit
Virtualize and automate your development environment for fun and profit
 
Improve your Java Environment with Docker
Improve your Java Environment with DockerImprove your Java Environment with Docker
Improve your Java Environment with Docker
 
Lean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushLean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and Drush
 

More from Fabrice Bernhard

Scale quality with kaizen - Tech.Rocks conference
Scale quality with kaizen - Tech.Rocks conferenceScale quality with kaizen - Tech.Rocks conference
Scale quality with kaizen - Tech.Rocks conference
Fabrice Bernhard
 
With Great Power comes Great Responsibilities
With Great Power comes Great ResponsibilitiesWith Great Power comes Great Responsibilities
With Great Power comes Great Responsibilities
Fabrice Bernhard
 
Integrating Drupal 8 into Symfony 2
Integrating Drupal 8 into Symfony 2Integrating Drupal 8 into Symfony 2
Integrating Drupal 8 into Symfony 2
Fabrice Bernhard
 
Modernisation of legacy PHP applications using Symfony2 - PHP Northeast Confe...
Modernisation of legacy PHP applications using Symfony2 - PHP Northeast Confe...Modernisation of legacy PHP applications using Symfony2 - PHP Northeast Confe...
Modernisation of legacy PHP applications using Symfony2 - PHP Northeast Confe...
Fabrice Bernhard
 
Modernisation of Legacy PHP Applications to Symfony2 - Symfony Live Berlin 2012
Modernisation of Legacy PHP Applications to Symfony2 - Symfony Live Berlin 2012Modernisation of Legacy PHP Applications to Symfony2 - Symfony Live Berlin 2012
Modernisation of Legacy PHP Applications to Symfony2 - Symfony Live Berlin 2012
Fabrice Bernhard
 
Modernisation of legacy php to Symfony 2
Modernisation of legacy php to Symfony 2Modernisation of legacy php to Symfony 2
Modernisation of legacy php to Symfony 2
Fabrice Bernhard
 

More from Fabrice Bernhard (6)

Scale quality with kaizen - Tech.Rocks conference
Scale quality with kaizen - Tech.Rocks conferenceScale quality with kaizen - Tech.Rocks conference
Scale quality with kaizen - Tech.Rocks conference
 
With Great Power comes Great Responsibilities
With Great Power comes Great ResponsibilitiesWith Great Power comes Great Responsibilities
With Great Power comes Great Responsibilities
 
Integrating Drupal 8 into Symfony 2
Integrating Drupal 8 into Symfony 2Integrating Drupal 8 into Symfony 2
Integrating Drupal 8 into Symfony 2
 
Modernisation of legacy PHP applications using Symfony2 - PHP Northeast Confe...
Modernisation of legacy PHP applications using Symfony2 - PHP Northeast Confe...Modernisation of legacy PHP applications using Symfony2 - PHP Northeast Confe...
Modernisation of legacy PHP applications using Symfony2 - PHP Northeast Confe...
 
Modernisation of Legacy PHP Applications to Symfony2 - Symfony Live Berlin 2012
Modernisation of Legacy PHP Applications to Symfony2 - Symfony Live Berlin 2012Modernisation of Legacy PHP Applications to Symfony2 - Symfony Live Berlin 2012
Modernisation of Legacy PHP Applications to Symfony2 - Symfony Live Berlin 2012
 
Modernisation of legacy php to Symfony 2
Modernisation of legacy php to Symfony 2Modernisation of legacy php to Symfony 2
Modernisation of legacy php to Symfony 2
 

Recently uploaded

Sermon on the Mount: Part 8 - A Costly Interruption: Blessed are the Peacemakers
Sermon on the Mount: Part 8 - A Costly Interruption: Blessed are the PeacemakersSermon on the Mount: Part 8 - A Costly Interruption: Blessed are the Peacemakers
Sermon on the Mount: Part 8 - A Costly Interruption: Blessed are the Peacemakers
Vintage Church
 
Kanpur Girls Call Kanpur 0X0000000X Unlimited Short Providing Girls Service A...
Kanpur Girls Call Kanpur 0X0000000X Unlimited Short Providing Girls Service A...Kanpur Girls Call Kanpur 0X0000000X Unlimited Short Providing Girls Service A...
Kanpur Girls Call Kanpur 0X0000000X Unlimited Short Providing Girls Service A...
rachitkumar09887
 
English - The Power of the Little Tongue.pdf
English - The Power of the Little Tongue.pdfEnglish - The Power of the Little Tongue.pdf
English - The Power of the Little Tongue.pdf
Filipino Tracts and Literature Society Inc.
 
Kochi Girls Call Kochi 0X0000000X Unlimited Short Providing Girls Service Ava...
Kochi Girls Call Kochi 0X0000000X Unlimited Short Providing Girls Service Ava...Kochi Girls Call Kochi 0X0000000X Unlimited Short Providing Girls Service Ava...
Kochi Girls Call Kochi 0X0000000X Unlimited Short Providing Girls Service Ava...
rachitkumar09887
 
❤Powerful Love Spells in Phoenix, AZ 📱 1(973) _384_3997 ✔️
❤Powerful Love Spells in Phoenix, AZ 📱 1(973) _384_3997  ✔️❤Powerful Love Spells in Phoenix, AZ 📱 1(973) _384_3997  ✔️
❤Powerful Love Spells in Phoenix, AZ 📱 1(973) _384_3997 ✔️
Khan Spells
 
THERE IS ALWAYS A BETTER WAY BY Alfayo Elias
THERE IS ALWAYS A BETTER WAY BY Alfayo EliasTHERE IS ALWAYS A BETTER WAY BY Alfayo Elias
THERE IS ALWAYS A BETTER WAY BY Alfayo Elias
ELIASOUMA
 
Kaia Ra Oracle - A Radiant Beacon
Kaia  Ra  Oracle  -  A  Radiant   BeaconKaia  Ra  Oracle  -  A  Radiant   Beacon
Kaia Ra Oracle - A Radiant Beacon
KaiaRaOracle
 
Lesson 1 Two Important Women in the History of a People.pptx
Lesson 1 Two Important Women in the History of a People.pptxLesson 1 Two Important Women in the History of a People.pptx
Lesson 1 Two Important Women in the History of a People.pptx
Celso Napoleon
 
23Harley Davidson Bikes Price List in India - Overdrive
23Harley Davidson Bikes Price List in India - Overdrive23Harley Davidson Bikes Price List in India - Overdrive
23Harley Davidson Bikes Price List in India - Overdrive
renurana38
 
Monthly Khazina-e-Ruhaniyaat Jun’2024 (Vol.15, Issue 3)
Monthly Khazina-e-Ruhaniyaat Jun’2024 (Vol.15, Issue 3)Monthly Khazina-e-Ruhaniyaat Jun’2024 (Vol.15, Issue 3)
Monthly Khazina-e-Ruhaniyaat Jun’2024 (Vol.15, Issue 3)
Darul Amal Chishtia
 
The Ultimate Guide to Spiritual Items.pdf
The Ultimate Guide to Spiritual Items.pdfThe Ultimate Guide to Spiritual Items.pdf
The Ultimate Guide to Spiritual Items.pdf
Babalaje Food
 
Deerfoot Church of Christ Bulletin 7 14 24
Deerfoot Church of Christ Bulletin 7 14 24Deerfoot Church of Christ Bulletin 7 14 24
Deerfoot Church of Christ Bulletin 7 14 24
deerfootcoc
 
Art Of War Mahabharat the never ending war.pdf
Art Of War Mahabharat the never ending war.pdfArt Of War Mahabharat the never ending war.pdf
Art Of War Mahabharat the never ending war.pdf
georgerikuasa
 
Story of Buddha Gautama ~ A Free Full-Color eBook (Eng. & Chi.).pdf
Story of Buddha Gautama ~ A Free Full-Color eBook (Eng. & Chi.).pdfStory of Buddha Gautama ~ A Free Full-Color eBook (Eng. & Chi.).pdf
Story of Buddha Gautama ~ A Free Full-Color eBook (Eng. & Chi.).pdf
OH TEIK BIN
 
Girls Call Juhu 9967584737 Provide Best And Top Girl Service And No1 in City
Girls Call Juhu 9967584737 Provide Best And Top Girl Service And No1 in CityGirls Call Juhu 9967584737 Provide Best And Top Girl Service And No1 in City
Girls Call Juhu 9967584737 Provide Best And Top Girl Service And No1 in City
Naicy mandal
 
8Electric Love 2024 – Electronic Music Festival – New Era
8Electric Love 2024 – Electronic Music Festival – New Era8Electric Love 2024 – Electronic Music Festival – New Era
8Electric Love 2024 – Electronic Music Festival – New Era
aryansarma368
 
High Girls Call Coimbatore 000XX00000 Provide Best And Top Girl Service And N...
High Girls Call Coimbatore 000XX00000 Provide Best And Top Girl Service And N...High Girls Call Coimbatore 000XX00000 Provide Best And Top Girl Service And N...
High Girls Call Coimbatore 000XX00000 Provide Best And Top Girl Service And N...
singhlata50dh
 
The_Chronological_Life_of_Christ_Part_108_Divine_Delay
The_Chronological_Life_of_Christ_Part_108_Divine_DelayThe_Chronological_Life_of_Christ_Part_108_Divine_Delay
The_Chronological_Life_of_Christ_Part_108_Divine_Delay
Network Bible Fellowship
 
Sermon on the Mount: Part 7 - A Costly Interruption: Blessed are the Poor in ...
Sermon on the Mount: Part 7 - A Costly Interruption: Blessed are the Poor in ...Sermon on the Mount: Part 7 - A Costly Interruption: Blessed are the Poor in ...
Sermon on the Mount: Part 7 - A Costly Interruption: Blessed are the Poor in ...
Vintage Church
 
SUNY-Bin degree offer diploma Transcript
SUNY-Bin degree offer diploma TranscriptSUNY-Bin degree offer diploma Transcript
SUNY-Bin degree offer diploma Transcript
azeyhun
 

Recently uploaded (20)

Sermon on the Mount: Part 8 - A Costly Interruption: Blessed are the Peacemakers
Sermon on the Mount: Part 8 - A Costly Interruption: Blessed are the PeacemakersSermon on the Mount: Part 8 - A Costly Interruption: Blessed are the Peacemakers
Sermon on the Mount: Part 8 - A Costly Interruption: Blessed are the Peacemakers
 
Kanpur Girls Call Kanpur 0X0000000X Unlimited Short Providing Girls Service A...
Kanpur Girls Call Kanpur 0X0000000X Unlimited Short Providing Girls Service A...Kanpur Girls Call Kanpur 0X0000000X Unlimited Short Providing Girls Service A...
Kanpur Girls Call Kanpur 0X0000000X Unlimited Short Providing Girls Service A...
 
English - The Power of the Little Tongue.pdf
English - The Power of the Little Tongue.pdfEnglish - The Power of the Little Tongue.pdf
English - The Power of the Little Tongue.pdf
 
Kochi Girls Call Kochi 0X0000000X Unlimited Short Providing Girls Service Ava...
Kochi Girls Call Kochi 0X0000000X Unlimited Short Providing Girls Service Ava...Kochi Girls Call Kochi 0X0000000X Unlimited Short Providing Girls Service Ava...
Kochi Girls Call Kochi 0X0000000X Unlimited Short Providing Girls Service Ava...
 
❤Powerful Love Spells in Phoenix, AZ 📱 1(973) _384_3997 ✔️
❤Powerful Love Spells in Phoenix, AZ 📱 1(973) _384_3997  ✔️❤Powerful Love Spells in Phoenix, AZ 📱 1(973) _384_3997  ✔️
❤Powerful Love Spells in Phoenix, AZ 📱 1(973) _384_3997 ✔️
 
THERE IS ALWAYS A BETTER WAY BY Alfayo Elias
THERE IS ALWAYS A BETTER WAY BY Alfayo EliasTHERE IS ALWAYS A BETTER WAY BY Alfayo Elias
THERE IS ALWAYS A BETTER WAY BY Alfayo Elias
 
Kaia Ra Oracle - A Radiant Beacon
Kaia  Ra  Oracle  -  A  Radiant   BeaconKaia  Ra  Oracle  -  A  Radiant   Beacon
Kaia Ra Oracle - A Radiant Beacon
 
Lesson 1 Two Important Women in the History of a People.pptx
Lesson 1 Two Important Women in the History of a People.pptxLesson 1 Two Important Women in the History of a People.pptx
Lesson 1 Two Important Women in the History of a People.pptx
 
23Harley Davidson Bikes Price List in India - Overdrive
23Harley Davidson Bikes Price List in India - Overdrive23Harley Davidson Bikes Price List in India - Overdrive
23Harley Davidson Bikes Price List in India - Overdrive
 
Monthly Khazina-e-Ruhaniyaat Jun’2024 (Vol.15, Issue 3)
Monthly Khazina-e-Ruhaniyaat Jun’2024 (Vol.15, Issue 3)Monthly Khazina-e-Ruhaniyaat Jun’2024 (Vol.15, Issue 3)
Monthly Khazina-e-Ruhaniyaat Jun’2024 (Vol.15, Issue 3)
 
The Ultimate Guide to Spiritual Items.pdf
The Ultimate Guide to Spiritual Items.pdfThe Ultimate Guide to Spiritual Items.pdf
The Ultimate Guide to Spiritual Items.pdf
 
Deerfoot Church of Christ Bulletin 7 14 24
Deerfoot Church of Christ Bulletin 7 14 24Deerfoot Church of Christ Bulletin 7 14 24
Deerfoot Church of Christ Bulletin 7 14 24
 
Art Of War Mahabharat the never ending war.pdf
Art Of War Mahabharat the never ending war.pdfArt Of War Mahabharat the never ending war.pdf
Art Of War Mahabharat the never ending war.pdf
 
Story of Buddha Gautama ~ A Free Full-Color eBook (Eng. & Chi.).pdf
Story of Buddha Gautama ~ A Free Full-Color eBook (Eng. & Chi.).pdfStory of Buddha Gautama ~ A Free Full-Color eBook (Eng. & Chi.).pdf
Story of Buddha Gautama ~ A Free Full-Color eBook (Eng. & Chi.).pdf
 
Girls Call Juhu 9967584737 Provide Best And Top Girl Service And No1 in City
Girls Call Juhu 9967584737 Provide Best And Top Girl Service And No1 in CityGirls Call Juhu 9967584737 Provide Best And Top Girl Service And No1 in City
Girls Call Juhu 9967584737 Provide Best And Top Girl Service And No1 in City
 
8Electric Love 2024 – Electronic Music Festival – New Era
8Electric Love 2024 – Electronic Music Festival – New Era8Electric Love 2024 – Electronic Music Festival – New Era
8Electric Love 2024 – Electronic Music Festival – New Era
 
High Girls Call Coimbatore 000XX00000 Provide Best And Top Girl Service And N...
High Girls Call Coimbatore 000XX00000 Provide Best And Top Girl Service And N...High Girls Call Coimbatore 000XX00000 Provide Best And Top Girl Service And N...
High Girls Call Coimbatore 000XX00000 Provide Best And Top Girl Service And N...
 
The_Chronological_Life_of_Christ_Part_108_Divine_Delay
The_Chronological_Life_of_Christ_Part_108_Divine_DelayThe_Chronological_Life_of_Christ_Part_108_Divine_Delay
The_Chronological_Life_of_Christ_Part_108_Divine_Delay
 
Sermon on the Mount: Part 7 - A Costly Interruption: Blessed are the Poor in ...
Sermon on the Mount: Part 7 - A Costly Interruption: Blessed are the Poor in ...Sermon on the Mount: Part 7 - A Costly Interruption: Blessed are the Poor in ...
Sermon on the Mount: Part 7 - A Costly Interruption: Blessed are the Poor in ...
 
SUNY-Bin degree offer diploma Transcript
SUNY-Bin degree offer diploma TranscriptSUNY-Bin degree offer diploma Transcript
SUNY-Bin degree offer diploma Transcript
 

Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)

  • 1. Adopt Devops philosophy on your Symfony projects An introduction to Devops by Fabrice Bernhard
  • 4. Co-founder / CTO of Theodo and Allomatch.com
  • 5. Theodo creates web-based applications with open-source web technologies, agile methodologies and the highest standards of quality to guarantee rapid application development, risk-free deployment and easy maintenance for every client.
  • 6. @skoop: Now, let's look for a bar in Paris where I could watch the FC Utrecht match :)
  • 7. Allomatch.com is the website for watching sports in bars in France and Spain (sportandbar.es) Allomatch is used by 500 barmen (clients) and visited by more than 200,000 unique visitors per month Peaks on the biggest days can go up to 20,000 people in the 2 hours preceding the game Allomatch.com is hosted on a cluster of 6 servers
  • 8. What is DevOps? Introduction
  • 9. How many here consider themselves SysAdmins?
  • 10. How many here have never deployed an application on a server?
  • 11. Wikipedia Definition of DevOps DevOps is a set of processes, methods and systems for communication, collaboration and integration between departments for Development (Applications/Software Engineering), Technology Operations and Quality Assurance (QA). It relates to the emerging understanding of the interdependence of development and operations in meeting a business' goal to producing timely software products and services
  • 12. The fundamental DevOps contradiction Devs VS Ops Developers are asked to deliver new value, often and fast Operations people are asked to protect the current value Pro-Change VS Pro-Stability
  • 13. Silos
  • 16. DevOps create the infrastructure that empower devs from the first line of code to the delivery How to be DevOps? Configuration management for rapid, repeatable server setup Deployment scripts to abstract sysadmin tasks and empower developers Development VMs with prod configuration to ensure consistency and avoid unexpected system-related bugs Continuous deployment to make it fast!
  • 17. DevOps is spreading agility to the whole IT project lifecycle
  • 18. Rapid and repeatable server setup Configuration management with Puppet
  • 19. What is configuration management? Writing the system configuration of your servers in files Applying these files automatically That's it!
  • 20. Why do configuration management? To do fast cluster deployment: who wants to manually setup 50 EC2 servers??? To do fast crash-recovery: configuration management is the best documentation for a server's setup To have consistent environments for development and production
  • 21. Puppet or Chef Configuration management tools Two popular recent tools for configuration management: Puppet and Chef A master server contains different "recipes" describing system configurations Client servers connect to the master server, read their recipe, and apply the configuration
  • 24. Let us create a Symfony-ready server with Puppet Introduction to Puppet manifests
  • 25. class lighttpd { package { "apache2.2-bin": ensure => absent, } package { "lighttpd": ensure => present, } service { "lighttpd": ensure => running, require => Package["lighttpd", "apache2.2-bin"], } }
  • 26. class lighttpd-phpmysql-fastcgi inherits lighttpd { package { "php5-cgi": ensure => present, } package { "mysql-server": ensure => present, } exec { "lighttpd-enable-mod fastcgi": path => "/usr/bin:/usr/sbin:/bin", creates => "/etc/lighttpd/conf-enabled/10-fastcgi.conf", require => Package["php5-cgi", "lighttpd"], } }
  • 27. class symfony-server inherits lighttpd-phpmysql-fastcgi { package { ["php5-cli", "php5-sqlite"]: ensure => present, notify => Service["lighttpd"], } package { "git-core": ensure => present, } exec { "git clone git://github.com/symfony/symfony1.git": path => "/usr/bin:/usr/sbin:/bin", cwd => "/var/www", creates => "/var/www/symfony1", require => Package["lighttpd", "git-core"], } }
  • 28. class symfony-live-server inherits symfony-server { file { "/etc/lighttpd/conf-available/99-hosts.conf": source => "/vagrant/files/conf/hosts.conf", notify => Service["lighttpd"], } exec { "lighttpd-enable-mod hosts": path => "/usr/bin:/usr/sbin:/bin", creates => "/etc/lighttpd/conf-enabled/99-hosts.conf", require => File["/etc/lighttpd/conf-available/99-hosts.conf"], notify => Service["lighttpd"], } } include symfony-live-server notice("Symfony server is going live!")
  • 29. Why not use shell scripts? Shell scripts are for administrators. Is all your team composed of admin experts? Even for admin experts, Puppet and Chef recipes are more readable Puppet and Chef make inheritance and modules easy Puppet and Chef are idempotent: running them twice in a row will not break your system
  • 30. Develop and test on the same environment as in production! VM provisioning with Vagrant
  • 31. Develop on local Virtual Machines Vagrant Vagrant is a tool to create local VirtualBox VMs, configured automatically by your Chef recipe or Puppet manifest It ensures you test on the same environment as your production server It is VERY easy
  • 32. All you need is: Vagrant A Puppet manifest A few system config files A Vagrant conf file
  • 33. Demonstration Vagrant $ git clone git://github.com/fabriceb/sflive2011vm.git . $ git clone git://github.com/fabriceb/sflive2011.git $ vagrant up http://127.0.0.1:2011/
  • 34. Give developers the power to deploy themselves Scripted deployment
  • 35. Deployment Deployment is a very critical task usually done by admins Remember Murphy's law: "If anything can go wrong, it will" W hen things go wrong, most of the time developers have the solution So give the developers the responsibility to deploy, rollback, correct and deploy again!
  • 36. Scripting deployment can be VERY easy Simple Fabric script example # fabfile.py from fabric.api import * env.hosts = ['theodo@myserver.com'] def deploy(): with cd('/theodo/sflive2011'): run('git pull') run('./symfony doc:build --all --no-confirmation') run('./symfony cc') $ fab deploy
  • 37. A good practise: scripting a rollback Another Fabric example # fabfile.py def deploy(): tag = "prod/%s" % strftime("%Y/%m-%d-%H-%M-%S") local('git tag -a %s -m "Prod"' % tag) local('git push --tags') with cd(path): run('git fetch') tag = run('git tag -l prod/* | sort | tail -n1') run('git checkout ' + tag) def rollback(num_revs=1): with cd(path): run('git fetch') tag = run('git tag -l prod/* | sort | tail -n' + str(1 + int(num_revs)) + ' | head -n1') run('git checkout ' + tag)
  • 38. And why not let Jenkins deploy himself? Continuous deployment
  • 39. The Holy Grail of Rapid App Development & Deployment: Automate everything low value-added and relax
  • 40. Isn't it dangerous to trust a machine? Errare humanum est Of course you need continuous integration with MANY tests Of course you need some serious monitoring on the production server Of course you need some good rollback scripts But aren't that good things to do anyway ? Good continuous integration is more reliable than a human!
  • 41. You need to separate dev, pre-prod and prod... Continuous deployment howto For example with git: features/* branches for small projects dev branch for merging team development master branch for production-ready code prod/* tags for production
  • 42. And you need a deployment script + Jenkins Continuous deployment howto Deployment script using Fabric (for example) Jenkins (formerly known as Hudson) to test and deploy
  • 43. Create a new Jenkins project testing only branch master
  • 44. Specify "Build other projects" in the post-build actions
  • 45. Don't forget to activate Chuck Norris
  • 46. Create a second Jenkins project to execute the deploy script
  • 50. DevOps meetups groups.google.com/group/paris-devops and many more devops meetups around the world
  • 51. Many thanks to Samuel @smaftoul Maftoul, organiser of the Paris DevOps meetup, who bootstrapped me on DevOps!
  • 52. Questions? @theodo fabriceb@theodo.fr