SlideShare a Scribd company logo
1 of 24
Download to read offline
Goals of this presentation
                           Issues addressed by buildout
                             Basic principles of buildout
                                              Conclusion




 .
                                Introduction to buildout
                     A system for deploying python applications
 .




                            Distributed under Creative Commons BY 3.0


                                                 July 5, 2011

                                      Fabien ANDRÉ <fandre@bearstech.com>


                                                                        .   .   .   .   .   .

Introduction to buildout – A system for deploying python applications                       1 / 24
Goals of this presentation
                             Issues addressed by buildout
                               Basic principles of buildout
                                                Conclusion



Outline


     .
  . . Goals of this presentation
    1


     .
  . . Issues addressed by buildout
    2


     .
  . . Basic principles of buildout
    3


     .
  . . Conclusion
    4




                                                                          .   .   .   .   .   .

  Introduction to buildout – A system for deploying python applications                       2 / 24
Goals of this presentation
                             Issues addressed by buildout
                               Basic principles of buildout
                                                Conclusion



Buildout : most common questions




   For people unfamiliar with deployment of python applications, it is
   difficult to understand :
           What is buildout for ? Do I need buildout ?
           How does it work ? What are its basic principles ?




                                                                          .   .   .   .   .   .

  Introduction to buildout – A system for deploying python applications                       3 / 24
Common application deployment issues
                                Goals of this presentation
                                                               Issue #1 : Dependency management
                             Issues addressed by buildout
                                                               Issue #2 : Isolation of environments
                               Basic principles of buildout
                                                               Issue #3 : Other sysadmin operations
                                                Conclusion
                                                               Buildout : one command to rule them all


Outline

     .
  . . Goals of this presentation
    1


     .
  . . Issues addressed by buildout
    2
         Common application deployment issues
         Issue #1 : Dependency management
         Issue #2 : Isolation of environments
         Issue #3 : Other sysadmin operations
         Buildout : one command to rule them all

     .
  . . Basic principles of buildout
    3


     .
  . . Conclusion
    4
                                                                              .       .      .       .   .   .

  Introduction to buildout – A system for deploying python applications                                      4 / 24
Common application deployment issues
                                Goals of this presentation
                                                               Issue #1 : Dependency management
                             Issues addressed by buildout
                                                               Issue #2 : Isolation of environments
                               Basic principles of buildout
                                                               Issue #3 : Other sysadmin operations
                                                Conclusion
                                                               Buildout : one command to rule them all


Common application deployment issues

   Three common issues while deploying applications :
   Dependency management How to automatically all your
              application dependencies ? Your project may require
              the pyramid web framework which itself depends on
              paste, zope.event, zope.configuration, chameleon. . .
   Environment isolation What to do if one of your project requires
               sqlalchemy 0.6.x and another sqlalchemy >= 0.7 ?
   Other sysadmin operations You may need to generate
               configuration files, copy files, run commands etc. to
               make your application ready to use.

                                                                              .       .      .       .   .   .

  Introduction to buildout – A system for deploying python applications                                      5 / 24
Common application deployment issues
                                 Goals of this presentation
                                                                Issue #1 : Dependency management
                              Issues addressed by buildout
                                                                Issue #2 : Isolation of environments
                                Basic principles of buildout
                                                                Issue #3 : Other sysadmin operations
                                                 Conclusion
                                                                Buildout : one command to rule them all


Issue description




            Without dependency management tool it is very tedious to
            install all the modules required by your project.
            You download one dependency of your project and then
            discover this package itself requires another package. . .




                                                                               .       .      .       .   .   .

   Introduction to buildout – A system for deploying python applications                                      6 / 24
Common application deployment issues
                                Goals of this presentation
                                                               Issue #1 : Dependency management
                             Issues addressed by buildout
                                                               Issue #2 : Isolation of environments
                               Basic principles of buildout
                                                               Issue #3 : Other sysadmin operations
                                                Conclusion
                                                               Buildout : one command to rule them all


Solution

   Python eggs
           .egg files, python packages including metadata which specifies
           which packages they depend on
           Located in a central repository (PyPI, the python package
           index)
           easy install tool able to install packages directly from PyPI
           and all of their dependencies
           Python eggs can be built easily using Distribute setuptools
   Python eggs are similar to .deb/.rpm packages, easy install to
   apt-get or yum and PyPI to distribution repositories

                                                                              .       .      .       .   .   .

  Introduction to buildout – A system for deploying python applications                                      7 / 24
Common application deployment issues
                                 Goals of this presentation
                                                                Issue #1 : Dependency management
                              Issues addressed by buildout
                                                                Issue #2 : Isolation of environments
                                Basic principles of buildout
                                                                Issue #3 : Other sysadmin operations
                                                 Conclusion
                                                                Buildout : one command to rule them all


