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

Fabrice Bernhard
Fabrice BernhardCTO at Theodo
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
1 of 52

Recommended

Pulumi. Modern Infrastructure as Code. by
Pulumi. Modern Infrastructure as Code.Pulumi. Modern Infrastructure as Code.
Pulumi. Modern Infrastructure as Code.Yurii Bychenok
696 views16 slides
Infrastructure-as-Code with Pulumi - Better than all the others (like Ansible)? by
Infrastructure-as-Code with Pulumi- Better than all the others (like Ansible)?Infrastructure-as-Code with Pulumi- Better than all the others (like Ansible)?
Infrastructure-as-Code with Pulumi - Better than all the others (like Ansible)?Jonas Hecht
1.8K views65 slides
Infrastructure as "Code" with Pulumi by
Infrastructure as "Code" with PulumiInfrastructure as "Code" with Pulumi
Infrastructure as "Code" with PulumiVenura Athukorala
231 views12 slides
Infrastructure as (real) Code – Manage your K8s resources with Pulumi by
Infrastructure as (real) Code – Manage your K8s resources with PulumiInfrastructure as (real) Code – Manage your K8s resources with Pulumi
Infrastructure as (real) Code – Manage your K8s resources with Pulumiinovex GmbH
280 views18 slides
平行化你的工作 part1 by
平行化你的工作 part1平行化你的工作 part1
平行化你的工作 part1Shuen-Huei Guan
1.1K views25 slides
Ways to generate PDF from Python Web applications, Gaël Le Mignot by
Ways to generate PDF from Python Web applications, Gaël Le MignotWays to generate PDF from Python Web applications, Gaël Le Mignot
Ways to generate PDF from Python Web applications, Gaël Le MignotPôle Systematic Paris-Region
1.7K views21 slides

More Related Content

What's hot

Juc boston2014.pptx by
Juc boston2014.pptxJuc boston2014.pptx
Juc boston2014.pptxBrandon Mueller
3.2K views43 slides
Writing Fast Code - PyCon HK 2015 by
Writing Fast Code - PyCon HK 2015Writing Fast Code - PyCon HK 2015
Writing Fast Code - PyCon HK 2015Younggun Kim
605 views79 slides
Azure Functions by
Azure FunctionsAzure Functions
Azure FunctionsRodolfo Finochietti
4.8K views25 slides
Vagrant, Ansible and Docker - How they fit together for productive flexible d... by
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
1.3K views15 slides
C#: Past, Present and Future by
C#: Past, Present and FutureC#: Past, Present and Future
C#: Past, Present and FutureRodolfo Finochietti
5.3K views54 slides
Webinar - Continuous Integration with GitLab by
Webinar - Continuous Integration with GitLabWebinar - Continuous Integration with GitLab
Webinar - Continuous Integration with GitLabOlinData
1.1K views16 slides

What's hot(20)

