SlideShare ist ein Scribd-Unternehmen logo
1 von 56
Downloaden Sie, um offline zu lesen
repeatable INSTALLS and DEPLOYMENTS
                       PIP, VIRTUALENV and FABRIC


                                               IDAN GAZIT
                                    PyWeb-IL 10, Nov 30th 2009
SO YOU HAVE A PROJECT
        HOORAY.
NOW YOU HAVE A
   NEW DEVELOPER
    NEW SERVER
    NEW VERSION
NOW YOU HAVE A HUNDRED
      NEW DEVELOPERS
       NEW SERVERS
       NEW VERSIONS
MAKING SHIT




OVERHEAD
http://www.flickr.com/photos/derpunk/3875534682
THE OVERHEAD WILL KILL YOU
         KILL IT FIRST
ONE CLICK
ANY MORE AND YOU'RE F*CKED
ELIMINATE OVERHEAD
   THESE TOOLS WILL HELP
ISOLATION
  PROTECT YOUR APP FROM OTHER APPS


      REPEATABILITY
PULL TOGETHER ALL THE PARTS OF YOUR APP


        SCALABILITY
           O(1) DEPLOYMENTS
VIRTUALENV
 by IAN BICKING
http://www.flickr.com/photos/fensterbme/145621388
LIKE GOGGLES FOR YOUR PYTHON
          NOT REALLY.
ISOLATED PYTHON ENVIRONMENTS
       "PRIVATE" SITE-PACKAGES
APP X       APP Y
 FOO 0.8     BLAH 2.2
 BAR 1.23    BAR 1.23
BAZ 6.0c9   BLING 9.1b2
APP X       APP Y
 FOO 0.8     BLAH 2.2
 BAR 1.23    BAR 1.24
BAZ 6.0c9   BLING 9.1b2
GLOBAL SITE-PACKAGES
      LIKE A VIRGIN
$ python virtualenv.py ENV
      CREATE THE VIRTUALENV
--no-site-packages
   COMPLETE ISOLATION
ME, PERSONALLY?
A FEW GLOBAL PACKAGES (IPYTHON, IPDB)
$ source ENV/bin/activate
      TO ENTER THE MATRIX
(ENV)$ easy_install kungfu
           WOAH.
(ENV)$ python theone.py
     I CAN DODGE BULLETS
(ENV)$ deactivate
 OPERATOR, I NEED AN EXIT!
MORE USE CASES
DIFFERENT VERSIONS OF THE SAME APP
DEPLOYING?
SETUP THE SAME VIRTUALENV
WEB APPS
IT'S JUST PYTHONPATH
INDEPENDENT VIRTUALENV
   YOU GOTTA KEEP'EM SEPARATED
http://www.flickr.com/photos/wendycopley/3025707754
VIRTUALENVWRAPPER
    by DOUG HELLMANN
$ mkvirtualenv ENV
$ workon ENV
PIP
also by IAN BICKING
PIP INSTALLS PACKAGES
    GOODBYE, EASY_INSTALL
SMARTER
   NO PARTIAL INSTALLS
NON-SUCKY CONSOLE OUTPUT
    INSTALL FROM VCS
   REQUIREMENTS FILES
        UNINSTALL
$(ENV) pip install -E ENV mypackage
          PIP is VIRTUALENV-AWARE
$(ENV) pip freeze -E ENV > reqs.txt
        BOOM. I HAZ REQUIREMENTZ FILE.
$(ENV) pip install -E ENV -r reqs.txt
            SIT BACK AND RELAX
REQUIREMENTS FILE
              FRAMEWORK==0.2
                LIBRARY>=1.3
-e svn+http://myrepo/svn/MyApp#egg=MyApp
SUPPORTED VCS's
    SUBVERSION
        GIT
    MERCURIAL
      BAZAAR
FRESH DEPLOY
            1. PULL FROM VCS
             2. CREATE VENV
3. PIP INSTALL FROM REQUIREMENTS FILE
        4. THERE IS NO STEP FOUR
ROCKSTAR.




            http://www.flickr.com/photos/an-di/274127482
NOT SO FAST
4 STEPS IS 3 STEPS TOO MANY
FABRIC
maintained by JEFF FORCIER
AUTOMATE
REMOTE COMMANDS OVER SSH
  (LOCAL COMMANDS TOO)
IT'S KIND OF LIKE ‘MAKE'
  EXCEPT PYTHONIC AND DELICIOUS
FABFILE.PY
FABFILE.PY
from __future__ import with_statement
from fabric.api import *

env.hosts = ['server1.foo.com', 'server2.foo.com']

def test():
    with settings(warn_only=True):
        result = local('./manage.py test my_app', capture=False)
    if result.failed:
        abort("Aborting at user request.")

def pack():
    local('tar czf /tmp/my_project.tgz .', capture=False)

def prepare():
    test()
    pack()

