初學 fabric qrtt1 2012.10.15
fabric 與我我是個快樂的小 RD, 直到我膝蓋中了一          。  I am the king of the world            server administrator.
Server Admin管 server 都在玩些什麼 deploy the java web application maintain various settings on the server be a watchdog for many...
Shell scriptsfabric 能幫你做的,用 shell scripts 也行傳說 server admin 都要會寫 shell script
But,qrtt One 的 shell script 程度太差...         #!/bin/sh         python run.py
fabrichttp://docs.fabfile.orgFabric is a Python (2.5 or higher) library andcommand-line tool for streamlining the useof SSH...
using fabric as cmdfab -H s1,s2 -- uptimefab -P -H s1,s2 -- uptimefab -w -P -H s1,s2 -- uptimefab ${OPTS} -- ${COMMANDS}
using fabric api有     些 function 可以用!?看 code 比看文件更直覺 :Dfabric/api.py    https://github.com/fabric/fabric/blob/master/    f...
thinking in fabricdo something                      which context  local script                         who remote script ...
thinking in fabricdo something                           which context                 該做的事就如同原本寫	 shell	 script	 那般。     ...
thinking in fabric利用	 context	 概念,  do something將『指令』的『執行者』、『執行位置』抽離,                   which context去掉了『雜念』的	 task	 更容易被	...
thinking in fabric    from fabric.api import run, task, env, roles, paralleldo something   env.user = ‘deployer’          ...
demo{deploy by fabric} https://github.com/qrtt1/pyhug_fabric_talk      fab -H s1,s2,s3 -P build_web restart_web
Q&A
Talk about fabric
Upcoming SlideShare
Loading in...5
×

Talk about fabric

517
-1

Published on

Published in: Self Improvement
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
517
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
5
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Talk about fabric

    1. 1. 初學 fabric qrtt1 2012.10.15
    2. 2. fabric 與我我是個快樂的小 RD, 直到我膝蓋中了一 。 I am the king of the world server administrator.
    3. 3. Server Admin管 server 都在玩些什麼 deploy the java web application maintain various settings on the server be a watchdog for many purposes
    4. 4. Shell scriptsfabric 能幫你做的,用 shell scripts 也行傳說 server admin 都要會寫 shell script
    5. 5. But,qrtt One 的 shell script 程度太差... #!/bin/sh python run.py
    6. 6. fabrichttp://docs.fabfile.orgFabric is a Python (2.5 or higher) library andcommand-line tool for streamlining the useof SSH for application deployment or systemsadministration tasks.
    7. 7. using fabric as cmdfab -H s1,s2 -- uptimefab -P -H s1,s2 -- uptimefab -w -P -H s1,s2 -- uptimefab ${OPTS} -- ${COMMANDS}
    8. 8. using fabric api有 些 function 可以用!?看 code 比看文件更直覺 :Dfabric/api.py https://github.com/fabric/fabric/blob/master/ fabric/api.py
    9. 9. thinking in fabricdo something which context local script who remote script where how to execute parallel sequence
    10. 10. thinking in fabricdo something which context 該做的事就如同原本寫 shell script 那般。 改用 fabric api 寫,也許只是多了一點 python 而有親切感 local script who 單純評論它,只 remote script 稍為便利罷了。 remote script where from fabric.api import run, task how to execute @task parallel def uptime(): sequence run("uptime")
    11. 11. thinking in fabric利用 context 概念, do something將『指令』的『執行者』、『執行位置』抽離, which context去掉了『雜念』的 task 更容易被 reuse, local script who更有機會成為任意組合的『樂高積木』 remote script wherefrom fabric.api import run, task, envenv.user = ‘qrtt1’env.hosts = [‘server1’, ‘server2’] how to execute parallel@taskdef uptime(): sequence run("uptime")
    12. 12. thinking in fabric from fabric.api import run, task, env, roles, paralleldo something env.user = ‘deployer’ which context local script = {web:[s1, s2, s3], db:[s4]} env.roledefs who remote script @task where @roles(‘web’, ‘db’) @parallel def uptime(): run("uptime") how to execute parallel sequence
    13. 13. demo{deploy by fabric} https://github.com/qrtt1/pyhug_fabric_talk fab -H s1,s2,s3 -P build_web restart_web
    14. 14. Q&A
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×