Writing Fast Code - PyCon HK 2015 by Younggun Kim
Writing Fast Code - PyCon HK 2015Writing Fast Code - PyCon HK 2015
Writing Fast Code - PyCon HK 2015
Younggun Kim605 views
Vagrant, Ansible and Docker - How they fit together for productive flexible d... by Samuel Lampa
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 Lampa1.3K views
Webinar - Continuous Integration with GitLab by OlinData
Webinar - Continuous Integration with GitLabWebinar - Continuous Integration with GitLab
Webinar - Continuous Integration with GitLab
OlinData1.1K views
SciPipe - A light-weight workflow library inspired by flow-based programming by Samuel Lampa
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 Lampa1.4K views
[Container X mas Party with flexy] Machine Learning Lifecycle with Kubeflow o... by Naoki (Neo) SATO
[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) SATO2.1K views
Les nouveautés de C# 7 by Microsoft
Les nouveautés de C# 7Les nouveautés de C# 7
Les nouveautés de C# 7
Microsoft737 views
Common design patterns (migang 16 May 2012) by Steven Smith
Common design patterns (migang 16 May 2012)Common design patterns (migang 16 May 2012)
Common design patterns (migang 16 May 2012)
Steven Smith1.4K views
Front-end development automation with Grunt by benko
Front-end development automation with GruntFront-end development automation with Grunt
Front-end development automation with Grunt
benko5.2K views
20151117 IoT를 위한 서비스 구성과 개발 by 영욱 김
20151117 IoT를 위한 서비스 구성과 개발20151117 IoT를 위한 서비스 구성과 개발
20151117 IoT를 위한 서비스 구성과 개발
영욱 김1.1K views
Ondřej Procházka - Deployment podle Devel.cz by Develcz
Ondřej Procházka - Deployment podle Devel.czOndřej Procházka - Deployment podle Devel.cz
Ondřej Procházka - Deployment podle Devel.cz
Develcz470 views
How to rewrite the OS using C by strong type by Kiwamu Okabe
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 Okabe3K views
Wonders of Golang by Kartik Sura
Wonders of GolangWonders of Golang
Wonders of Golang
Kartik Sura923 views
Beachhead implements new opcode on CLR JIT by Kouji Matsui
Beachhead implements new opcode on CLR JITBeachhead implements new opcode on CLR JIT
Beachhead implements new opcode on CLR JIT
Kouji Matsui18.2K views

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

A Fabric/Puppet Build/Deploy System by
A Fabric/Puppet Build/Deploy SystemA Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy Systemadrian_nye
9.2K views28 slides
DevOps(4) : Ansible(2) - (MOSG) by
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)Soshi Nemoto
851 views49 slides
Dependencies Managers in C/C++. Using stdcpp 2014 by
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014biicode
4.4K views44 slides
The Modern Developer Toolbox by
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer ToolboxPablo Godel
2.6K views115 slides
Deploying Symfony | symfony.cat by
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.catPablo Godel
2.8K views149 slides
From Code to Cloud - PHP on Red Hat's OpenShift by
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 OpenShiftEric D. Schabell
6.5K views33 slides

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

A Fabric/Puppet Build/Deploy System by adrian_nye
A Fabric/Puppet Build/Deploy SystemA Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy System
adrian_nye9.2K views
DevOps(4) : Ansible(2) - (MOSG) by Soshi Nemoto
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)
Soshi Nemoto851 views
Dependencies Managers in C/C++. Using stdcpp 2014 by biicode
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
biicode4.4K views
The Modern Developer Toolbox by Pablo Godel
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer Toolbox
Pablo Godel2.6K views
Deploying Symfony | symfony.cat by Pablo Godel
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
Pablo Godel2.8K views
From Code to Cloud - PHP on Red Hat's OpenShift by Eric D. Schabell
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. Schabell6.5K views
Deployment Tactics by Ian Barber
Deployment TacticsDeployment Tactics
Deployment Tactics
Ian Barber4.7K views
Comment améliorer le quotidien des Développeurs PHP ? by AFUP_Limoges
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_Limoges2.1K views
Developing and Deploying PHP with Docker by Patrick Mizer
Developing and Deploying PHP with DockerDeveloping and Deploying PHP with Docker
Developing and Deploying PHP with Docker
Patrick Mizer807 views
Advanced Eclipse Workshop (held at IPC2010 -spring edition-) by Bastian Feder
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 Feder1.5K views
Continuous Integration & Development with Gitlab by Ayush Sharma
Continuous Integration & Development with GitlabContinuous Integration & Development with Gitlab
Continuous Integration & Development with Gitlab
Ayush Sharma229 views
All the Laravel things: up and running to making $$ by Joe Ferguson
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 Ferguson829 views
Release with confidence by John Congdon
Release with confidenceRelease with confidence
Release with confidence
John Congdon1.8K views
PHP on Heroku: Deploying and Scaling Apps in the Cloud by Salesforce Developers
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
Virtualize and automate your development environment for fun and profit by Andreas Heim
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 Heim2.3K views
Improve your Java Environment with Docker by HanoiJUG
Improve your Java Environment with DockerImprove your Java Environment with Docker
Improve your Java Environment with Docker
HanoiJUG5.7K views
Lean Drupal Repositories with Composer and Drush by Pantheon
Lean Drupal Repositories with Composer and DrushLean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and Drush
Pantheon1.6K views
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift by Diego Freniche Brito
MobileConf 2021 Slides:  Let's build macOS CLI Utilities using SwiftMobileConf 2021 Slides:  Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift

