SlideShare uma empresa Scribd logo
1 de 52
Baixar para ler offline
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

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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
 

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

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

Semelhante a 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
 

Mais de Fabrice Bernhard

Mais de 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
 

Último

Jual Obat Aborsi Padang ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan C...
Jual Obat Aborsi Padang ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan C...Jual Obat Aborsi Padang ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan C...
Jual Obat Aborsi Padang ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan C...
ZurliaSoop
 
Top 10 Amil baba list Famous Amil baba In Pakistan Amil baba Kala jadu in Raw...
Top 10 Amil baba list Famous Amil baba In Pakistan Amil baba Kala jadu in Raw...Top 10 Amil baba list Famous Amil baba In Pakistan Amil baba Kala jadu in Raw...
Top 10 Amil baba list Famous Amil baba In Pakistan Amil baba Kala jadu in Raw...
Amil Baba Naveed Bangali
 
Real Kala Jadu, Black magic specialist in Lahore and Kala ilam expert in kara...
Real Kala Jadu, Black magic specialist in Lahore and Kala ilam expert in kara...Real Kala Jadu, Black magic specialist in Lahore and Kala ilam expert in kara...
Real Kala Jadu, Black magic specialist in Lahore and Kala ilam expert in kara...
baharayali
 
Top Kala Jadu, Bangali Amil baba in Lahore and Kala jadu specialist in Lahore...
Top Kala Jadu, Bangali Amil baba in Lahore and Kala jadu specialist in Lahore...Top Kala Jadu, Bangali Amil baba in Lahore and Kala jadu specialist in Lahore...
Top Kala Jadu, Bangali Amil baba in Lahore and Kala jadu specialist in Lahore...
baharayali
 
Popular Kala Jadu, Black magic expert in Karachi and Kala jadu expert in Laho...
Popular Kala Jadu, Black magic expert in Karachi and Kala jadu expert in Laho...Popular Kala Jadu, Black magic expert in Karachi and Kala jadu expert in Laho...
Popular Kala Jadu, Black magic expert in Karachi and Kala jadu expert in Laho...
baharayali
 
Certified Kala Jadu, Black magic expert in Faisalabad and Kala ilam specialis...
Certified Kala Jadu, Black magic expert in Faisalabad and Kala ilam specialis...Certified Kala Jadu, Black magic expert in Faisalabad and Kala ilam specialis...
Certified Kala Jadu, Black magic expert in Faisalabad and Kala ilam specialis...
baharayali
 
Professional Amil baba, Black magic expert in Sialkot and Kala ilam expert in...
Professional Amil baba, Black magic expert in Sialkot and Kala ilam expert in...Professional Amil baba, Black magic expert in Sialkot and Kala ilam expert in...
Professional Amil baba, Black magic expert in Sialkot and Kala ilam expert in...
makhmalhalaaay
 
Famous Kala Jadu, Black magic expert in UK and Kala ilam expert in Saudi Arab...
Famous Kala Jadu, Black magic expert in UK and Kala ilam expert in Saudi Arab...Famous Kala Jadu, Black magic expert in UK and Kala ilam expert in Saudi Arab...
Famous Kala Jadu, Black magic expert in UK and Kala ilam expert in Saudi Arab...
baharayali
 
Popular Kala Jadu, Black magic specialist in Sialkot and Kala ilam specialist...
Popular Kala Jadu, Black magic specialist in Sialkot and Kala ilam specialist...Popular Kala Jadu, Black magic specialist in Sialkot and Kala ilam specialist...
Popular Kala Jadu, Black magic specialist in Sialkot and Kala ilam specialist...
baharayali
 
Famous Kala Jadu, Black magic specialist in Rawalpindi and Bangali Amil baba ...
Famous Kala Jadu, Black magic specialist in Rawalpindi and Bangali Amil baba ...Famous Kala Jadu, Black magic specialist in Rawalpindi and Bangali Amil baba ...
Famous Kala Jadu, Black magic specialist in Rawalpindi and Bangali Amil baba ...
baharayali
 

Último (20)

Jual Obat Aborsi Padang ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan C...
Jual Obat Aborsi Padang ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan C...Jual Obat Aborsi Padang ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan C...
Jual Obat Aborsi Padang ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan C...
 
Human Design Gates Cheat Sheet | Kabastro.com
Human Design Gates Cheat Sheet | Kabastro.comHuman Design Gates Cheat Sheet | Kabastro.com
Human Design Gates Cheat Sheet | Kabastro.com
 
Zulu - The Epistle of Ignatius to Polycarp.pdf
Zulu - The Epistle of Ignatius to Polycarp.pdfZulu - The Epistle of Ignatius to Polycarp.pdf
Zulu - The Epistle of Ignatius to Polycarp.pdf
 
Top 10 Amil baba list Famous Amil baba In Pakistan Amil baba Kala jadu in Raw...
Top 10 Amil baba list Famous Amil baba In Pakistan Amil baba Kala jadu in Raw...Top 10 Amil baba list Famous Amil baba In Pakistan Amil baba Kala jadu in Raw...
Top 10 Amil baba list Famous Amil baba In Pakistan Amil baba Kala jadu in Raw...
 