def deploy():
    put('/tmp/my_project.tgz', '/tmp/')
    with cd('/srv/django/my_project/'):
        run('tar xzf /tmp/my_project.tgz')
        run('touch app.wsgi')
$ fab prepare
RUNS test() AND pack()
$ fab prepare deploy
    ONE STEP NIRVANA.
FABFILE.PY

from __future__ import with_statement
from fabric.api import *

def staging():
    env.hosts = ['staging.foo.com']

def production():
    env.hosts = ['prod1.foo.com', 'prod2.foo.com']

# ... more fab actions ...

def deploy():
    put('/tmp/my_project.tgz', '/tmp/')
    with cd('/srv/django/my_project/'):
        run('tar xzf /tmp/my_project.tgz')
        run('touch app.wsgi')
$ fab staging deploy
DEPLOY TO STAGING IN ONE LINE
FABRIC BUILTINS
      LOCAL
       RUN
      SUDO
     GET/PUT
     PROMPT
VIRTUALENV
    TO ISOLATE YOUR PROJECT


            PIP
REPEATABLE DEPENDENCY INSTALLS


         FABRIC
 FOR AUTOMATED DEPLOYMENTS
VIRTUALENV
http://pypi.python.org/pypi/virtualenv


               PIP
      http://pip.openplans.org/


            FABRIC
       http://docs.fabfile.org/
QUESTIONS?
THANK YOU!
            @IDANGAZIT
         IDAN@PIXANE.COM

http://bit.ly/repeatable-deployments

Weitere ähnliche Inhalte

Was ist angesagt?

Cloud focker を試してみた public
Cloud focker を試してみた   publicCloud focker を試してみた   public
Cloud focker を試してみた public
Takehiko Amano
 

Was ist angesagt? (20)

Puppet without Root - PuppetConf 2013
Puppet without Root - PuppetConf 2013Puppet without Root - PuppetConf 2013
Puppet without Root - PuppetConf 2013
 
Docker for data science
Docker for data scienceDocker for data science
Docker for data science
 
IOS 11 setup with appium latest
IOS 11 setup with appium  latestIOS 11 setup with appium  latest
IOS 11 setup with appium latest
 
Docker Demo @ IuK Seminar
Docker Demo @ IuK SeminarDocker Demo @ IuK Seminar
Docker Demo @ IuK Seminar
 
Cloud focker を試してみた public
Cloud focker を試してみた   publicCloud focker を試してみた   public
Cloud focker を試してみた public
 
Deploying Rails applications with Moonshine
Deploying Rails applications with MoonshineDeploying Rails applications with Moonshine
Deploying Rails applications with Moonshine
 
Appsec rump reverse-i_os_machook
Appsec rump reverse-i_os_machookAppsec rump reverse-i_os_machook
Appsec rump reverse-i_os_machook
 
PagerDuty | OSCON 2016 Failure Testing
PagerDuty | OSCON 2016 Failure TestingPagerDuty | OSCON 2016 Failure Testing
PagerDuty | OSCON 2016 Failure Testing
 
The MetaCPAN VM Part II (Using the VM)
The MetaCPAN VM Part II (Using the VM)The MetaCPAN VM Part II (Using the VM)
The MetaCPAN VM Part II (Using the VM)
 
Mangling
Mangling Mangling
Mangling
 
Deploying phalcon on heroku
Deploying phalcon on herokuDeploying phalcon on heroku
Deploying phalcon on heroku
 
Building aosp
Building aospBuilding aosp
Building aosp
 
Grand Rapids PHP Meetup: Behavioral Driven Development with Behat
Grand Rapids PHP Meetup: Behavioral Driven Development with BehatGrand Rapids PHP Meetup: Behavioral Driven Development with Behat
Grand Rapids PHP Meetup: Behavioral Driven Development with Behat
 
Супер быстрая автоматизация тестирования на iOS
Супер быстрая автоматизация тестирования на iOSСупер быстрая автоматизация тестирования на iOS
Супер быстрая автоматизация тестирования на iOS
 
Symfony: Your Next Microframework (SymfonyCon 2015)
Symfony: Your Next Microframework (SymfonyCon 2015)Symfony: Your Next Microframework (SymfonyCon 2015)
Symfony: Your Next Microframework (SymfonyCon 2015)
 
Swing when you're winning - an introduction to Ruby and Sinatra
Swing when you're winning - an introduction to Ruby and SinatraSwing when you're winning - an introduction to Ruby and Sinatra
Swing when you're winning - an introduction to Ruby and Sinatra
 
Using python and docker for data science
Using python and docker for data scienceUsing python and docker for data science
Using python and docker for data science
 
No Hugging, No Learning
No Hugging, No LearningNo Hugging, No Learning
No Hugging, No Learning
 
Using docker for data science - part 2
Using docker for data science - part 2Using docker for data science - part 2
Using docker for data science - part 2
 
The Symfony CLI
The Symfony CLIThe Symfony CLI
The Symfony CLI
 