More from Fabrice Bernhard

Scale quality with kaizen - Tech.Rocks conference by
Scale quality with kaizen - Tech.Rocks conferenceScale quality with kaizen - Tech.Rocks conference
Scale quality with kaizen - Tech.Rocks conferenceFabrice Bernhard
976 views33 slides
With Great Power comes Great Responsibilities by
With Great Power comes Great ResponsibilitiesWith Great Power comes Great Responsibilities
With Great Power comes Great ResponsibilitiesFabrice Bernhard
2K views35 slides
Integrating Drupal 8 into Symfony 2 by
Integrating Drupal 8 into Symfony 2Integrating Drupal 8 into Symfony 2
Integrating Drupal 8 into Symfony 2Fabrice Bernhard
10.4K views49 slides
Modernisation of legacy PHP applications using Symfony2 - PHP Northeast Confe... by
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
7.4K views58 slides
Modernisation of Legacy PHP Applications to Symfony2 - Symfony Live Berlin 2012 by
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 2012Fabrice Bernhard
15.9K views56 slides
Modernisation of legacy php to Symfony 2 by
Modernisation of legacy php to Symfony 2Modernisation of legacy php to Symfony 2
Modernisation of legacy php to Symfony 2Fabrice Bernhard
2.4K views31 slides

More from Fabrice Bernhard(6)

Scale quality with kaizen - Tech.Rocks conference by Fabrice Bernhard
Scale quality with kaizen - Tech.Rocks conferenceScale quality with kaizen - Tech.Rocks conference
Scale quality with kaizen - Tech.Rocks conference
Fabrice Bernhard976 views
With Great Power comes Great Responsibilities by Fabrice Bernhard
With Great Power comes Great ResponsibilitiesWith Great Power comes Great Responsibilities
With Great Power comes Great Responsibilities
Fabrice Bernhard2K views
Integrating Drupal 8 into Symfony 2 by Fabrice Bernhard
Integrating Drupal 8 into Symfony 2Integrating Drupal 8 into Symfony 2
Integrating Drupal 8 into Symfony 2
Fabrice Bernhard10.4K views
Modernisation of legacy PHP applications using Symfony2 - PHP Northeast Confe... by 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...
Fabrice Bernhard7.4K views
Modernisation of Legacy PHP Applications to Symfony2 - Symfony Live Berlin 2012 by Fabrice Bernhard
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 Bernhard15.9K views
Modernisation of legacy php to Symfony 2 by Fabrice Bernhard
Modernisation of legacy php to Symfony 2Modernisation of legacy php to Symfony 2
Modernisation of legacy php to Symfony 2
Fabrice Bernhard2.4K views

Recently uploaded