Issue description

    Issue not solved by python eggs.
      ...
       1 You install project1 which requires sqlalchemy 0.6.x.

          easy install installs this version
      ...
       2 You install project2 which requires sqlalchemy >= 0.7.

          easy install replaces sqlalchemy 0.6.4 by sqlalchemy 0.7.1
      ..
       3. easy install keeps the version required by the latest installed
          module
      ...
       4 If you start project1, it crashes because it requires sqlalchemy

            0.6.x
    Need for isolated python environments (different configuration,
    different site-packages directories).
                                                                               .       .      .       .   .   .

   Introduction to buildout – A system for deploying python applications                                      8 / 24
Common application deployment issues
                                Goals of this presentation
                                                               Issue #1 : Dependency management
                             Issues addressed by buildout
                                                               Issue #2 : Isolation of environments
                               Basic principles of buildout
                                                               Issue #3 : Other sysadmin operations
                                                Conclusion
                                                               Buildout : one command to rule them all


Solution


   virtualenv
           Enables you to set up a separate environment for each project
           Installs dependencies of each project inside its specific
           environment
           Therefore two projects can use two different versions of the
           same library
   virtualenvwrapper : lightweight wrapper around vritualenv to allow
   creation/deletion of python environments with a single command



                                                                              .       .      .       .   .   .

  Introduction to buildout – A system for deploying python applications                                      9 / 24
Common application deployment issues
                                 Goals of this presentation
                                                                Issue #1 : Dependency management
                              Issues addressed by buildout
                                                                Issue #2 : Isolation of environments
                                Basic principles of buildout
                                                                Issue #3 : Other sysadmin operations
                                                 Conclusion
                                                                Buildout : one command to rule them all


Issue description


    Additional tasks may need to be performed to install your
    application :
            Generation of configuration files
            Installation of init scripts
            Copy files or folders
    For example, if your project is a web application, you may need to
    configure gunicorn and supervisord.



                                                                               .       .      .       .   .     .

   Introduction to buildout – A system for deploying python applications                                      10 / 24
Common application deployment issues
                                Goals of this presentation
                                                               Issue #1 : Dependency management
                             Issues addressed by buildout
                                                               Issue #2 : Isolation of environments
                               Basic principles of buildout
                                                               Issue #3 : Other sysadmin operations
                                                Conclusion
                                                               Buildout : one command to rule them all


Solution

   Common solutions to solve this problem :
           Use of shell scripts
           Better solution : Fabric + ConfigParser
   Fabric
           Python package
           Makes it possible to run locally or remotely (through ssh) shell
           commands from python
           A fabric task is a python function (in which you can use
           classical python statements and shell commands)
           Using the fab tool, you can run fabric tasks from the
           command line
                                                                              .       .      .       .   .     .

  Introduction to buildout – A system for deploying python applications                                      11 / 24
Common application deployment issues
                                Goals of this presentation
                                                               Issue #1 : Dependency management
                             Issues addressed by buildout
                                                               Issue #2 : Isolation of environments
                               Basic principles of buildout
                                                               Issue #3 : Other sysadmin operations
                                                Conclusion
                                                               Buildout : one command to rule them all


Overview of the previous solutions


   Each solution focuses on one specific issue.
   They don’t address the whole problem.
   Therefore, to install your application, the user needs to :
           Setup a virtual environment
           Activate it
           Install your package
           Read and understand your README file
           Run a bunch of scripts to finish the installation



                                                                              .       .      .       .   .     .

  Introduction to buildout – A system for deploying python applications                                      12 / 24
Common application deployment issues
                                Goals of this presentation
                                                               Issue #1 : Dependency management
                             Issues addressed by buildout
                                                               Issue #2 : Isolation of environments
                               Basic principles of buildout
                                                               Issue #3 : Other sysadmin operations
                                                Conclusion
                                                               Buildout : one command to rule them all


Review of the previous solutions


   Many drawbacks :
           Need for virtualenv to be installed
           Complex install procedure
           Above all, install procedure not standardized. Each
           application has its own and specific install procedure
           Need to document extensively your install procedure
           Difficult to write reusable shell/fabric scripts



                                                                              .       .      .       .   .     .

  Introduction to buildout – A system for deploying python applications                                      13 / 24
Common application deployment issues
                                Goals of this presentation
                                                               Issue #1 : Dependency management
                             Issues addressed by buildout
                                                               Issue #2 : Isolation of environments
                               Basic principles of buildout
                                                               Issue #3 : Other sysadmin operations
                                                Conclusion
                                                               Buildout : one command to rule them all