Ähnlich wie Repeatable Deployments and Installations

Jenkins X Hands-on - automated CI/CD solution for cloud native applications o...
Jenkins X Hands-on - automated CI/CD solution for cloud native applications o...Jenkins X Hands-on - automated CI/CD solution for cloud native applications o...
Jenkins X Hands-on - automated CI/CD solution for cloud native applications o...
Ted Won
 

Ähnlich wie Repeatable Deployments and Installations (20)

SPRING BOOT DANS UN CONTAINER OUTILS ET PRATIQUES
 SPRING BOOT DANS UN CONTAINER OUTILS ET PRATIQUES SPRING BOOT DANS UN CONTAINER OUTILS ET PRATIQUES
SPRING BOOT DANS UN CONTAINER OUTILS ET PRATIQUES
 
Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
 
Flask
FlaskFlask
Flask
 
Python Flask app deployed to OPenShift using Wercker CI
Python Flask app deployed to OPenShift using Wercker CIPython Flask app deployed to OPenShift using Wercker CI
Python Flask app deployed to OPenShift using Wercker CI
 
Dev to Delivery with Puppet - PuppetConf 2014
Dev to Delivery with Puppet - PuppetConf 2014Dev to Delivery with Puppet - PuppetConf 2014
Dev to Delivery with Puppet - PuppetConf 2014
 
Fabric for fun_and_profit
Fabric for fun_and_profitFabric for fun_and_profit
Fabric for fun_and_profit
 
Mcollective introduction
Mcollective introductionMcollective introduction
Mcollective introduction
 
Hosting Your Own OTA Update Service
Hosting Your Own OTA Update ServiceHosting Your Own OTA Update Service
Hosting Your Own OTA Update Service
 
Jenkins X Hands-on - automated CI/CD solution for cloud native applications o...
Jenkins X Hands-on - automated CI/CD solution for cloud native applications o...Jenkins X Hands-on - automated CI/CD solution for cloud native applications o...
Jenkins X Hands-on - automated CI/CD solution for cloud native applications o...
 
Virtualenv
VirtualenvVirtualenv
Virtualenv
 
Minimum Viable Docker: our journey towards orchestration
Minimum Viable Docker: our journey towards orchestrationMinimum Viable Docker: our journey towards orchestration
Minimum Viable Docker: our journey towards orchestration
 
Composer for busy developers - DPC13
Composer for busy developers - DPC13Composer for busy developers - DPC13
Composer for busy developers - DPC13
 
Arbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenvArbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenv
 
PHP-VCR behat case study
PHP-VCR behat case studyPHP-VCR behat case study
PHP-VCR behat case study
 
Yeoman Workflow
Yeoman WorkflowYeoman Workflow
Yeoman Workflow
 
Vagrant
VagrantVagrant
Vagrant
 
Continous Delivering a PHP application
Continous Delivering a PHP applicationContinous Delivering a PHP application
Continous Delivering a PHP application
 
Writing your Third Plugin
Writing your Third PluginWriting your Third Plugin
Writing your Third Plugin
 
Virtualenv
VirtualenvVirtualenv
Virtualenv
 

Mehr von Idan Gazit

Datadesignmeaning
DatadesignmeaningDatadesignmeaning
Datadesignmeaning
Idan Gazit
 
Web typography
Web typographyWeb typography
Web typography
Idan Gazit
 
CSS: selectors and the box model
CSS: selectors and the box modelCSS: selectors and the box model
CSS: selectors and the box model
Idan Gazit
 
CSS: selectors and the box model
CSS: selectors and the box modelCSS: selectors and the box model
CSS: selectors and the box model
Idan Gazit
 

Mehr von Idan Gazit (11)

Datadesignmeaning
DatadesignmeaningDatadesignmeaning
Datadesignmeaning
 
Designers Make It Go to Eleven!
Designers Make It Go to Eleven!Designers Make It Go to Eleven!
Designers Make It Go to Eleven!
 
Web typography
Web typographyWeb typography
Web typography
 
CSS Extenders
CSS ExtendersCSS Extenders
CSS Extenders
 
CSS for Designers
CSS for DesignersCSS for Designers
CSS for Designers
 
CSS for Designers
CSS for DesignersCSS for Designers
CSS for Designers
 
CSS: selectors and the box model
CSS: selectors and the box modelCSS: selectors and the box model
CSS: selectors and the box model
 
CSS: selectors and the box model
CSS: selectors and the box modelCSS: selectors and the box model
CSS: selectors and the box model
 
Why Django
Why DjangoWhy Django
Why Django
 
An Introduction to Celery
An Introduction to CeleryAn Introduction to Celery
An Introduction to Celery
 
Django 1.1 Tour
Django 1.1 TourDjango 1.1 Tour
Django 1.1 Tour
 

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
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
 
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
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
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
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
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...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
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
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 

Repeatable Deployments and Installations