Q11 WHAT IS THE FIRST RELIGIOUS OBLIGATION IN ISLAM RAMZY AJEM by
Q11 WHAT IS THE FIRST RELIGIOUS OBLIGATION IN ISLAM RAMZY AJEMQ11 WHAT IS THE FIRST RELIGIOUS OBLIGATION IN ISLAM RAMZY AJEM
Q11 WHAT IS THE FIRST RELIGIOUS OBLIGATION IN ISLAM RAMZY AJEMRamzy Ajem
5 views1 slide
Frenchie Shore’ criticised as too sexually explicit by French culture ministe... by
Frenchie Shore’ criticised as too sexually explicit by French culture ministe...Frenchie Shore’ criticised as too sexually explicit by French culture ministe...
Frenchie Shore’ criticised as too sexually explicit by French culture ministe...Bnher.com
6 views3 slides
TCS_Emotional analysis_Eng.pptx by
TCS_Emotional analysis_Eng.pptxTCS_Emotional analysis_Eng.pptx
TCS_Emotional analysis_Eng.pptxTanaka Computer Service Corp.
22 views20 slides
Deerfoot Church of Christ 12 3 23 by
Deerfoot Church of Christ 12 3 23Deerfoot Church of Christ 12 3 23
Deerfoot Church of Christ 12 3 23deerfootcoc
20 views2 slides
BRAVELY - CHICO XAVIER.pdf by
BRAVELY - CHICO XAVIER.pdfBRAVELY - CHICO XAVIER.pdf
BRAVELY - CHICO XAVIER.pdfMashaL38
16 views109 slides
Lead us safely to our homes.docx by
Lead us safely to our homes.docxLead us safely to our homes.docx
Lead us safely to our homes.docxtummyy633
7 views1 slide

Recently uploaded(18)

Q11 WHAT IS THE FIRST RELIGIOUS OBLIGATION IN ISLAM RAMZY AJEM by Ramzy Ajem
Q11 WHAT IS THE FIRST RELIGIOUS OBLIGATION IN ISLAM RAMZY AJEMQ11 WHAT IS THE FIRST RELIGIOUS OBLIGATION IN ISLAM RAMZY AJEM
Q11 WHAT IS THE FIRST RELIGIOUS OBLIGATION IN ISLAM RAMZY AJEM
Ramzy Ajem5 views
Frenchie Shore’ criticised as too sexually explicit by French culture ministe... by Bnher.com
Frenchie Shore’ criticised as too sexually explicit by French culture ministe...Frenchie Shore’ criticised as too sexually explicit by French culture ministe...
Frenchie Shore’ criticised as too sexually explicit by French culture ministe...
Bnher.com 6 views
Deerfoot Church of Christ 12 3 23 by deerfootcoc
Deerfoot Church of Christ 12 3 23Deerfoot Church of Christ 12 3 23
Deerfoot Church of Christ 12 3 23
deerfootcoc20 views
BRAVELY - CHICO XAVIER.pdf by MashaL38
BRAVELY - CHICO XAVIER.pdfBRAVELY - CHICO XAVIER.pdf
BRAVELY - CHICO XAVIER.pdf
MashaL3816 views
Lead us safely to our homes.docx by tummyy633
Lead us safely to our homes.docxLead us safely to our homes.docx
Lead us safely to our homes.docx
tummyy6337 views
A333 If the two are different Knowing you => to recover all your sins Togethe... by franktsao4
A333 If the two are different Knowing you => to recover all your sins Togethe...A333 If the two are different Knowing you => to recover all your sins Togethe...
A333 If the two are different Knowing you => to recover all your sins Togethe...
franktsao48 views
Walking in maturity by Ed Sullivan
Walking in maturityWalking in maturity
Walking in maturity
Ed Sullivan31 views
Christmas List - Mary_Slideshare.pptx by Stephen Palm
Christmas List - Mary_Slideshare.pptxChristmas List - Mary_Slideshare.pptx
Christmas List - Mary_Slideshare.pptx
Stephen Palm22 views
KingsandProphets2.pptx by Vaughndj
KingsandProphets2.pptxKingsandProphets2.pptx
KingsandProphets2.pptx
Vaughndj16 views
Parish Diary for Dec. 23-Jan. 24. by Chris Lyne
Parish Diary for Dec. 23-Jan. 24.Parish Diary for Dec. 23-Jan. 24.
Parish Diary for Dec. 23-Jan. 24.
Chris Lyne9 views
capstone presentation.pptx by DJKerns
capstone presentation.pptxcapstone presentation.pptx
capstone presentation.pptx
DJKerns10 views
The Revealed Path Guide Book New Muslims by Ramzy Ajem
The Revealed Path Guide Book New MuslimsThe Revealed Path Guide Book New Muslims
The Revealed Path Guide Book New Muslims
Ramzy Ajem10 views

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