Introducing buildout

   Standardized, simple (2 commands !) way to deploy python
   applications :
     .
     ..
     1 python bootstrap.py

                   To be run inside the directory of a buildout enabled project
                   Downloads and installs buildout scripts
     ...
      2    bin/buildout
                   Installs dependencies in an isolated python environement.
                   Runs recipes (sort of configurable, reusable administration
                   scripts)
   You can think of bin/buildout as the ./configure && make
   && make install of python.

                                                                              .       .      .       .   .     .

  Introduction to buildout – A system for deploying python applications                                      14 / 24
Common application deployment issues
                                Goals of this presentation
                                                               Issue #1 : Dependency management
                             Issues addressed by buildout
                                                               Issue #2 : Isolation of environments
                               Basic principles of buildout
                                                               Issue #3 : Other sysadmin operations
                                                Conclusion
                                                               Buildout : one command to rule them all


Overview of buildout

           Created by Jim Fulton of Zope Corporation
           Ditributed under Zope Public Licence (ZPL) 2.1 (BSD-like)
           First release in 2006, latest release in the 1.5 branch in
           November 2010
           2.0 branch under development, compatible with Python 3
           (latest release in April 2011)
           More than 300 recipes available on PyPI ranging from recipes
           to install apache to recipes to build pyGtk and pyCairo
           Used by Zope, Grok and Plone as their main tool to install
           and manage software
           « Buildout is an exceedingly civilized way to develop an app. »
           –Jacob Kaplan-Moss, creator of Django
                                                                              .       .      .       .   .     .

  Introduction to buildout – A system for deploying python applications                                      15 / 24
Goals of this presentation
                             Issues addressed by buildout      Adding buildout to a new project
                               Basic principles of buildout    The buildout.cfg file
                                                Conclusion



Outline


     .
  . . Goals of this presentation
    1


     .
  . . Issues addressed by buildout
    2


     .
  . . Basic principles of buildout
    3
        Adding buildout to a new project
        The buildout.cfg file

     .
  . . Conclusion
    4



                                                                              .       .       .   .   .     .

  Introduction to buildout – A system for deploying python applications                                   16 / 24
Goals of this presentation
                           Issues addressed by buildout      Adding buildout to a new project
                             Basic principles of buildout    The buildout.cfg file
                                              Conclusion



 $ cd mywebsite
 $ ls
   build buildout.cfg dist mywebsite MyWebSite.egg-info                                             setup.py
 $ cat setup.py
  setup(
      name = "MyWebSite", version = "0.1",
      packages = find_packages(),
      install_requires = ["pyramid", "sqlalchemy<=0.6.4"],
      entry_points = {'console_scripts' :
        ["sqlver = mywebsite:sqlversion"]} )
 $ cat mywebsite/__init__.py
 import pyramid
 import sqlalchemy

 if sqlalchemy.__version__.split('.')[1] != '6':
     raise Exception("This project requires sqlalchemy 0.6.x")

 def sqlversion():
     print "This project uses SQLAlchemy", sqlalchemy.__version__
                                                                            .       .       .   .    .     .

Introduction to buildout – A system for deploying python applications                                    17 / 24
Goals of this presentation
                             Issues addressed by buildout      Adding buildout to a new project
                               Basic principles of buildout    The buildout.cfg file
                                                Conclusion



Overview of a simple project

           Two dependencies pyramid and sqlalchemy
           One entry point sqlversion
   Adding buildout :
     .
     ..
     1 Fetch the bootstrap.py file

           $ cd mywebsite
           $ wget http://svn.zope.org/*checkout*/
               zc.buildout/trunk/bootstrap/bootstrap.py
     ...
      2    Create a basic buildout.cfg file
           $ cat buildout.cfg
           [buildout]
           parts =

                                                                              .       .       .   .   .     .

  Introduction to buildout – A system for deploying python applications                                   18 / 24
Goals of this presentation
                             Issues addressed by buildout      Adding buildout to a new project
                               Basic principles of buildout    The buildout.cfg file
                                                Conclusion



Directory Structure of a Buildout


   You can now run buildout :
   $ bin/buildout
   Buildout did nothing (because our buildout.cfg file is empty)
   except creating a directory structure :
           bin/ : Receives executable scripts created by buildout from
           entrypoints defined in setup.py files
           eggs/ : Receives python packages downloaded by buildout
           part/ : Each part may create a directory beneath part/ for
           its specific use


                                                                              .       .       .   .   .     .

  Introduction to buildout – A system for deploying python applications                                   19 / 24
