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

無限にスケールする上に自律的なJenkinsに見る夢~AWS篇~ / Dream of aut...

moznion
August 18, 2018

無限にスケールする上に自律的なJenkinsに見る夢~AWS篇~ / Dream of autonomous and infinite scalable Jenkins with AWS

Kyotoなんか #4の資料です

moznion

August 18, 2018
Tweet

More Decks by moznion

Other Decks in Technology

Transcript

  1. Why Jenkins? - ΋ͱ΋ͱ͸ (Ұ෦͸ࠓ΋) CircleCIΛ࢖͍ͬͯͨ - Job਺͕૿͑ΔʹͭΕ٧·Δqueue - ϓϥϯ্͛Δͱߴ͍ΜεΑ……

    - ΋ͬͱϚονϣͳϚγϯͰϏϧυ͍ͨ͠ͱ͍͏ཉ - ͦΖͦΖͪΌΜͱͨ͠σϓϩΠϑϩʔͱ͔Λ੔͍͑ͨ -
  2. Why Jenkins? - ΋ͱ΋ͱ͸ (Ұ෦͸ࠓ΋) CircleCIΛ࢖͍ͬͯͨ - Job਺͕૿͑ΔʹͭΕ٧·Δqueue - ϓϥϯ্͛Δͱߴ͍ΜεΑ……

    - ΋ͬͱϚονϣͳϚγϯͰϏϧυ͍ͨ͠ͱ͍͏ཉ - ͦΖͦΖͪΌΜͱͨ͠σϓϩΠϑϩʔͱ͔Λ੔͍͑ͨ - ΋ͱ΋ͱJenkinsΛεέʔϧͤ͞Δํ๏Λ஌͍ͬͯͨ
  3. Master Instanceਆ֨Խ - Jenkinsͷmaster data͸masterϚγϯͷ*ϩʔΧϧετϨʔδ*ʹ
 อଘ͞ΕΔ - Πϯελϯε͕ࢮΜͩΒऴΘΓ - ͔͠͠ࢮ͸ආ͚ΒΕͳ͍

    - ͔ͩΒόοΫΞοϓΛऔͬͨΓ͢Δ - e.g. https://papix.hatenablog.com/entry/2016/02/09/101918 - όοΫΞοϓ͔ΒͷϦετΞ͸࣮ࡍ໘౗ - ָ͍͠࢓ࣄͰ΋ͳ͍…… - μ΢ϯλΠϜग़Δ͠……
  4. AWS Elastic File System (EFS) - AmazonͷnfsΈ͍ͨͳ΍ͭ - Instanceʹmountͯ͠࢖͏ -

    EBS + nfsతͳ…… - ϘϦϡʔϜαΠζ͕ࣗಈͰ֦ுɾॖখ͢Δ - Disk full஌Βͣͷੜ׆
  5. AWS Elastic File System (EFS) - EBSͰ΋ྑ͍ͷͰ͸ʁ - ͸͍ʂɹEBSͷ΄͏͕͍҆͠ʂʂ -

    ͨͩEFS͸ϘϦϡʔϜࣗಈ֦ு͕خ͍͠ - (͏͔ͬΓdisk fullʹͳΒͳ͍) - ͋ͱEFSͩͱmulti masterΈ͍ͨͳ͜ͱ΋Ͱ͖Δ (ޙड़)
  6. Jenkins Multi Master - ଟ෼Ͱ͖Δ (௕࣌ؒӡ༻ͯ͠ͳ͍) - ͔͠͠CodeBuildͱڞଘ͍ͯ͠Δ؀ڥͰMulti Masterʹ͢Δ
 ϝϦοτ΄΅ͳ͘ͳ͍Ͱ͔͢ʁ

    - σϓϩΠ࣌ʹҰॠ2୆masterΛཱ͓͍ͯͯͯɼݹ͍ํΛ
 ࡴ͢Έ͍ͨͳ௿μ΢ϯλΠϜσϓϩΠ޲͚ͷ࢖͍ํ͸Մೳ
  7. Jenkinsͷӡ༻Λ୭͔ʹԡ͠෇͚ΔͷΛ΍ΊΔ - Amazon Elastic Beanstalk + Docker - Dockerfile +

    Dockerrun.aws.jsonʹΑΔߏ੒ͷίʔυԽ - .ebextensionsʹΑΔࣗಈԽ - EFS mountͳͲ - https://github.com/moznion/jenkins_eb_efs_codebuild_example
  8. Q?

  9. ͜ͷJenkinsʹ͸໰୊͕͋Δ - EFS͸஗͍ʂʂʂʂʂ - Jenkins͕git clone͢ΔͱϚδ͔͔࣌ؒΓ·͢ - git cloneΛճආ͢Δํ๏͸͍·ͷͱ͜Ζແ͍…… -

    shallow cloneΛ༗ޮʹ࢖͏ - sparse checkoutΛ༗ޮʹ࢖͏ - ͳͲͷ޻෉͕ඞཁ - ͦ΋ͦ΋CodeBuild͕git clone͢ΔΜͩ͠jenkins͸͠ͳͯ͘
 ྑ͍Μ͚ͩͲ…… - ͋Δ͍͸EBSΛ࢖͏……
  10. ຊ౰ʹJenkins͸ඞཁʁ - ͭ͡͸AWS CodeBuild͸࠷ۙΊͬͪΌͰ͖͕Αͯ͘ɼ
 ୯ମͰ΋े෼࢖͑Δ - GitHubͷhookड͚ΕΔ͠ - Commit statusΛม͑Δػೳ·Ͱ͍͍ͭͯΔ

    - Ϗϧυཤྺ΋ҰཡͰ͖Δ͠ - CloudWatch LogsʹϏϧυͷϩά΋ग़Δ - JenkinsෆཁͰ͸ʁʁʁʁɹ͜ΕͰे෼Ͱ͸ʁʁʁʁ - ͸͍
  11. Q?