How do people deploy/version control cronjobs to production? I'm more curious about conventions/standards people use than any particular solution, but I happen to be using git for revision control, and the cronjob is running a python/django script.
fabric 㯠Python製ã®ãããã¤ãªã©ãè¡ãã¹ã¯ãªãã å ¬å¼ããã¥ã¡ã³ãã¯ä»¥ä¸ åè::Fabric â Fabric 1.4.4 pre-alpha (76f466d) documentation ãã¨ã¯ @IanMLewis ããã®ããã¥ã¡ã³ãã詳ãã åè::Fabric ãããã¤ãã¼ã«ã®Pythonicãªæ¸ãæ¹ - Ian Lewis ã§ãããã§ãã§ã¦ããã¨ããã« from fabric.api import env ã¨ããç°å¢ãè¨å®ã§ããè¾æ¸ã®ãããªãã®ãããããããä¸æè°ã§æ®é dict ãªã dct[key] = value ã¨ããªããã°ãªããªãã®ã«ã env.key = value ã®ããã«ã§ãã¦ããããä¸æè°ã ã£ãããããã« env.key = value ã ã¨ç°¡åã ããªã®ã§ããã® fabric ã®å®è£ ãè¦ã¦ã¿ããæ¡å¤åç´ãªä»çµã¿ã§ãã»ãã¼ãã¨ãªã£ãã®ã§ããã ã¤
Windows7 (MinGW / MSYS) 㧠Fabric ã·ãªã¼ãºè¨äºã§ãã Windows7 (MinGW / MSYS) ã« Python 2.7 + virtualenv + Fabric ãå ¥ããã¡ã¢ Windows7 (MinGW / MSYS) ã« virtualenvwrapper ãå ¥ããã¡ã¢ Fabricã§æ¥ç¶æ å ±ãæå®ããæ¹æ³ããããï¼FabricããPHPã¹ã¯ãªãããå®è¡ãã¦ã¿ãã¡ã¢ çæ§PHPerã§ãåãã£ãï¼Fabricã§Windowsãããã¡ã¤ã«ã¢ãããã¼ã ä»åã¯ï¼ä»åãï¼ï¼Fabricã®ä½¿ãæ¹ã¨ãã¦ã¯PHPç¡é¢ä¿ã§ãããã¿ã¹ã¯ã®å 容ã composer ã³ãã³ããªã®ã§PHPeråãã¨ããã°PHPeråãã§ãã fabfile.pyãããã±ã¼ã¸ã«ãã¦ã¿ã¹ã¯ãã¢ã¸ã¥ã¼ã«åå² å ¬å¼ããã¥ã¡ã³ã Fabfile construction and use â
fabfileã®æ§æã¨ä½¿ãæ¹Â¶ ãã®ããã¥ã¡ã³ãã¯fabfileã«é¢ããéå¤ãªã»ã¯ã·ã§ã³ãå«ãã§ãã¾ããåªããfabfileã®ä½ææ¹æ³ã¨ä½æå¾ã®å©ç¨ã®ä»æ¹ã®ä¸¡æ¹ãå«ã¿ã¾ãã fabfileã®æ¢ç´¢Â¶ Fabricã¯Pythonã®ã¢ã¸ã¥ã¼ã«(ä¾ãã° fabfile.py)ãããã±ã¼ã¸(ä¾ãã° __init__.py ãå«ãã§ãã fabfile/ ãã£ã¬ã¯ããª)ãèªã¿è¾¼ããã¨ãã§ãã¾ããããã©ã«ãã§ã¯ã(Pythonã®ã¤ã³ãã¼ãæ©æ§ã«ãããã£ã¦) fabfile ã¨åä»ãããã fabfile/ ããã㯠fabfile.py ãæ¢ãã¾ãã fabfileã®æ¢ç´¢ã¢ã«ã´ãªãºã ã¯ãèµ·åãã¦ããã¦ã¼ã¶ã¼ã®ã«ã¬ã³ãã¯ã¼ãã³ã°ãã£ã¬ã¯ããªããã®è¦ªãã£ã¬ã¯ããªãæ¢ãã¾ãããããã£ã¦ã"ããã¸ã§ã¯ã" ã¦ã¼ã¹å¨ãæåã§ãä¾ãã°ã³ã¼ãããªã¼ã®ã«ã¼ãã« fabfile.py ãä¿æãã¦ããã¾ããããããfabf
ãã®è¨äºã§ã¯ãFabricã®ä¸»è¦ã¡ã½ããã§ãã run() 㨠sudo() ã«ã¤ãã¦è§£èª¬ãã¾ãã ãµã³ãã«ã³ã¼ã㯠https://github.com/shiumachi/fabric-sample ã«ããã¾ãã run() 㨠sudo() ã®åºæ¬ èªã¿ãããããããã以å¾ã¯å¿ è¦ããªãéã run() ã¡ã½ããã®ã¿ãåãä¸ãã¾ããrun() ã§åºæ¥ããã¨ã¯ã»ã¼å ¨ã¦ sudo() ã§ãåºæ¥ã¾ããæããç¡ãéããrun() 㯠sudo() ã¨èªã¿æ¿ãããã¨ãã§ãã¾ãã from fabric.api import run ã§ã¤ã³ãã¼ãå¯è½ run([ã³ãã³ãæåå]) ã§ãä»»æã®ã³ãã³ãæååãå®è¡å¯è½ sudo([ã³ãã³ãæåå]) ã¨ããã°ãä»»æã®ã³ãã³ãæååã sudo ã§ãã ã¨ã©ã¼ãã³ããªã³ã° run() ã§å®è¡ããã³ãã³ãã失æããå ´åãfab ã³ãã³ãèªä½ããã®å ´ã§ä¸æ
注æ!!!! ãã®ããã¥ã¡ã³ãã¯Fabricãã¼ã¸ã§ã³1.10.1ã®æ¥æ¬èªè¨³ã§ãå¤ããã®ã§ãã ææ°ã®Fabric2.xã®ããã¥ã¡ã³ãã¯ãªãªã¸ãã«ã®è±èªããã¥ã¡ã³ãhttp://www.fabfile.org/ãåç §ãã¦ãã ããã ãªãã¬ã¼ã·ã§ã³Â¶ fabfileå ã¨ãã®ä»ã®ã³ã¢ä»¥å¤ã®ã³ã¼ãã§ä½¿ãããrun()/sudo()ãªã©ã®é¢æ°ã§ãã fabric.operations.get(*args, **kwargs)¶ ãªã¢ã¼ããã¹ãããä¸ã¤ãããã¯è¤æ°ã®ãã¡ã¤ã«ããã¦ã³ãã¼ããã¾ãã get ã¯ãã¦ã³ãã¼ããããã¹ã¦ã®ãã¼ã«ã«ãã¡ã¤ã«ã¸ã®çµ¶å¯¾ãã¹ãå«ãå復å¯è½ãªãã¸ã§ã¯ããè¿ãã¾ããããã¯ãã local_path ãStringIOãªãã¸ã§ã¯ãã®å ´åã«ã¯ç©ºã«ãªãã¾ã(StringIOãªãã¸ã§ã¯ãå©ç¨æã«ã¤ãã¦ã®è©³ç´°ã¯ä¸ã®æ¹ãåç §ãã¦ãã ãã)ããã®ãªãã¸ã§ã¯ãã¯ã¾ãããã¦ã³ãã¼ãã«å¤±æ
注æ!!!! ãã®ããã¥ã¡ã³ãã¯Fabricãã¼ã¸ã§ã³1.10.1ã®æ¥æ¬èªè¨³ã§ãå¤ããã®ã§ãã ææ°ã®Fabric2.xã®ããã¥ã¡ã³ãã¯ãªãªã¸ãã«ã®è±èªããã¥ã¡ã³ãhttp://www.fabfile.org/ãåç §ãã¦ãã ããã å®è¡ã¢ãã«Â¶ æ¦è¦ã¨ãã¥ã¼ããªã¢ã« ããã§ã«èªãã§ããã®ãªããFabricãåºæ¬çãªã±ã¼ã¹(åä¸ã®ãã¹ãã«å¯¾ããåä¸ã®ã¿ã¹ã¯)ã§ã©ã®ããã«åä½ããã®ããåãããã¨æãã¾ããããããå¤ãã®å ´åãè¤æ°ã®ã¿ã¹ã¯ããã³/ã¾ãã¯è¤æ°ã®ãã¹ãã«å¯¾ããå®è¡ãæããã¨ã§ãããã大ããªã¿ã¹ã¯ãå°ããã¦åå©ç¨å¯è½ãªãã¼ãã«åããããä¸ç¾¤ã®ãµã¼ãã§å¤ãã¦ã¼ã¶ãåé¤ããããããã¨ãæããã¨æãã¾ãããã®ãããªã·ããªãªã§ã¯ããã¤ãã©ã®ããã«ã¿ã¹ã¯ãå®è¡ãããã®ç¹å®ã®ã«ã¼ã«ãå¿ è¦ã«ãªã£ã¦ãã¾ãã ãã®ããã¥ã¡ã³ãã§ã¯Fabricã®å®è¡ã¢ãã«ã説æãã¾ããã¡ã¤ã³ã®å®è¡ã«ã¼ãããã¹ããªã¹ãã®å®
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}