Chefå®è·µå ¥éãèªãã
Chefå®è·µå ¥é ~ã³ã¼ãã«ããã¤ã³ãã©æ§æã®èªåå (WEB+DB PRESS plus)
- ä½è : åç¾½é¾å¤ªé,å®è¤ç¥ä»,ä¼è¤ç´ä¹,è äºç¥å¤ªæ,並河ç¥è²´
- åºç社/ã¡ã¼ã«ã¼: æè¡è©è«ç¤¾
- çºå£²æ¥: 2014/05/22
- ã¡ãã£ã¢: åè¡æ¬ï¼ã½ããã«ãã¼ï¼
- ãã®ååãå«ãããã° (18件) ãè¦ã
æ¬æ¸ãèªãåã«å®è·µ Vagrantãèªãã§ãã¦ãvagrantã³ãã³ãã試ããããboxãä½ã£ãããshellã§ãããã¸ã§ãã³ã°ã試ããã ãã®ã¨ãã«ãããã¸ã§ãã³ã°ã«Chef Soloã使ãããã¨ãç¥ã£ãããChefã«å¯¾ãã¦ã¯å°ãé¢åãªå°è±¡ãæã£ã¦ãããããChef Soloããããã¸ã§ãã³ã°ã§å©ç¨ããã¤ããã¯ãªãã£ãã
æ¬æ¸ã®ãã¨ãç¥ã£ã¦ç®æ¬¡ã確èªããã¨ãããVagrantã使ã£ãChefã®è§£èª¬ãããããã ã£ãã®ã§ããã«èå³ãæã£ã¦èªãã ã
主ã«èªãã ã®ã¯ã2ç« ã5ç« ã¨6ç« ã6ç« ã®mysqlã®æ§ç¯ã¾ã§ã¯ãå®éã«Vagrantã使ã£ã¦è©¦ãããã¾ãã試ãã¦ããã¨ãã«ãªã½ã¼ã¹ã®ç¢ºèªã§3ç« ãèªãã ã
Chefã«å¯¾ããèªèãå¤ãã£ãã®ã¯ã2.10ç¯ã®ãChefã®èãæ¹ãã«è¿°ã¹ããã¦ãã
- ãæé ãã§ã¯ãªããç¶æ ããå®ç¾©ãã
- ç¶æ ããåæã(convergence)ããã
ã¨ããã¨ããã
ããã¾ã§ã¯ç°å¢ãæ§ç¯ããããæé æ¸ãè¨è¿°ãã¦ãããããªæãã§ããããå®ç§ã«è¡ããããã«ç´°ããè¨å®ãã¦ããããè¨å®å 容ãç ©éã«ãªã£ã¦ãã¾ã£ã¦ããã
ããã§Chefã«å¯¾ãã¦å°ãé¢åãªå°è±¡ãæã¤ãã¨ã«ãªã£ãã®ã ããæé ã§ã¯ãªãç¶æ ã¨ãã¦ãããã¦ãããåæããããã¨ããæãæ¹ã«ãã£ã¦ãèªåããã®ç°å¢ã«æå¾ ããç¶æ ãå°ããã¤å®ç¾©ãããã¨èããããã«ãªã£ãã
ä»ã§ã¯ãVagrantã®ãããã¸ã§ãã³ã°ã¯Chef Soloã§è¡ã£ã¦ãããCookbookã®ä½æã¯6ç« ã®æé ãåèã«ããã
ä¾ãã°ãfooã¨ããCookbookãä½æãããªã以ä¸ã®ã¨ããã
1. site-cookbooksãã£ã¬ã¯ããªã«Cookbookãä½æãã
$ bundler exec knife cookbook create foo -o site-cookbooks
2. Berksfileã«ä½æããCookbookãè¨è¿°ãã
cookbook "php", path: "./site-cookbooks/foo"
3. ã¬ã·ããè¨è¿°ãã
$ vi site-cookbooks/foo/recipes/default.rb
ã²ã¨ã¾ãdefaultã®ã¬ã·ãã«ãã¹ã¦è¨è¿°ã
4. berksã³ãã³ãã§cookbooksãã£ã¬ã¯ããªãææ°ã«ãã
$ rm -rf cookbooks && bundle exec berk vendor cookbooks
ããã¯æ¬æ¸ã®æ¹æ³ã¨ã¯ç°ãªããæ¬æ¸ã§ã¯
$ bundle exec berks install --path ./cookbooks
ã¨ããããberkshelfã®3.1.5ã§ãããå®è¡ããã¨ãã
DEPRECATED: `berks install --path [PATH}` has been replaced by `berks vendor`.
DEPRECATED: Re-run your command as `berks vendor [PATH]` or see `berks help vendor`.
ã¨è¡¨ç¤ºãããã®ã§ããã®ã¡ãã»ã¼ã¸ã«å¾ã£ã¦ãä¸è¿°ã®ã³ãã³ããå®è¡ãã¦ããã
5. Vagrantã«èªä½ããCookbookã®ã¬ã·ãã追å
chef.run_list = %w[
...
recipe[foo]
]
6. vagrantã®ãããã¸ã§ã³ãå®è¡
$ vagrant provision
ãã®æµãã§ã²ã¨ã¾ãã¬ã·ããä½æãåä½ã確èªããã
- defaultã®ã¬ã·ããåå²ãã¦åä½ç¢ºèª
- å®æ°ãattributeã«å®ç¾©ãã¦åä½ç¢ºèª
- Vagrantfileã«attributeãè¨å®ãã¦åä½ç¢ºèª
ã®ããã«å°ããã¤ç¹°ãè¿ãå¤æ´ãã¦ãåå©ç¨ããããããã«å¤æ´ãã¦ããã
ã¡ãªã¿ã«ã対象ã®ããã¯ã¹ã¯CentOS 6.5 minimal x86_64ã®ããã¯ã¹ãèªä½ãã¦ãã¦ãrvmã¨Chefãã¤ã³ã¹ãã¼ã«æ¸ã
rvmãã¤ã³ã¹ãã¼ã«ããã®ã¯ãéçºç°å¢ç¨ã¨ãã¦mailcatcherãã¤ã³ã¹ãã¼ã«ãããã£ãããCentOS 6.5ã®ruby(1.8.6)ã§ã¯ã¤ã³ã¹ãã¼ã«ã§ããªãã£ãããã
ãã ããããã¨ãããvagrant-omnibusãã©ã°ã¤ã³ã¨ã®ç¸æ§ãæªãã¦å©ç¨ã§ããªããªã£ããããrvmä¸ã«Chefãã¤ã³ã¹ãã¼ã«ããboxåããã
æ¬æ¸ã«ãã£ã¦Chefã®å°è±¡ãå¤ãããVagrantã®ãããã¸ã§ã³ãChef Soloã§è¡ãããã«ãªããªã©ãèªåã®èªèã¨ç°å¢ã大ããå¤ãã ä¸åã¨ãªã£ãã