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

레거시 위에서 재현 가능한 환경 구축하기

레거시 위에서 재현 가능한 환경 구축하기

레거시 위에서 재현 가능한 환경 구축하기

mingrammer

June 09, 2019
Tweet

More Decks by mingrammer

Other Decks in Programming

Transcript

  1. ۨѢद ਤীࢲ ੤അ оמೠ ജ҃ ҳ୷ೞӝ MinJae Kwon (@mingrammer) 2018.07.28

    HashiCorp Korea User Group (Build reproducible infrastructures on legacy)
  2. Name ӂ޹੤ (MinJae Kwon) Nickname @mingrammer Email [email protected] Who Game

    Server Engineer @ SundayToz Blog https://mingrammer.com Facebook https://facebook.com/mingrammer Github https://github.com/mingrammer Eng Blog https://medium.com/@mingrammer
  3. Table of Contents 2. 찾아온 문제들 :( 3. HashiCorp와의 만남

    - Vagrant 1. 기존의 개발환경 5. 마무리 4. HashiCorp와의 만남 - Terraform
  4. 기존의 개발환경 Live Live rsync rsync rsync Local Code Dev

    Server Stable Server Stage Server Live Server
  5. 기존의 개발환경 Live Live Deploy Server rsync rsync rsync rsync

    ssh Local Code Dev Server Stable Server Stage Server Live Server
  6. 기존의 개발환경 Live Live Deploy Server ssh ssh ssh ssh

    ssh Local Code Dev Server Stable Server Stage Server Live Server rsync rsync rsync rsync
  7. 기존의 개발환경 Live Live Deploy Server ssh ssh ssh ssh

    Local Code Dev Server Stable Server Stage Server Live Server file,script,… file,script,… file,script,… file,script,…
  8. 기존의 개발환경 Live Live Deploy Server Local Code Dev Server

    Stable Server Stage Server Live Server Becoming black boxes..
  9. 찾아온 문제들 :( ۽ஸ ٣ߡӦ੄ য۰਑ ׮઺ పझ౟ ࢲߡ੄ ೙ਃࢿ

    AWS۽੄ ੋ೐ۄ ੉੹ ߡӒ ߊࢤद ജ҃ ੤അ੄ য۰਑
  10. 찾아온 문제들 :( ۽ஸ ٣ߡӦ੄ য۰਑ Local Code Dev Server

    Stable Server Stage Server Local Server? remote dev port forwarding?
  11. 찾아온 문제들 :( ۽ஸ ٣ߡӦ੄ য۰਑ Local Code Dev Server

    Stable Server Stage Server Local Server? only deploy dev, test .. ۽ஸ ࢲߡ ೙ਃ
  12. 찾아온 문제들 :( ۽ஸ ٣ߡӦ੄ য۰਑ Local Code Dev Server

    Stable Server Stage Server Local Server? ৈక? Vagrant Box ޛۿ ੓঻਺
  13. 찾아온 문제들 :( ۽ஸ ٣ߡӦ੄ য۰਑ Local Code Dev Server

    Stable Server Stage Server Local Server? উجইх Vagrant Box ੄ޙ੄ ߅झ
  14. 찾아온 문제들 :( ۽ஸ ٣ߡӦ੄ য۰਑ Local Code Dev Server

    Stable Server Stage Server Local Server? Vagrant Box زੌೠ ജ҃਷ ݏա?
  15. 찾아온 문제들 :( ۽ஸ ٣ߡӦ੄ য۰਑ Local Code Dev Server

    Stable Server Stage Server remote dev log driven … ৈక ٣ߡӦਸ ۽Ӓ ӝ߈ਵ۽ ..
  16. 찾아온 문제들 :( ۽ஸ ٣ߡӦ੄ য۰਑ Local Code Dev Server

    Stable Server Stage Server Local Server? ࢲߡ ജ҃ ੿੄ܳ ௏٘۽ թѹঠೡ ೙ਃࢿਸ ו՝
  17. 찾아온 문제들 :( ׮઺ పझ౟ ࢲߡ੄ ೙ਃࢿ Dev Server Stable

    Server Stage Server QA పझ౟઺ Stage Server ژ ׮ܲ పझ౟ ೙ਃ
  18. 찾아온 문제들 :( ׮઺ పझ౟ ࢲߡ੄ ೙ਃࢿ Dev Server Stable

    Server Stage Server QA झਤட ೞݶࢲ زद పझ౟ पࣻ ਬߊ ↑
  19. 찾아온 문제들 :( ׮઺ పझ౟ ࢲߡ੄ ೙ਃࢿ Dev Server Stable

    Server Stage Server QA ೙ਃী ٮۄ ନযյ ࣻ ੓ח ജ҃ ೙ਃ Stage Server
  20. 찾아온 문제들 :( ߡӒ ߊࢤद ജ҃ ੤അ੄ য۰਑ Live Live

    Live Server Liveীࢲ ҟ৉ਵ۽ ߊࢤೞח ߡӒ ߊࢤ
  21. 찾아온 문제들 :( ߡӒ ߊࢤद ജ҃ ੤അ੄ য۰਑ Live Live

    Live Server әೞѱ ٣ߡӦਊ Live ࢲߡ ೞա ࠢৈঠೞח ࢚ട (۽Ӓ۽ ঌ ࣻ হח ߡӒ) Live Server
  22. 찾아온 문제들 :( ߡӒ ߊࢤद ജ҃ ੤അ੄ য۰਑ Live Live

    Live Server Live ࢲߡ ജ҃ਸ ੤അೡ ߑߨ੉ হয դх Live Server ??
  23. 찾아온 문제들 :( ߡӒ ߊࢤद ജ҃ ੤അ੄ য۰਑ Live Live

    Live Server әೠ؀۽ Live ࢲߡ੄ ܖ౟ ౵ੌ दझమ ؒ೐ (ଫଫ) Live Server ?? dump (tar pack/unpack ..)
  24. 찾아온 문제들 :( ߡӒ ߊࢤद ജ҃ ੤അ੄ য۰਑ Live Live

    Live Server Live Server Live Server Image ੉޷૑۽ ࢲߡ ೐۽࠺੷׬੉ оמೠ ജ҃ ೙ਃ
  25. 찾아온 문제들 :( AWS۽੄ ੋ೐ۄ ੉੹ Dev Server Live Live

    Live Server Dev Server Live Live Live Server
  26. 찾아온 문제들 :( AWS۽੄ ੋ೐ۄ ੉੹ Dev Server Live Live

    Live Server Dev Server Live Live Live Server Identical Identical
  27. 찾아온 문제들 :( AWS۽੄ ੋ೐ۄ ੉੹ Dev Server Stable Server

    Live Live Live Server Image Config Infra Def Image Config Infra Def Image Config Infra Def Image Config Infra Def Live Live Stage Server Need to build Reproducible & Automatic env Create / Update / Delete Create / Update / Delete
  28. HashiCorp와의 만남 :) ਃҳࢎ೦ 1. ݽٚ ݠनীࢲ زੌೠ ۽ஸ ࢲߡ

    ೐۽࠺੷׬ 2. ݺࣁ ߂ ߡ੹ ҙܻ оמೠ ੋ೐ۄ ೐۽࠺੷׬
  29. HashiCorp와의 만남 :) ਃҳࢎ೦ 1. ݽٚ ݠनীࢲ زੌೠ ۽ஸ ࢲߡ

    ೐۽࠺੷׬ 2. ݺࣁ ߂ ߡ੹ ҙܻ оמೠ ੋ೐ۄ ೐۽࠺੷׬
  30. HashiCorp와의 만남 :) ਃҳࢎ೦ 1. ݽٚ ݠनীࢲ زੌೠ ۽ஸ ࢲߡ

    ೐۽࠺੷׬ 2. ݺࣁ ߂ ߡ੹ ҙܻ оמೠ ੋ೐ۄ ೐۽࠺੷׬
  31. HashiCorp와의 만남 :) Vagrant۽ ۽ஸ ࢲߡ ҳࢿ 1. ೐۽࠺੷׬ ݺࣁ

    ౵ੌੋ Vagrantfile ੘ࢿ 2. Run vagrant up (or vagrant up --provision) 3. Run vagrant provision 4. Access via vagrant ssh
  32. HashiCorp와의 만남 :) Vagrant۽ ۽ஸ ࢲߡ ҳࢿ Base image Port

    forwarding Provider Upload file Run script (ױੌ ݠन Vagrantfile)
  33. HashiCorp와의 만남 :) Vagrant۽ ۽ஸ ࢲߡ ҳࢿ Game 1 Php7

    Github SSH forwarding Set env vars Using host ssh key
  34. HashiCorp와의 만남 :) Vagrant۽ ۽ஸ ࢲߡ ҳࢿ Define box (׮઺

    ݠन Vagrantfile) Define box Provision:1 Provision:2 Provision:3 Provision:3
  35. HashiCorp와의 만남 :) Vagrant۽ ۽ஸ ࢲߡ ҳࢿ Game 2 Php5

    Php7 Github vagrant up php7 vagrant up php5 vagrant ssh php7 vagrant ssh php5 … …
  36. HashiCorp와의 만남 :) Vagrant۽ ۽ஸ ࢲߡ ҳࢿ Game 1 Php5

    Game 2 Php5 Php7 New? IDE Easy remote debugging
  37. HashiCorp와의 만남 :) য۰ਛ؍੼ 1. ۨѢद ௏٘о ࢎਊೞח ಁః૑ ୶੸੉

    য۰ਛ਺ 2. ӝઓ పझ౟ ࢲߡ৬ OS ജ҃੉ ׳ۄ 100% ੤അ੄ ࠛഛपࢿ (ޙઁ ߊࢤ) 3. ࠛ೙ਃೠ ؘ੉ఠ ߂ ௏٘ Ѣܰӝ 4. ۽ஸ ࢲߡ DB ੗୓ ҳࢿ
  38. HashiCorp와의 만남 :) աই૓੼ 2. ۽ஸ ٣ߡӦ੉ ࣻਘ೧૗ 3. ࢲߡ

    ҳࢿ੉ ݽف ௏٘۽ թই ୶੸੉ ਊ੉ 4. ׮ܲ ੉ग ѐߊद ࢜۽਍ ജ҃ ҳࢿೞӝо ࣻਘ೧૗ 1. ࢲߡо ௿ܽ೧૗
  39. HashiCorp와의 만남 :) ਃҳࢎ೦ 1. ݽٚ ݠनীࢲ زੌೠ ۽ஸ ࢲߡ

    ೐۽࠺੷׬ 2. ݺࣁ ߂ ߡ੹ ҙܻ оמೠ ੋ೐ۄ ೐۽࠺੷׬
  40. HashiCorp와의 만남 :) Terraformਵ۽ ੋ೐ۄ ੗زച (పझ౟ ࢲߡ ജ҃) AWS

    ੋ೐ۄ ੉੹ ҅ദਵ۽ AWS ӝ߈ਵ۽ పझ౟ ࢲߡ ੋ೐ۄ ੤ҳ୷
  41. HashiCorp와의 만남 :) Terraformਵ۽ ੋ೐ۄ ੗زച 1. .tf, .tfvars١ ੋ೐ۄ

    ੿੄ ౵ੌ ੘ࢿ 2. ੸ਊद ߸ೡ ੋ೐ۄ ࢚క ഛੋਸ ਤೠ terraform plan प೯ 3. पઁ ੸ਊਸ ਤೠ terraform apply प೯ 4. ੋ೐ۄ ୹۱ч ഛੋ
  42. HashiCorp와의 만남 :) Terraformਵ۽ ੋ೐ۄ ੗زച Dev Stable Stage Network

    Compute vars/config vars/config vars/config Dev Stable Stage
  43. HashiCorp와의 만남 :) Terraformਵ۽ ੋ೐ۄ ੗زച Ӓؘ۠ AMIח য٣ࢲ? ੋ೐ۄ

    ੿੄۽ࠗఠ ੋझఢझܳ ࢤࢿೞӝ ਤ೧ࢶ AMIо ೙ਃ
  44. HashiCorp와의 만남 :) 1. Amazon EBS ఋੑਵ۽ 2. Ubuntu 16.04ܳ

    ߬੉झ۽ 3. base.shܳ ೐۽࠺੷׬ ೠ ٍ 4. manifest.jsonী ୹۱ ੷੢ ݠन ੉޷૑ ࢤࢿ ੗زച
  45. HashiCorp와의 만남 :) Terraformਵ۽ ੋ೐ۄ ੗زച Live Live Server Image

    .tf Developer Scripts Files Scripts ੉޷૑ח Terraform੉ ইפযب ױੌ Live ࢲߡ ೐۽࠺੷׬द ࢎਊ оמ
  46. Dev Server Stable Server Image Config Infra Def Image Config

    Infra Def Image Config Infra Def Live Live Stage Server HashiCorp와의 만남 :) Terraformਵ۽ ੋ೐ۄ ੗زച
  47. HashiCorp와의 만남 :) աই૓੼ 2. ੋ೐ۄ ೐۽࠺੷׬੉ ই઱ ಞܻ೧૗ 3.

    ੋ೐ۄ ҳࢿ੉ ݽف ௏٘۽ թই ୶੸੉ ਊ੉ 1. ࢲߡо ௿ܽ೧૗ 4. ੋझఢझ ղܽ ٍীب ੿ഛ൤ زੌೠ ജ҃ ҳࢿ оמ
  48. HashiCorp와의 만남 :) թই ੓ח ޙઁ 1. ই૒ ۽ஸ ࢲߡ੄

    ജ҃ ҳࢿ ߸҃ਸ ૊द ޅٮۄх 2. tfstate, tf ؘ੉ఠ ҙܻ 3. ೐۽؋࣌ ࢲߡীח ই૒ ੸ਊਸ ޅ೧ࠆ (௏٘ ੉੹ ੉ग) 4. DevOps, IaC ޙച 5. ࢲߡ ೐۽࠺੷׬җ ௏٘ ߓನ ೐۽ࣁझ੄ ѐࢶ ৈ૑о ݆਺
  49. 마무리 ੤അ оמೠ ജ҃਷ ҳࢿ೮ਵա ѐࢶ ৈ૑ח ৈ੹൤ ݆਺ ୭ઙ੸ਵ۽

    ೐۽؋࣌ীࢲ ࢎਊೡ ࣻ ੓ਸ૑ח ޷૑ࣻ૑݅ PoCח ૓೯ ৘੿ IaCח ై੗ೡ݅ೠ о஖о ੓ח Ѫ э਺. ױ, ೟ण ࠺ਊҗ ҳ୷(?) ࠺ਊ਷ хউ೧ঠ بҳب بҳ૑݅ ੿੄ա ݺࣁ ౵ੌٜ੄ ߡ੹ҙܻо ೨बੋ Ѫ э਺