Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Fabric Python Developers Festa 2013.03 #pyfes

Fabric Python Developers Festa 2013.03 #pyfes

はい

drillbits

March 16, 2013
Tweet

Other Decks in Programming

Transcript

  1. Fabric is a Python (2.5 or higher) library and command-line

    tool for streamlining the use of SSH for application deployment or systems administration tasks.
  2. Fabric is a Python (2.5 or higher) library and command-line

    tool for streamlining the use of SSH for application deployment or systems administration tasks.
  3. Fabric is a Python (2.5 or higher) library and command-line

    tool for streamlining the use of SSH for application deployment or systems administration tasks.
  4. ϗϫοτ Python MySQL Nginx gunicorn Jenkins mercurial Django Nagios memcached

    RabbitMQ redis node.js Hadoop daemontoo PHP mongoDB
  5. ϗϫοτ Python MySQL Nginx gunicorn Jenkins mercurial Django Nagios memcached

    RabbitMQ redis node.js Hadoop daemontoo PHP mongoDB POSTFIX
  6. ϗϫοτ Python MySQL Nginx gunicorn Jenkins mercurial Django Nagios memcached

    RabbitMQ redis node.js Hadoop daemontoo PHP mongoDB POSTFIX δϟό
  7. NO

  8. NO

  9. d

  10. Fabric is a Python (2.5 or higher) library and command-line

    tool for streamlining the use of SSH for application deployment or systems administration tasks.
  11. Fabric is a Python (2.5 or higher) library and command-line

    tool for streamlining the use of SSH for application deployment or systems administration tasks.
  12. DDD

  13. $ fab Fatal error: Couldn't find any fabfiles! Remember that

    -f can be used to specify fabfile path, and use -h for help. Aborting.
  14. # fabfile.py from fabric.api import local # task def hello():

    local('echo hello') # shell command def uname(): local('uname')
  15. $ fab uname -u me -H 10.0.0.1 -i id_rsa [10.0.0.1]

    Executing task 'uname' [10.0.0.1] run: uname [10.0.0.1] out: Linux [10.0.0.1] out: Done. Disconnecting from 10.0.0.1... done.
  16. # fabfile.py from fabric.api import env, run env.hosts = ['10.0.0.1']

    env.user = 'me' env.key_filename = 'id_rsa' def uname(): run('uname')
  17. # fabfile.py from fabric.api import env, run def dev(): env.hosts

    = ['10.0.0.1'] env.user = 'me' env.key_filename = 'id_rsa' def uname(): run('uname')
  18. # fabfile/host.py from fabric.api import env, task @task def dev():

    env.hosts = ['10.0.0.1'] env.user = 'me' env.key_filename = 'id_rsa'
  19. # fabfile/host.py from fabric.api import env, task @task def dev():

    env.hosts = ['10.0.0.1', '10.0.0.2'] env.roledefs = { 'app': ['10.0.0.1'], 'db': ['10.0.0.2'], }
  20. put

  21. # templates/my.cnf : # You can set .._buffer_pool_size up to

    50 - 80 %% innodb_buffer_pool_size = %(buffer_pool_size)s :
  22. # templates/my.cnf : # You can set .._buffer_pool_size up to

    50 - 80 %% innodb_buffer_pool_size = %(buffer_pool_size)s :
  23. # templates/my.cnf : # You can set .._buffer_pool_size up to

    50 - 80 % innodb_buffer_pool_size = {{ buffer_pool_size }} :
  24. from fabric.api import run from fabric.context_managers \ import cd run('tar

    xzvf Python-2.7.3.tgz') with cd('Python-2.7.3'): run('./configure') run('make') sudo('make install')
  25. $ ssh [email protected] -i id_rsa tar xzvf Python-2.7.3.tgz $ ssh

    [email protected] -i id_rsa cd Python-2.7.3 $ ssh [email protected] -i id_rsa ./configure $ ssh [email protected] -i id_rsa make $ ssh [email protected] -i id_rsa make install
  26. from fabric.api import run from fabric.context_managers \ import cd run('tar

    xzvf Python-2.7.3.tgz') with cd('Python-2.7.3'): run('./configure') run('make') sudo('make install')
  27. $ ssh (...) cd Python-2.7.3 $ ssh (...) cd Python-2.7.3

    && ./configure $ ssh (...) cd Python-2.7.3 && make $ ssh (...) cd Python-2.7.3 && make install