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

CodeDeployを使ったアプリケーションデプロイを考える

Ee92a1618b3853c52168612a0cbe47cb?s=47 toshihirock
September 16, 2015

 CodeDeployを使ったアプリケーションデプロイを考える

Ee92a1618b3853c52168612a0cbe47cb?s=128

toshihirock

September 16, 2015
Tweet

Transcript

  1. CodeDeployΛ࢖ͬͨΞϓϦ έʔγϣϯσϓϩΠΛߟ͑Δ  +"846(ΞʔΩςΫνϟઐ໳ࢧ෦ $%1ٞ࿦ձ !UPTIJIJSPDL

  2. ࣗݾ঺հ ɾ@toshihirock ɾAWSۀ຿͸൒೥͙Β͍ ɾ޷͖ - CodeDeploy - Podcast - ϫʔϧυτϦΨʔ

  3. ࠓ೔࿩͞ͳ͍͜ͱ ɾElasticBeanstalk ɾOpsWorks ɾͦ΋ͦ΋EC2࢖Θͳ͍ͱ͔ͷ࿩(ECS΍ Lambda΁ͷஔ͖׵͑)

  4. ٞ࿦͍ͨ͜͠ͱ

  5. Φʔτεέʔϧ΁ͷΞϓϦέʔ γϣϯͷσϓϩΠͲ͏ͯ͠·͔͢

  6. ΦʔτεέʔϧͰͷΞϓϦσϓϩΠ ɾҎԼͷ̎ͭʹ͍ͭͯݕ౼͢Δඞཁ͕͋Δ - ࣗಈͰىಈ͢ΔEC2΁ͷσϓϩΠ - طʹىಈ͍ͯ͠ΔEC2΁ͷσϓϩΠ

  7. σϓϩΠํ๏ ɾىಈ͢ΔAMIʹσϓϩΠ͓ͯ͘͠ ɾΦʔτεέʔϧ࣌ʹσϓϩΠ ɹ- UserData(shellscript || cloud-init) - AutoScaing LifeCycleHook

    - σϓϩΠπʔϧ(Fabric || Capistrano) - Chef || Puppet || Ansible ɹ- Թ΋Γͷ͋ΔΦϨΦϨεΫϦϓτ - CodeDeploy New!
  8. None
  9. CodeDeploy ɾAWSۘ੡ͷσϓϩΠπʔϧɻσϓϩΠ͢Δϓϩάϥϛϯά ݴޠʹ੍ݶ͸ͳ͍ ɾ࠷ۙTokyoϦʔδϣϯͰ΋࢖͑Α͏ʹ ɾಛఆͷλά΋͘͠͸ࢦఆͨ͠ΦʔτεέʔϧʹΞϓϦΛσϓ ϩΠͰ͖ΔɻΦʔτεέʔϧͰͷEC2૿Ճ࣌ͷࣗಈద༻Մೳ ɾιʔε͸S3΋͘͠͸GitHub ɾҰͭͷΞϓϦέʔγϣϯʹର͠ɺෳ਺ͷ؀ڥΛઃఆͰ͖Δ (Production,Dev etc)

    ɾಛఆͷϦϏδϣϯʹ໭ΕΔ ɾappspec.ymlͱ͍͏ϑΝΠϧʹͲͷλΠϛϯά (CodeDeployಠࣗͷϥΠϑαΠΫϧ)ͰԿΛ͢Δ͔ࢦఆ(࣍ทࢀ র)
  10. version: 0.0 os: linux files: - source: / destination: /var/www/html/WordPress

    hooks: ApplicationStop: - location: scripts/stop_server.sh timeout: 300 runas: root AfterInstall: - location: scripts/change_permissions.sh timeout: 300 runas: root ApplicationStart: - location: scripts/start_server.sh timeout: 300 runas: root
  11. Fabric΍Capistranoͱͷҧ͍ ɾϝϦοτ - σϓϩΠ༻αʔόʔ͕ෆཁ - Φʔτεέʔϧ࣌ͷࣗಈద༻ - GUIͰͷૢ࡞͕Ͱ͖Δ ɾσϝϦοτ -

    AgentΛEC2ʹΠϯετʔϧ͢Δඞཁ͋Γ - Internet΁ͷΞΫηε͕ඞཁ(VPCΤϯυϙ Πϯτཉ͍͠ʣ
  12. ϘΫϊΧϯΨΤλσϓϩΠ

  13. BlueGreenDeployment

  14. ҰͭͷΦʔτεέʔϧͰͷӡ༻ CodeDeployࣗମʹσϓϩΠத΍ࣦഊ࣌ʹΦʔτεέʔϧ͔Βग़Δػೳ͸ͳ͍ͷͰ஫ҙɻҎԼࢀরɻ CodeDeployͰͷσϓϩΠࣦഊ࣌΍σϓϩΠதʹELB͔ΒτϥϑΟοΫ͕ྲྀΕΔͷΛ๷͙ํ๏ (http://qiita.com/toshihirock/items/b23f44dcd9f07f36bcfc)

  15. ·ͱΊ ɾCodeDeploy͸σϓϩΠʹϑΥʔΧεͨ͠ πʔϧͰطଘ؀ڥ΁΋ద༻͠΍͍͢ ɾσϓϩΠࣦഊ࣌ͷڍಈʹ͍ͭͯ͸༧Ί֬ೝ ͓ͯ͘͠ ɾ΋ͬͱྑ͍ํ๏͋ΔΑʂͳͲ͋Ε͹ڭ͑ͯ Լ͍͞ɻ

  16. Appendix1 ɾCodeDeploy͸Φʔτεέʔϧద༻࣌ɺ UserData(shell script || cloud-init)ΑΓޙͰ࣮ ߦ͞ΕΔ ɾσϓϩΠΛOneAtTimeͰ࣮ߦ͠ɺࣦഊͨ͠ ৔߹ʹ͸Ҏ߱ͷσϓϩΠ͸࣮ࢪ͠ͳ͍ ɾ࠷৽ͷσϓϩΠ͕ࣦഊͨ͠λΠϛϯάͰΦʔ

    τεέʔϧ͕࣮ߦ͞ΕΔͱ࠷৽ͷ੒ޭόʔδϣ ϯ͕σϓϩΠ͞ΕΔ
  17. Appendix2 SlackΛ࢖ͬͯCodeDeploy Heroku+HubotͰCodeDeployͷσϓϩΠΛSlack͔Β࣮ߦ͢Δ (http://qiita.com/toshihirock/items/7598ab59b2c687b77cb6)

  18. Thanks!