Real Kala Jadu, Black magic specialist in Lahore and Kala ilam expert in kara...
Real Kala Jadu, Black magic specialist in Lahore and Kala ilam expert in kara...Real Kala Jadu, Black magic specialist in Lahore and Kala ilam expert in kara...
Real Kala Jadu, Black magic specialist in Lahore and Kala ilam expert in kara...
 
Top Kala Jadu, Bangali Amil baba in Lahore and Kala jadu specialist in Lahore...
Top Kala Jadu, Bangali Amil baba in Lahore and Kala jadu specialist in Lahore...Top Kala Jadu, Bangali Amil baba in Lahore and Kala jadu specialist in Lahore...
Top Kala Jadu, Bangali Amil baba in Lahore and Kala jadu specialist in Lahore...
 
Popular Kala Jadu, Black magic expert in Karachi and Kala jadu expert in Laho...
Popular Kala Jadu, Black magic expert in Karachi and Kala jadu expert in Laho...Popular Kala Jadu, Black magic expert in Karachi and Kala jadu expert in Laho...
Popular Kala Jadu, Black magic expert in Karachi and Kala jadu expert in Laho...
 
Jude: The Acts of the Apostates (Jude vv.1-4).pptx
Jude: The Acts of the Apostates (Jude vv.1-4).pptxJude: The Acts of the Apostates (Jude vv.1-4).pptx
Jude: The Acts of the Apostates (Jude vv.1-4).pptx
 
Certified Kala Jadu, Black magic expert in Faisalabad and Kala ilam specialis...
Certified Kala Jadu, Black magic expert in Faisalabad and Kala ilam specialis...Certified Kala Jadu, Black magic expert in Faisalabad and Kala ilam specialis...
Certified Kala Jadu, Black magic expert in Faisalabad and Kala ilam specialis...
 
Professional Amil baba, Black magic expert in Sialkot and Kala ilam expert in...
Professional Amil baba, Black magic expert in Sialkot and Kala ilam expert in...Professional Amil baba, Black magic expert in Sialkot and Kala ilam expert in...
Professional Amil baba, Black magic expert in Sialkot and Kala ilam expert in...
 
Famous Kala Jadu, Black magic expert in UK and Kala ilam expert in Saudi Arab...
Famous Kala Jadu, Black magic expert in UK and Kala ilam expert in Saudi Arab...Famous Kala Jadu, Black magic expert in UK and Kala ilam expert in Saudi Arab...
Famous Kala Jadu, Black magic expert in UK and Kala ilam expert in Saudi Arab...
 
Genesis 1:2 - Meditate the Scripture Daily bit by bit
Genesis 1:2 - Meditate the Scripture Daily bit by bitGenesis 1:2 - Meditate the Scripture Daily bit by bit
Genesis 1:2 - Meditate the Scripture Daily bit by bit
 
The Revelation Chapter 4 Working Copy.docx
The Revelation Chapter 4 Working Copy.docxThe Revelation Chapter 4 Working Copy.docx
The Revelation Chapter 4 Working Copy.docx
 
Peaceful Meditation | Peaceful Way by Kabastro
Peaceful Meditation | Peaceful Way by KabastroPeaceful Meditation | Peaceful Way by Kabastro
Peaceful Meditation | Peaceful Way by Kabastro
 
famous No 1 astrologer / Best No 1 Amil baba in UK, Australia, Germany, USA, ...
famous No 1 astrologer / Best No 1 Amil baba in UK, Australia, Germany, USA, ...famous No 1 astrologer / Best No 1 Amil baba in UK, Australia, Germany, USA, ...
famous No 1 astrologer / Best No 1 Amil baba in UK, Australia, Germany, USA, ...
 
Popular Kala Jadu, Black magic specialist in Sialkot and Kala ilam specialist...
Popular Kala Jadu, Black magic specialist in Sialkot and Kala ilam specialist...Popular Kala Jadu, Black magic specialist in Sialkot and Kala ilam specialist...
Popular Kala Jadu, Black magic specialist in Sialkot and Kala ilam specialist...
 
Genesis 1:10 || Meditate the Scripture daily verse by verse
Genesis 1:10  ||  Meditate the Scripture daily verse by verseGenesis 1:10  ||  Meditate the Scripture daily verse by verse
Genesis 1:10 || Meditate the Scripture daily verse by verse
 
Famous Kala Jadu, Black magic specialist in Rawalpindi and Bangali Amil baba ...
Famous Kala Jadu, Black magic specialist in Rawalpindi and Bangali Amil baba ...Famous Kala Jadu, Black magic specialist in Rawalpindi and Bangali Amil baba ...
Famous Kala Jadu, Black magic specialist in Rawalpindi and Bangali Amil baba ...
 
A Spiritual Guide To Truth v10.pdf xxxxxxx
A Spiritual Guide To Truth v10.pdf xxxxxxxA Spiritual Guide To Truth v10.pdf xxxxxxx
A Spiritual Guide To Truth v10.pdf xxxxxxx
 
About Kabala (English) | Kabastro.com | Kabala.vn
About Kabala (English) | Kabastro.com | Kabala.vnAbout Kabala (English) | Kabastro.com | Kabala.vn
About Kabala (English) | Kabastro.com | Kabala.vn
 

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