Goals of this presentation
                             Issues addressed by buildout      Adding buildout to a new project
                               Basic principles of buildout    The buildout.cfg file
                                                Conclusion



Example of a buildout.cfg file

   $ cat buildout.cfg
   [buildout]
   parts = python console
   develop = .

   [python]
   recipe = zc.recipe.egg
   interpreter = python
   eggs = mywebsite

   [console]
   recipe = zc.recipe.egg:scripts
   eggs = mywebsite


                                                                              .       .       .   .   .     .

  Introduction to buildout – A system for deploying python applications                                   20 / 24
Goals of this presentation
                             Issues addressed by buildout      Adding buildout to a new project
                               Basic principles of buildout    The buildout.cfg file
                                                Conclusion



Structure of a buildout.cfg file


           When it is invoked buildout runs all the parts listed in the
           parts option of the [buildout] section.
           To each part listed in the parts option corresponds a section
           in the buildout.cfg file
   Each part consists of :
           A recipe to execute (zc.recipe.egg,
           zc.recipe.egg:scripts)
           Arguments for this recipe (interpreter, eggs . . . )


                                                                              .       .       .   .   .     .

  Introduction to buildout – A system for deploying python applications                                   21 / 24
Goals of this presentation
                             Issues addressed by buildout      Adding buildout to a new project
                               Basic principles of buildout    The buildout.cfg file
                                                Conclusion



Buildout recipes
   Recipes : Python scripts which carry out a certain task according
   to the arguments they are given
    
   Example of recipes :
           zc.recipe.egg Installs specified eggs (eggs argument) into
           the buildout eggs directory. Also able to create a python
           interpreter with these eggs baked in (interpreter
           argument).
           zc.recipe.egg:scripts Creates scripts in bin/ based on
           setup.py entry points.
           zc.recipe.testrunner Creates a test script in bin/ which
           runs tests for the project.
           Many recipes available on PyPI : apache installation etc. . .
                                                                              .       .       .   .   .     .

  Introduction to buildout – A system for deploying python applications                                   22 / 24
Goals of this presentation
                             Issues addressed by buildout
                               Basic principles of buildout
                                                Conclusion



Outline


     .
  . . Goals of this presentation
    1


     .
  . . Issues addressed by buildout
    2


     .
  . . Basic principles of buildout
    3


     .
  . . Conclusion
    4




                                                                          .   .   .   .   .     .

  Introduction to buildout – A system for deploying python applications                       23 / 24
Goals of this presentation
                             Issues addressed by buildout
                               Basic principles of buildout
                                                Conclusion



Conclusion

   Common use case :
           As soon as you need a complete, extensible build system to
           deploy python applications (install project in isolated
           environment and carry out any installation task)
   Cases where buildout is not suitable :
           If you don’t need to carry out many installation tasks and just
           need to package your project, bare setuptools may be enough.
           If you only need to carry many specific systems administration
           tasks (especially if you need to connect to remote hosts),
           fabric may be a better choice as fabric tasks are faster to
           write than buildout recipes.
                                                                          .   .   .   .   .     .

  Introduction to buildout – A system for deploying python applications                       24 / 24

More Related Content

Similar to Introduction to buildout

Devnology back toschool software reengineering
Devnology back toschool software reengineeringDevnology back toschool software reengineering
Devnology back toschool software reengineeringDevnology
 
Structured Software Design
Structured Software DesignStructured Software Design
Structured Software DesignGiorgio Zoppi
 
Modern Post-Exploitation Strategies - 44CON 2012
Modern Post-Exploitation Strategies - 44CON 2012Modern Post-Exploitation Strategies - 44CON 2012
Modern Post-Exploitation Strategies - 44CON 201244CON
 
Agile & ALM tools
Agile & ALM toolsAgile & ALM tools
Agile & ALM toolsLarry Cai
 
A quick tour of autonomic computing
A quick tour of autonomic computingA quick tour of autonomic computing
A quick tour of autonomic computingsmartboysb06
 
Vb.net session 13
Vb.net session 13Vb.net session 13
Vb.net session 13Niit Care
 
Case Study: Practical tools and strategies for tackling legacy practices and ...
Case Study: Practical tools and strategies for tackling legacy practices and ...Case Study: Practical tools and strategies for tackling legacy practices and ...
Case Study: Practical tools and strategies for tackling legacy practices and ...Alejandro S.
 
QCon SF 2017 - Microservices: Service-Oriented Development
QCon SF 2017 - Microservices: Service-Oriented DevelopmentQCon SF 2017 - Microservices: Service-Oriented Development
QCon SF 2017 - Microservices: Service-Oriented DevelopmentAmbassador Labs
 
