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

CI Study with Vagrant & Chef

kazweda
January 27, 2017

CI Study with Vagrant & Chef

「CakePHPで学ぶ継続的インテグレーション」( http://book.impress.co.jp/books/1114101035 ) を読みながら、Chapter 04を最近のバージョンに置き換えて実践してみました。

kazweda

January 27, 2017
Tweet

More Decks by kazweda

Other Decks in Programming

Transcript

  1. CI؀ڥߏங
    Agile459 CI勉強会 in 松⼭

    View full-size slide

  2. Agile459 CIษڧձ in দࢁ
    GimpͰ࡞ͬͯΈ·ͨ͠

    View full-size slide

  3. Agile459 CIษڧձ in দࢁ
    ؀ڥઃఆͷલʹ
    ҽӘねᡭӘԽԑ՛԰
    4PVSDF)BO$PEF+1
    IUUQTHJUIVCDPNBEPCFGPOUTTPVSDFIBODPEFKQ
    "#$%&'()*+,-./0123456789:;
    BCDEFGHIJKLMNOPQRSTUVWXYZ[

    View full-size slide

  4. Agile459 CIษڧձ in দࢁ
    Ծ૝؀ڥΛ࡞ΔͨΊͷ؀ڥઃఆ
    NBD044JFSSBѫՃԡ԰04
    7JSUVBM#PYѫশᕵ04↯ဩӼᇴ⅁
    7BHSBOUѫশᕵ04Ә⼀ᇰѬゼಌգ✳६ѬԿՕԻԠՏԳ՛Ԙ
    7BHSBOUCPYѫIUUQTHJUIVCDPNDIFGCFOUP
    $IFGѫԿՕԻԠՏԳ՛ԘԬդՓ
    HJUѫԸդԠՏ՛☛ⅈ

    View full-size slide

  5. Agile459 CIษڧձ in দࢁ
    Ծ૝؀ڥΛ࡞ΔͨΊͷ؀ڥઃఆ
    )PNFCSFXәᦍቌ୾ӑӃѭ
    IUUQCSFXTIJOEFY@KBIUNM
    )PNFCSFXәંఌӘԯԋՔԗ԰ՒӕԹԫԙդԠӼԌ՛ԡ԰դՓӁѬ
    ӇӶӳӢӘԟ՛ՄՒԫԗՒ՛ԗӼVTSMPDBMӕਃӴӨӃѭ

    View full-size slide

  6. Agile459 CIษڧձ in দࢁ
    ϗετଆ(macOS sierra)ʹඞཁͳ΋ͷ
    ‣ 7JSUVBM#PYIUUQTXXXWJSUVBMCPYPSH
    ‣ 7BHSBOUIUUQTXXXWBHSBOUVQDPN
    QMVHJO4BIBSB WBHSBOUPNOJCVT WBHSBOUDBDIJFS
    ‣ $IFGCVOEMFS 3VCZӘԹԫԙդԠ☛ⅈԬդՓ
    ӑԌ՛ԡ԰դՓ
    HFNJOTUBMMCVOEMFS
    ‣ 7BHSBOUCPYѫIUUQTHJUIVCDPNDIFGCFOUP
    ‣ HJU
    YDPEFTFMFDUJOTUBMM

    View full-size slide

  7. Agile459 CIษڧձ in দࢁ
    git
    YDPEFTFMFDU049.BO1BHFT
    IUUQTHPPHM%7CQ
    YDPEFTFMFDUJOTUBMM
    XIJDIHJU
    VTSCJOHJU
    HJUWFSTJPO
    HJUWFSTJPO "QQMF(JU

    View full-size slide

  8. Agile459 CIษڧձ in দࢁ
    SourceTree
    ീ⢰ѷ(JU)VCӕ44)ᝇ❰ӑҷӵӲҰӕӃӵᢅᴿѸ
    IUUQTHPPHM+F7-
    4PVSDF5SFFӑ(JU)VCӕQVTIӃӵӒԐՑդѭ
    1FSNJTTJPOEFOJFE QVCMJDLFZ

    ǟ⽇⼊㒎ӘԽԉԌՓൻӼ➰㗶 JE@STB@IPHF
    ӃӵӒ⨿ҹӔҮ
    ǟ_TTIDPOGJHӮIPHFIPHFHJUDPOGJHӼ⽠ӽӑҹӶӔҮ
    ⽇⼊㒎ӘԽԉԌՓൻӼԯԽԑՓ԰ӕӁӐҴҹѭ
    _TTIJE@STB
    _TTIJE@STBQVC

    View full-size slide

  9. Agile459 CIษڧձ in দࢁ
    VagrantΛಈ͔ͯ͠ΈΔ
    WBHSBOUCPYӼ㈲ౢ 63-PSMPDBMGJMFPSCPYൻ

    WBHSBOUCPYBEE
    ਃᬟ⇹ԽԑՓԨӼਃᘻӁӐ┅ಌ
    WBHSBOUJOJU
    WBHSBOUVQ
    WBHSBOUTTI

    View full-size slide

  10. Agile459 CIษڧձ in দࢁ
    VagrantΛಈ͔ͯ͠ΈΔ
    ‣ 7BHSBOUGJMF⻱㈨ਦ
    7"(3"/5'*-&@"1*@7&34*0/
    7BHSBOUDPOGJHVSF 7"(3"/5'*-&@"1*@7&34*0/
    EP]DPOGJH]
    DPOGJHWNCPYPQTDPEFVCVOUV
    DPOGJHWNOFUXPSLQSJWBUF@OFUXPSL JQ
    FOE
    ‣ ゼಌ
    WBHSBOUVQ
    ‣ ՕԘԌ՛
    WBHSBOUTTI
    ‣ ુ᱑
    WBHSBOUIBMU

    View full-size slide

  11. Agile459 CIษڧձ in দࢁ
    Ծ૝؀ڥΛ࡞ΔͨΊͷ؀ڥઃఆ
    ‣ 7BHSBOU$IFG4PMPӕӲӵ⧞ಌԿՕԻԠՏԳ՛Ԙ
    CVOEMFSѫ3VCZӘԹԫԙդԠ☛ⅈԬդՓ
    ӼਜӍӐѬ
    DIFG LOJGFTPMP CFSLTIFMG
    ӼԌ՛ԡ԰դՓӃӵӉӫӕ(FNGJMFӼ➰㗶

    View full-size slide

  12. Agile459 CIษڧձ in দࢁ
    Ծ૝؀ڥΛ࡞ΔͨΊͷ؀ڥઃఆ
    ‣ (FNGJMFӼ➰㗶
    TPVSDFIUUQTSVCZHFNTPSH
    HFNDIFG
    HFNLOJGFTPMP
    HFNCFSLTIFMG _

    View full-size slide

  13. Agile459 CIษڧձ in দࢁ
    Ծ૝؀ڥΛ࡞ΔͨΊͷ؀ڥઃఆ
    $ gem install bundler
    Fetching: bundler-1.13.7.gem (100%)
    ERROR: While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/
    Gems/2.0.0 directory.
    $ which gem
    /usr/bin/gem
    できれば、sudo でシステム(OS)領域を触りたくない。

    View full-size slide

  14. Agile459 CIษڧձ in দࢁ
    Ծ૝؀ڥΛ࡞ΔͨΊͷ؀ڥઃఆ
    2JJUBӘ⻱॰
    ѷHFNJOTUBMMӑQFSNJTTJPOEFOJFEҿӶӨӁӉѸ
    IUUQTHPPHMI*M37P

    View full-size slide

  15. Agile459 CIษڧձ in দࢁ
    Ծ૝؀ڥΛ࡞ΔͨΊͷ؀ڥઃఆ
    ユーザ領域にインストール。
    $ gem install --user-install bundler
    $ which bundler
    /usr/local/rbenv/shims/bundler

    View full-size slide

  16. Agile459 CIษڧձ in দࢁ
    Ծ૝؀ڥΛ࡞ΔͨΊͷ؀ڥઃఆ
    MTMVTS
    UPUBM
    ESXYSYSYSPPUXIFFMCJO
    ESXYSYSYSPPUXIFFMJODMVEF
    ESXYSYSYSPPUXIFFMMJC
    ESXYSYSYSPPUXIFFMMJCFYFD
    ESXYSYSYSPPUXIFFMMPDBM
    㮢⍋∪㮣
    MTMVTSMPDBM
    UPUBM
    ESXYSYSYIPHFVTFSTUBGGCJO
    ESXYSXYSYSPPUBENJOMJC

    View full-size slide

  17. Agile459 CIษڧձ in দࢁ
    Ծ૝؀ڥΛ࡞ΔͨΊͷ؀ڥઃఆ
    XIJDICVOEMFS
    VTSMPDBMSCFOWTIJNTCVOEMFS
    XIJDISVCZ
    VTSCJOSVCZ
    SVCZW
    SVCZQ SFWJTJPO
    ǘ
    ӬҰ቎ӁՕդԓՓӔ↯ဩӕӁӉҮѭ

    View full-size slide

  18. Agile459 CIษڧձ in দࢁ
    Ծ૝؀ڥΛ࡞ΔͨΊͷ؀ڥઃఆ
    IUUQTHPPHM7VF
    BOZFOWӼਜӍӐөӉѭ
    HJUDMPOFIUUQTHJUIVCDPNSJZXPBOZFOW_BOZFOW
    FDIPFYQPSU1"5))0.&BOZFOWCJO1"5)_CBTI@QSPGJMF
    FDIPFWBM BOZFOWJOJU
    _CBTI@QSPGJMF
    TPVSDF_CBTI@QSPGJMF
    ǟBOZFOWӘ⷗ӼႌӁӐ஝⽠ө㈆өӃӶӚѬԟԡԮՈӘSVCZ↯ဩӕᙛӶӨӃѭ

    View full-size slide

  19. Agile459 CIษڧձ in দࢁ
    Ծ૝؀ڥΛ࡞ΔͨΊͷ؀ڥઃఆ
    BOZFOWJOTUBMMSCFOW
    SCFOWSFIBTI
    SCFOWJOTUBMM
    SCFOWHMPCBM
    CVOEMFJOTUBMM
    ീ⢰IUUQTHPPHMID+7/

    View full-size slide

  20. Agile459 CIษڧձ in দࢁ
    Ծ૝؀ڥΛ࡞ΔͨΊͷ؀ڥઃఆ
    XIJDISVCZ
    6TFSTIPHFVTFSBOZFOWFOWTSCFOWTIJNTSVCZ
    MTN_BOZFOWFOWTSCFOWTIJNT
    CFSLT CVOEMF CVOEMFS DIFGBQQMZ DIFGDMJFOU DIFG
    TIFMM DIFGTPMP DIFG[FSP FSC FSVCJT GGJZBKMCFODI
    HFN IUNMEJGG IUUQDMJFOU JSC LOJGF MEJGG NJOJUBS
    PIBJ QJSC QSVCZ SBDLVQ SBLF SEPD SJ STQFD SVCZ
    TFSWFSTQFDJOJU UIPS
    ҽӶӑԬդՓҶᡖҮӨӁӉѭ

    View full-size slide

  21. Agile459 CIษڧձ in দࢁ
    ։ൃ༻Ծ૝αʔόͷߏங
    ‣ ԿՕԻԠՏԳ՛ԘӘṍ૨
    CVOEMFFYFDLOJGFTPMPJOJUCFSLTIFMG
    ᒨ⺙ӔԯԋՔԗ԰Ւ᭜㉏ҶਃᘻҿӶӨӃѭ
    ‣ CVOEMFFYFD
    (FNGJMFӕ⻱㈨ӁӉ↯ဩӑᇴ⷗
    ‣ LOJGFTPMPJOJU
    SFDJQFӼਃӵӉӫӘԯԋՔԗ԰Ւ᭜㉏Ӽਃᘻ JFLJUDIFO

    IUUQTNBUTDIBGGFSHJUIVCJPLOJGFTPMP
    ‣ CFSLTIFMG
    DPPLCPPLTӘਸ਼ᆼ㕉ੋ☛ⅈԬդՓ

    View full-size slide

  22. Agile459 CIษڧձ in দࢁ
    ։ൃ༻Ծ૝αʔόͷߏங
    ‣ "CPVU#FSLTIFMG
    IUUQTEPDTDIFGJPCFSLTIFMGIUNM
    ‣ ᰪӘਃᬟ
    Ճԡ԰04Ԛԡ԰04㔿ӘԯԋՔԗ԰Ւஈ᥶
    1)1 OHJOY .Z42-Ԍ՛ԡ԰դՓ

    View full-size slide

  23. Agile459 CIษڧձ in দࢁ
    ։ൃ༻Ծ૝αʔόͷߏங
    ‣ ԯԋՔԗ԰Ւஈ᥶
    7BHSBOUGJMFӼ➰㗶
    IUUQTHPPHM3+UEXF
    WBHSBOUSFMPBEEFWFMPQ
    Ճԡ԰04ӘԓՔ՛԰ԯԋՔԗ԰Ւ஗BQQMJDBUJPOԽԑՓԨҶ
    শᕵԝդԸ EFWFMPQ
    Ә
    WBSXXXBQQMJDBUJPODVSSFOU
    Ӓஈ᥶ҿӶӨӃѭ

    View full-size slide

  24. Agile459 CIษڧձ in দࢁ
    ։ൃ༻Ծ૝αʔόͷߏங
    ‣ 1)1ѬOHJOYӘԌ՛ԡ԰դՓӒ⼀ᇰ
    CVOEMFFYFDLOJGFDPPLCPPLDSFBUFQIQFOWPTJUFDPPLCPPLT
    TJUFDPPLCPPLTQIQFOWSFDJQFEFGBVMUSCӼ➰㗶
    ⼳✦әҽӋӳ
    IUUQTHPPHM1$YV%2
    ‣ "UUSJCVUFTӕӎҮӐ
    IUUQTEPDTDIFGJPBUUSJCVUFTIUNM

    View full-size slide

  25. Agile459 CIษڧձ in দࢁ
    ։ൃ༻Ծ૝αʔόͷߏங - େ·͔ͳखॱ 1 / 2
    ‣ 1)1Ѭ.Z42-Ѭ/HJOYӘԌ՛ԡ԰դՓӒ⼀ᇰ
    TJUFDPPLCPPLTQIQFOWSFDJQFEFGBVMUSC
    ‣ ൵┣⼀ᇰӘఉᦆઙӼ➰㗶
    TJUFDPPLCPPLTQIQFOWBUUSJCVUFTEFGBVMUSC
    ‣ /HJOYӘԯԽԑՓ԰ԝԌ԰⼀ᇰ
    TJUFDPPLCPPLTQIQFOWUFNQMBUFTEFGBVMUEFGBVMUFSC
    ǟFUDOHJOYTJUFTBWBJMBCMFEFGBVMUҶ⇰ᘻҿӶӵѭ
    ‣ /HJOYӘԮԡ԰⇹ԸդԩՋՓՃԡ԰⼀ᇰ
    TJUFDPPLCPPLTQIQFOWUFNQMBUFTEFGBVMUUFTUFSC
    ‣ /HJOYӘԱԕՍՉ՛԰Փդ԰ӕ㌔⡕ӃӵJOEFYQIQ
    TJUFDPPLCPPLTQIQFOWUFNQMBUFTEFGBVMUJOEFYQIQFSC

    View full-size slide

  26. Agile459 CIษڧձ in দࢁ
    ։ൃ༻Ծ૝αʔόͷߏங - େ·͔ͳखॱ 2 / 2
    నӘԡՑԌԱӑ௲ᦸञҶӍӉՔԟԼӼӬӒӕѬ
    7BHSBOUGJMFӼ➰㗶ӁӐ
    ԿՕԻԠՏԳ՛ԘӼᇴ⷗
    WBHSBOUQSPWJTJPOEFWFMPQ
    ǟԯդԧՁդԡӔӓӃӣӐఉᦆೂҿӶӵӘӑҾᵍᖌӼѭ

    View full-size slide

  27. Agile459 CIษڧձ in দࢁ
    berkshelfͰcookbooksΛߋ৽ͯ͠provision
    ൵┣⼀ᇰԽԉԌՓӼ➰㗶ӁӉӳѬ
    SNSGDPPLCPPLT
    CVOEMFFYFDCFSLTWFOEPSDPPLCPPLT
    WBHSBOUQSPWJTJPOEFWFMPQ
    Ӽ⠊Ӵ㈘Ӄѭ

    View full-size slide

  28. Agile459 CIษڧձ in দࢁ
    JenkinsͷखಈΠϯετʔϧ
    ▸ BQU⇹ӘԕդӼ㈲ౢ
    XHFUR0IUUQQLHKFOLJOTDJPSHEFCJBO
    KFOLJOTDJPSHLFZ]TVEPBQULFZBEE
    ▸ BQUӕ+FOLJOTӘՒՅԠ԰ՒӼ㈲ౢ
    FDIPEFCIUUQQLHKFOLJOTDJPSHEFCJBOCJOBSZ]
    TVEPUFFBFUDBQUTPVSDFTMJTU
    ▸ Ԍ՛ԡ԰դՓ
    TVEPBQUHFUVQEBUF
    TVEPBQUHFUJOTUBMMZKFOLJOT

    View full-size slide

  29. Agile459 CIษڧձ in দࢁ
    JenkinsखಈΠϯετʔϧ࣌ͷΤϥʔ
    W: Can't drop privileges for downloading as file '/var/lib/
    apt/lists/partial/
    us.archive.ubuntu.com_ubuntu_dists_xenial_InRelease'
    couldn't be accessed by user '_apt'. - pkgAcquire::Run (13:
    Permission denied)
    ‣ ରॲ
    $ sudo chmod 777 /var/lib/apt/lists/partial

    View full-size slide

  30. Agile459 CIษڧձ in দࢁ
    JenkinsࣗಈΠϯετʔϧ - ࣦഊฤ
    TJUFDPPLCPPLTKFOLJOTSFDJQFTEFGBVMUSCӼ➰㗶
    BQU@SFQPTJUPSZKFOLJOTEP
    VSJIUUQTQLHKFOLJOTJPEFCJBOCJOBSZ
    LFZIUUQTQLHKFOLJOTJPEFCJBOKFOLJOTJPLFZ
    SFUSJFT
    SFUSZ@EFMBZ
    BDUJPOBEE
    FOE
    ❰ҹ

    View full-size slide

  31. Agile459 CIษڧձ in দࢁ
    JenkinsࣗಈΠϯετʔϧ - ࣦഊฤ
    Ԛԡ԰04 DJ
    ӕՕԘԌ՛
    WBHSBOUTTIDJ
    NPSFFUDBQUTPVSDFTMJTUEKFOLJOTMJTU
    EFCIUUQQLHKFOLJOTDJPSHEFCJBOCJOBSZ
    ҽӘԨԾՓԗԒդ԰Ҷ㊶㢕ӑԌ՛ԡ԰դՓҶ㉜ӨӔҮѭ
    ǟFUDBQUTPVSDFTMJTUӑҬӶӚ0,
    ӜӒӨӄTIFMMTDSJQUӑ༪㊙ѭ

    View full-size slide

  32. Agile459 CIษڧձ in দࢁ
    JenkinsࣗಈΠϯετʔϧ - shell scriptฤ
    TJUFDPPLCPPLTKFOLJOTSFDJQFTEFGBVMUSCӼ➰㗶
    CBTIKFOLJOTEP
    DPEF&0)
    XHFUR0IUUQTQLHKFOLJOTJPEFCJBOKFOLJOTJPLFZ
    ]TVEPBQULFZBEE
    TVEPFDIPEFCIUUQQLHKFOLJOTDJPSHEFCJBOCJOBSZ
    FUDBQUTPVSDFTMJTUEKFOLJOTMJTU
    &0)
    FOE
    ❰ҹ

    View full-size slide

  33. Agile459 CIษڧձ in দࢁ
    JENKINSಈ࡞֬ೝ
    http://192.168.33.100:8080/

    View full-size slide

  34. Agile459 CIษڧձ in দࢁ
    $IFGӘീ⢰7$$8 _W

    http://vccw.cc/
    ʮQiita: VCCW v3Ͱͷมߋ఺ͱ৽ػೳ·ͱΊʯ
    https://goo.gl/fH3UMU
    v2·Ͱ͸Chef͕࢖ΘΕ͍ͯͨɻv3͸Ansibleɻ
    VCCW(~v2) Ͱ SiteGuard WP Plugin Λ࢖͍͍ͨɻ
    -> FreeType ͕ඞཁɻ
    site-cookbooks/vccw/templates/default/default_configure_options.erb
    Λ։͍ͯԼهΛ௥Ճͯ͠ vagrant provision Λ࣮ߦɻ
    --with-freetype-dir=/usr
    ※ σʔλϕʔεͳͲॳظঢ়ଶʹ໭ΔͷͰ͝஫ҙΛ!!

    View full-size slide