2012 Velocity London: DevOps Patterns Distilled
2012 Velocity London: DevOps Patterns Distilled2012 Velocity London: DevOps Patterns Distilled
2012 Velocity London: DevOps Patterns DistilledGene Kim
 
Software engineering principles in system software design
Software engineering principles in system software designSoftware engineering principles in system software design
Software engineering principles in system software designTech_MX
 
Ch21-Software Engineering 9
Ch21-Software Engineering 9Ch21-Software Engineering 9
Ch21-Software Engineering 9Ian Sommerville
 
OOSAD Chapter 6 Object Oriented Design.pptx
OOSAD Chapter 6 Object Oriented Design.pptxOOSAD Chapter 6 Object Oriented Design.pptx
OOSAD Chapter 6 Object Oriented Design.pptxBereketMuniye
 
Recognize, assess, reduce, and manage technical debt
Recognize, assess, reduce, and manage technical debtRecognize, assess, reduce, and manage technical debt
Recognize, assess, reduce, and manage technical debtJim Bethancourt
 
Information System Development
Information System DevelopmentInformation System Development
Information System DevelopmentSamudin Kassan
 
Mergebase dont-let-vulns-run-wild
Mergebase dont-let-vulns-run-wildMergebase dont-let-vulns-run-wild
Mergebase dont-let-vulns-run-wildJaredHarris18
 
Cloud project secrets of success
Cloud project secrets of successCloud project secrets of success
Cloud project secrets of successKhazret Sapenov
 

Similar to Introduction to buildout (20)

Devnology back toschool software reengineering
Devnology back toschool software reengineeringDevnology back toschool software reengineering
Devnology back toschool software reengineering
 
Structured Software Design
Structured Software DesignStructured Software Design
Structured Software Design
 
What’s New ?Linux on System z
What’s New ?Linux on System zWhat’s New ?Linux on System z
What’s New ?Linux on System z
 
Modern Post-Exploitation Strategies - 44CON 2012
Modern Post-Exploitation Strategies - 44CON 2012Modern Post-Exploitation Strategies - 44CON 2012
Modern Post-Exploitation Strategies - 44CON 2012
 
Agile & ALM tools
Agile & ALM toolsAgile & ALM tools
Agile & ALM tools
 
A quick tour of autonomic computing
A quick tour of autonomic computingA quick tour of autonomic computing
A quick tour of autonomic computing
 
Vb.net session 13
Vb.net session 13Vb.net session 13
Vb.net session 13
 
Case Study: Practical tools and strategies for tackling legacy practices and ...
Case Study: Practical tools and strategies for tackling legacy practices and ...Case Study: Practical tools and strategies for tackling legacy practices and ...
Case Study: Practical tools and strategies for tackling legacy practices and ...
 
QCon SF 2017 - Microservices: Service-Oriented Development
QCon SF 2017 - Microservices: Service-Oriented DevelopmentQCon SF 2017 - Microservices: Service-Oriented Development
QCon SF 2017 - Microservices: Service-Oriented Development
 
2012 Velocity London: DevOps Patterns Distilled
2012 Velocity London: DevOps Patterns Distilled2012 Velocity London: DevOps Patterns Distilled
2012 Velocity London: DevOps Patterns Distilled
 
10 gui 14
10 gui 1410 gui 14
10 gui 14
 
Software engineering principles in system software design
Software engineering principles in system software designSoftware engineering principles in system software design
Software engineering principles in system software design
 
Ch21-Software Engineering 9
Ch21-Software Engineering 9Ch21-Software Engineering 9
Ch21-Software Engineering 9
 
OOSAD Chapter 6 Object Oriented Design.pptx
OOSAD Chapter 6 Object Oriented Design.pptxOOSAD Chapter 6 Object Oriented Design.pptx
OOSAD Chapter 6 Object Oriented Design.pptx
 
Recognize, assess, reduce, and manage technical debt
Recognize, assess, reduce, and manage technical debtRecognize, assess, reduce, and manage technical debt
Recognize, assess, reduce, and manage technical debt
 
Information System Development
Information System DevelopmentInformation System Development
Information System Development
 
Mergebase dont-let-vulns-run-wild
Mergebase dont-let-vulns-run-wildMergebase dont-let-vulns-run-wild
Mergebase dont-let-vulns-run-wild
 
Cloud project secrets of success
Cloud project secrets of successCloud project secrets of success
Cloud project secrets of success
 
ITE - Chapter 4
ITE - Chapter 4ITE - Chapter 4
ITE - Chapter 4
 
HCI Chapter_2.ppt
HCI Chapter_2.pptHCI Chapter_2.ppt
HCI Chapter_2.ppt
 

Recently uploaded

Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 

Recently uploaded (20)

Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 

Introduction to buildout

  • 1. Goals of this presentation Issues addressed by buildout Basic principles of buildout Conclusion . Introduction to buildout A system for deploying python applications . Distributed under Creative Commons BY 3.0 July 5, 2011 Fabien ANDRÉ <fandre@bearstech.com> . . . . . . Introduction to buildout – A system for deploying python applications 1 / 24
  • 2. Goals of this presentation Issues addressed by buildout Basic principles of buildout Conclusion Outline . . . Goals of this presentation 1 . . . Issues addressed by buildout 2 . . . Basic principles of buildout 3 . . . Conclusion 4 . . . . . . Introduction to buildout – A system for deploying python applications 2 / 24
  • 3. Goals of this presentation Issues addressed by buildout Basic principles of buildout Conclusion Buildout : most common questions For people unfamiliar with deployment of python applications, it is difficult to understand : What is buildout for ? Do I need buildout ? How does it work ? What are its basic principles ? . . . . . . Introduction to buildout – A system for deploying python applications 3 / 24
  • 4. Common application deployment issues Goals of this presentation Issue #1 : Dependency management Issues addressed by buildout Issue #2 : Isolation of environments Basic principles of buildout Issue #3 : Other sysadmin operations Conclusion Buildout : one command to rule them all Outline . . . Goals of this presentation 1 . . . Issues addressed by buildout 2 Common application deployment issues Issue #1 : Dependency management Issue #2 : Isolation of environments Issue #3 : Other sysadmin operations Buildout : one command to rule them all . . . Basic principles of buildout 3 . . . Conclusion 4 . . . . . . Introduction to buildout – A system for deploying python applications 4 / 24
  • 5. Common application deployment issues Goals of this presentation Issue #1 : Dependency management Issues addressed by buildout Issue #2 : Isolation of environments Basic principles of buildout Issue #3 : Other sysadmin operations Conclusion Buildout : one command to rule them all Common application deployment issues Three common issues while deploying applications : Dependency management How to automatically all your application dependencies ? Your project may require the pyramid web framework which itself depends on paste, zope.event, zope.configuration, chameleon. . . Environment isolation What to do if one of your project requires sqlalchemy 0.6.x and another sqlalchemy >= 0.7 ? Other sysadmin operations You may need to generate configuration files, copy files, run commands etc. to make your application ready to use. . . . . . . Introduction to buildout – A system for deploying python applications 5 / 24
  • 6. Common application deployment issues Goals of this presentation Issue #1 : Dependency management Issues addressed by buildout Issue #2 : Isolation of environments Basic principles of buildout Issue #3 : Other sysadmin operations Conclusion Buildout : one command to rule them all Issue description Without dependency management tool it is very tedious to install all the modules required by your project. You download one dependency of your project and then discover this package itself requires another package. . . . . . . . . Introduction to buildout – A system for deploying python applications 6 / 24
  • 7. Common application deployment issues Goals of this presentation Issue #1 : Dependency management Issues addressed by buildout Issue #2 : Isolation of environments Basic principles of buildout Issue #3 : Other sysadmin operations Conclusion Buildout : one command to rule them all Solution Python eggs .egg files, python packages including metadata which specifies which packages they depend on Located in a central repository (PyPI, the python package index) easy install tool able to install packages directly from PyPI and all of their dependencies Python eggs can be built easily using Distribute setuptools Python eggs are similar to .deb/.rpm packages, easy install to apt-get or yum and PyPI to distribution repositories . . . . . . Introduction to buildout – A system for deploying python applications 7 / 24
  • 8. Common application deployment issues Goals of this presentation Issue #1 : Dependency management Issues addressed by buildout Issue #2 : Isolation of environments Basic principles of buildout Issue #3 : Other sysadmin operations Conclusion Buildout : one command to rule them all Issue description Issue not solved by python eggs. ... 1 You install project1 which requires sqlalchemy 0.6.x. easy install installs this version ... 2 You install project2 which requires sqlalchemy >= 0.7. easy install replaces sqlalchemy 0.6.4 by sqlalchemy 0.7.1 .. 3. easy install keeps the version required by the latest installed module ... 4 If you start project1, it crashes because it requires sqlalchemy 0.6.x Need for isolated python environments (different configuration, different site-packages directories). . . . . . . Introduction to buildout – A system for deploying python applications 8 / 24
  • 9. Common application deployment issues Goals of this presentation Issue #1 : Dependency management Issues addressed by buildout Issue #2 : Isolation of environments Basic principles of buildout Issue #3 : Other sysadmin operations Conclusion Buildout : one command to rule them all Solution virtualenv Enables you to set up a separate environment for each project Installs dependencies of each project inside its specific environment Therefore two projects can use two different versions of the same library virtualenvwrapper : lightweight wrapper around vritualenv to allow creation/deletion of python environments with a single command . . . . . . Introduction to buildout – A system for deploying python applications 9 / 24
  • 10. Common application deployment issues Goals of this presentation Issue #1 : Dependency management Issues addressed by buildout Issue #2 : Isolation of environments Basic principles of buildout Issue #3 : Other sysadmin operations Conclusion Buildout : one command to rule them all Issue description Additional tasks may need to be performed to install your application : Generation of configuration files Installation of init scripts Copy files or folders For example, if your project is a web application, you may need to configure gunicorn and supervisord. . . . . . . Introduction to buildout – A system for deploying python applications 10 / 24
  • 11. Common application deployment issues Goals of this presentation Issue #1 : Dependency management Issues addressed by buildout Issue #2 : Isolation of environments Basic principles of buildout Issue #3 : Other sysadmin operations Conclusion Buildout : one command to rule them all Solution Common solutions to solve this problem : Use of shell scripts Better solution : Fabric + ConfigParser Fabric Python package Makes it possible to run locally or remotely (through ssh) shell commands from python A fabric task is a python function (in which you can use classical python statements and shell commands) Using the fab tool, you can run fabric tasks from the command line . . . . . . Introduction to buildout – A system for deploying python applications 11 / 24
  • 12. Common application deployment issues Goals of this presentation Issue #1 : Dependency management Issues addressed by buildout Issue #2 : Isolation of environments Basic principles of buildout Issue #3 : Other sysadmin operations Conclusion Buildout : one command to rule them all Overview of the previous solutions Each solution focuses on one specific issue. They don’t address the whole problem. Therefore, to install your application, the user needs to : Setup a virtual environment Activate it Install your package Read and understand your README file Run a bunch of scripts to finish the installation . . . . . . Introduction to buildout – A system for deploying python applications 12 / 24
  • 13. Common application deployment issues Goals of this presentation Issue #1 : Dependency management Issues addressed by buildout Issue #2 : Isolation of environments Basic principles of buildout Issue #3 : Other sysadmin operations Conclusion Buildout : one command to rule them all Review of the previous solutions Many drawbacks : Need for virtualenv to be installed Complex install procedure Above all, install procedure not standardized. Each application has its own and specific install procedure Need to document extensively your install procedure Difficult to write reusable shell/fabric scripts . . . . . . Introduction to buildout – A system for deploying python applications 13 / 24
  • 14. Common application deployment issues Goals of this presentation Issue #1 : Dependency management Issues addressed by buildout Issue #2 : Isolation of environments Basic principles of buildout Issue #3 : Other sysadmin operations Conclusion Buildout : one command to rule them all Introducing buildout Standardized, simple (2 commands !) way to deploy python applications : . .. 1 python bootstrap.py To be run inside the directory of a buildout enabled project Downloads and installs buildout scripts ... 2 bin/buildout Installs dependencies in an isolated python environement. Runs recipes (sort of configurable, reusable administration scripts) You can think of bin/buildout as the ./configure && make && make install of python. . . . . . . Introduction to buildout – A system for deploying python applications 14 / 24
  • 15. Common application deployment issues Goals of this presentation Issue #1 : Dependency management Issues addressed by buildout Issue #2 : Isolation of environments Basic principles of buildout Issue #3 : Other sysadmin operations Conclusion Buildout : one command to rule them all Overview of buildout Created by Jim Fulton of Zope Corporation Ditributed under Zope Public Licence (ZPL) 2.1 (BSD-like) First release in 2006, latest release in the 1.5 branch in November 2010 2.0 branch under development, compatible with Python 3 (latest release in April 2011) More than 300 recipes available on PyPI ranging from recipes to install apache to recipes to build pyGtk and pyCairo Used by Zope, Grok and Plone as their main tool to install and manage software « Buildout is an exceedingly civilized way to develop an app. » –Jacob Kaplan-Moss, creator of Django . . . . . . Introduction to buildout – A system for deploying python applications 15 / 24
  • 16. Goals of this presentation Issues addressed by buildout Adding buildout to a new project Basic principles of buildout The buildout.cfg file Conclusion Outline . . . Goals of this presentation 1 . . . Issues addressed by buildout 2 . . . Basic principles of buildout 3 Adding buildout to a new project The buildout.cfg file . . . Conclusion 4 . . . . . . Introduction to buildout – A system for deploying python applications 16 / 24
  • 17. Goals of this presentation Issues addressed by buildout Adding buildout to a new project Basic principles of buildout The buildout.cfg file Conclusion $ cd mywebsite $ ls build buildout.cfg dist mywebsite MyWebSite.egg-info setup.py $ cat setup.py setup( name = "MyWebSite", version = "0.1", packages = find_packages(), install_requires = ["pyramid", "sqlalchemy<=0.6.4"], entry_points = {'console_scripts' : ["sqlver = mywebsite:sqlversion"]} ) $ cat mywebsite/__init__.py import pyramid import sqlalchemy if sqlalchemy.__version__.split('.')[1] != '6': raise Exception("This project requires sqlalchemy 0.6.x") def sqlversion(): print "This project uses SQLAlchemy", sqlalchemy.__version__ . . . . . . Introduction to buildout – A system for deploying python applications 17 / 24
  • 18. Goals of this presentation Issues addressed by buildout Adding buildout to a new project Basic principles of buildout The buildout.cfg file Conclusion Overview of a simple project Two dependencies pyramid and sqlalchemy One entry point sqlversion Adding buildout : . .. 1 Fetch the bootstrap.py file $ cd mywebsite $ wget http://svn.zope.org/*checkout*/ zc.buildout/trunk/bootstrap/bootstrap.py ... 2 Create a basic buildout.cfg file $ cat buildout.cfg [buildout] parts = . . . . . . Introduction to buildout – A system for deploying python applications 18 / 24
  • 19. Goals of this presentation Issues addressed by buildout Adding buildout to a new project Basic principles of buildout The buildout.cfg file Conclusion Directory Structure of a Buildout You can now run buildout : $ bin/buildout Buildout did nothing (because our buildout.cfg file is empty) except creating a directory structure : bin/ : Receives executable scripts created by buildout from entrypoints defined in setup.py files eggs/ : Receives python packages downloaded by buildout part/ : Each part may create a directory beneath part/ for its specific use . . . . . . Introduction to buildout – A system for deploying python applications 19 / 24
  • 20. Goals of this presentation Issues addressed by buildout Adding buildout to a new project Basic principles of buildout The buildout.cfg file Conclusion Example of a buildout.cfg file $ cat buildout.cfg [buildout] parts = python console develop = . [python] recipe = zc.recipe.egg interpreter = python eggs = mywebsite [console] recipe = zc.recipe.egg:scripts eggs = mywebsite . . . . . . Introduction to buildout – A system for deploying python applications 20 / 24
  • 21. Goals of this presentation Issues addressed by buildout Adding buildout to a new project Basic principles of buildout The buildout.cfg file Conclusion Structure of a buildout.cfg file When it is invoked buildout runs all the parts listed in the parts option of the [buildout] section. To each part listed in the parts option corresponds a section in the buildout.cfg file Each part consists of : A recipe to execute (zc.recipe.egg, zc.recipe.egg:scripts) Arguments for this recipe (interpreter, eggs . . . ) . . . . . . Introduction to buildout – A system for deploying python applications 21 / 24
  • 22. Goals of this presentation Issues addressed by buildout Adding buildout to a new project Basic principles of buildout The buildout.cfg file Conclusion Buildout recipes Recipes : Python scripts which carry out a certain task according to the arguments they are given   Example of recipes : zc.recipe.egg Installs specified eggs (eggs argument) into the buildout eggs directory. Also able to create a python interpreter with these eggs baked in (interpreter argument). zc.recipe.egg:scripts Creates scripts in bin/ based on setup.py entry points. zc.recipe.testrunner Creates a test script in bin/ which runs tests for the project. Many recipes available on PyPI : apache installation etc. . . . . . . . . Introduction to buildout – A system for deploying python applications 22 / 24
  • 23. Goals of this presentation Issues addressed by buildout Basic principles of buildout Conclusion Outline . . . Goals of this presentation 1 . . . Issues addressed by buildout 2 . . . Basic principles of buildout 3 . . . Conclusion 4 . . . . . . Introduction to buildout – A system for deploying python applications 23 / 24
  • 24. Goals of this presentation Issues addressed by buildout Basic principles of buildout Conclusion Conclusion Common use case : As soon as you need a complete, extensible build system to deploy python applications (install project in isolated environment and carry out any installation task) Cases where buildout is not suitable : If you don’t need to carry out many installation tasks and just need to package your project, bare setuptools may be enough. If you only need to carry many specific systems administration tasks (especially if you need to connect to remote hosts), fabric may be a better choice as fabric tasks are faster to write than buildout recipes. . . . . . . Introduction to buildout – A system for deploying python applications 24 / 24