Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
create_prod_and_dev_vm_image_atst_by_packer
Search
Tatsuro Mitsuno
July 07, 2016
Technology
0
11k
create_prod_and_dev_vm_image_atst_by_packer
UZABASE Meetup#4 〜大規模サービスを支えるインフラ〜
#UzabaseMeetup
1コマンドで本番サーと開発サーバのVMイメージを作る話
Tatsuro Mitsuno
July 07, 2016
Tweet
Share
More Decks by Tatsuro Mitsuno
See All by Tatsuro Mitsuno
マルチアカウントでのIAMユーザー把握と可視化 IAMユーザー棚卸しへの取り組み / Understanding and Visualizing IAM Users with Multiple Accounts
kotatsu360
2
4.4k
AWS Configを用いたマルチアカウント・マルチリージョンでのリソース把握とコンプライアンス維持への取り組みについて / Using AWS Config for Multi-Account, Multi-Region Resource Understanding and Maintaining Compliance
kotatsu360
3
5.1k
AWS Single Sign-Onを用いた、セキュアでより良いログイン体験への取り組み / AWS Single Sign-On for a better experience and more secure login
kotatsu360
3
4.5k
【解説】第7章 はじめての本番デプロイ / zozotechbook1-ch07-deploypipeline
kotatsu360
0
1.3k
ZOZO Researchの研究活動を支える Amazon SageMaker 利用 導入課題の解決と展開について / Using Amazon SageMaker to Support ZOZO Research Activities
kotatsu360
2
690
jdk-1812-mugt-session-latter-half-iqon-crawler-on-mesos
kotatsu360
1
1.2k
IQON Crawler BackEnd ~AWS Managed Service makes women beautiful~
kotatsu360
2
13k
goodby-waiting-status-forever
kotatsu360
3
770
Apache Mesos with Amazon EC2 SpotFleet
kotatsu360
4
1.6k
Other Decks in Technology
See All in Technology
Adopting Jetpack Compose in Your Existing Project - GDG DevFest Bangkok 2024
akexorcist
0
110
適材適所の技術選定 〜GraphQL・REST API・tRPC〜 / Optimal Technology Selection
kakehashi
1
610
Taming you application's environments
salaboy
0
190
マルチプロダクトな開発組織で 「開発生産性」に向き合うために試みたこと / Improving Multi-Product Dev Productivity
sugamasao
1
310
B2B SaaSから見た最近のC#/.NETの進化
sansantech
PRO
0
830
第1回 国土交通省 データコンペ参加者向け勉強会③- Snowflake x estie編 -
estie
0
130
オープンソースAIとは何か? --「オープンソースAIの定義 v1.0」詳細解説
shujisado
9
1k
Python(PYNQ)がテーマのAMD主催のFPGAコンテストに参加してきた
iotengineer22
0
480
iOS/Androidで同じUI体験をネ イティブで作成する際に気をつ けたい落とし穴
fumiyasac0921
1
110
プロダクト活用度で見えた真実 ホリゾンタルSaaSでの顧客解像度の高め方
tadaken3
0
110
OCI 運用監視サービス 概要
oracle4engineer
PRO
0
4.8k
なぜ今 AI Agent なのか _近藤憲児
kenjikondobai
4
1.4k
Featured
See All Featured
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
506
140k
Become a Pro
speakerdeck
PRO
25
5k
Site-Speed That Sticks
csswizardry
0
25
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
720
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
Side Projects
sachag
452
42k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
It's Worth the Effort
3n
183
27k
Keith and Marios Guide to Fast Websites
keithpitt
409
22k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
47
2.1k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Transcript
7"4*-: *OD ίϚϯυͰ ຊ൪αʔόͱ։ൃαʔό ͷ7.Πϝʔδ Λ࡞Δ 6;"#"4&.FFUVQ ʙେنαʔϏεΛࢧ͑ΔΠϯϑϥʙ
7"4*-: *OD ࣗݾհ w ޫୡ࿕5BUTVSP.JUTVOP !LPUBUTV w 7"4*-: *OD*OGSB&OHJOFFS
w ʙ w ҆ͯͯ҆͘͘શͳΠϯϑϥΛ࡞Δ w ੜ࢈ੑΛ্ͤ͞ΔऔΓΈ झຯ *DPOJMMVTUSBUFECZ:04)* IUUQTXXXGBDFCPPLDPNZPTIJZPOF
7"4*-: *OD
7"4*-: *OD &$*OTUBODF w BQQMJDBUJPO XFC BQJ CBUDI DSBXMFS
ʜ w NJEEMFXBSF PQT BE TPMS SFEJT OBU ʜ (PPHMF$MPVE&OHJOFগ͠ J20/
7"4*-: *OD ίϚϯυͰຊ൪ˍ։ൃαʔόΛ࡞Δ J20/αʔόͷ࡞Γํ QBDLFSCVJMECBTFKTPO WBHSBOUCPY BXTFDBNJ HDFJNBHF
શ෦Ͱ͖Δ
7"4*-: *OD ܦҢɿΞϓϦέʔγϣϯαʔόͷҠߦ w ʙ w $FOU046CVOUV w 3VCZʢҰ෦
w DIFGͱTQFD͋ͬͨ w ʮखݩͷ7.Ͱݕূͯͦ͠ͷ7.Λຊ൪Ͱͦͷ··͑ͨΒ͍͍ͷʹʯ
7"4*-: *OD ઓུ w ݱঢ়ͷࢿ࢈Λ༗ޮ׆༻ ߏཧ$IFG w ຊ൪։ൃಉ͡ϨγϐͰߏཧ͢Δ ࠩҟ$IFGͷ&OWJSPONFOUTͰԿͱ͔͢Δ w
ࠓޙͷߋ৽͕༰қɾຊ൪ͱ։ൃͷဃΛى͜͞ͳ͍ ΞΫγϣϯͰߋ৽Ͱ͖ΔૉఢͳԿ͔Λ͏
7"4*-: *OD ɹɹ1BDLFSCZ)BTIJ$PSQ w )BTIJ$PSQ w ༷ʑͳϓϥοτϑΥʔϜ্ͷϚγϯΠϝʔδΛ࡞ΔͨΊͷπʔϧ w ઃఆϑΝΠϧ+40/ w
ϓϥοτϑΥʔϜͱϓϩϏδϣϯπʔϧͷΈ߹Θͤࣗ༝ w #VJME 1SPWJTJPOΛҰ࿈ͷྲྀΕͱ࣮ͯ͠ߦ
7"4*-: *OD ઃఆϑΝΠϧ Ұ෦ $ cat base.json { "builders":[ {"type":
"virtualbox-ovf"}, {"type": "amazon-ebs" }, {"type": "googlecompute" } ], "provisioners": [ { "type": "chef-client" } ] } ˞࣮ࡍʹඞਢͷύϥϝʔλ͕ଞʹ͋Γ·͢ Vagrant BoxͷݩʹͳΔVirtualBox Amazon EC2 AMI Google Compute Engine Image VMʹchef-clientͰߏཧ
7"4*-: *OD ઓུ w ✅ݱঢ়ͷࢿ࢈Λ༗ޮ׆༻ ϓϩϏδϣχϯά$IFG w ຊ൪։ൃಉ͡ϨγϐͰߏཧ͢Δ ࠩҟ$IFGͷ&OWJSPONFOUTͰԿͱ͔͢Δ w
✅ࠓޙͷߋ৽͕༰қɾຊ൪ͱ։ൃͷဃΛى͜͞ͳ͍ ΞΫγϣϯͰߋ৽Ͱ͖ΔૉఢͳԿ͔Λ͏
7"4*-: *OD $IFGͷߏ w ࢠؔΛ࣋ͬͨSPMFʷFOWJSPONFOUͰදݱ
7"4*-: *OD SPMFT Ұ෦ w QBDLFSCBTFDPOpHVSFKTPO w QBDLFSBQJCBTFDPOpHVSFKTPO w QBDLFSBQJBQJDPOpHVSFKTPO
w QBDLFSBQJCBUDIDPOpHVSFKTPO w QBDLFSXFCDPOpHVSFKTPO ֤ϊʔυͷϩʔϧΛಡΈࠐΉ ͷमਖ਼ඞͣऔΓࠐΉ
7"4*-: *OD Ұྫ QBDLFSBQJCBTF DPOpHVSFKTPO QBDLFSBQJBQJ DPOpHVSFKTPO "run_list": [ "role[packer-base-configure]",
"recipe[fluentd]", ... "run_list": [ "role[packer-api-base-configure]", "recipe[nginx]" ]
7"4*-: *OD &OWJSPONFOUT w QBDLFS w WBHSBOU w TUBHJOH w
QSPEVDUJPO w 44)ͷઃఆɾ伴 w ࢹͷ༗ແ w %/4पΓͷઃఆ w ϩάίϨΫλʔͷઃఆ ཧ
7"4*-: *OD Ұྫ WBHSBOU w 伴WBHSBOUͷ JOTFDVSF@QSJWBUF@LFZ w ࢹPGG w
UEBHFOUͷDPOGίϝϯτ Ξτ͞ΕΔ w ϩʔΧϧσϓϩΠ༻ʹ DBQJTUSBOPΛγεςϜʹՃ QSPEVDUJPO w 伴ຊ൪༻ͷൿີ伴 w ࢹPO w UEBHFOUͷDPOG͕༗ޮͳঢ় ଶͰஔ͔ΕΔ
7"4*-: *OD "84ʹαʔόΛཱͯΔ༷ࢠ $ cat /path/to/chef-repo/nodes/packer-base.json { "name": "packer-base", "chef_environment"
: "packer", "run_list": [ "role[packer-base-configure]" ] } $ packer build base.json # => ruby2.3.1ΛೖΕͨΓmackerel-agentΛೖΕͨΓ # => packer-ubuntu1604-ruby231-{{timestamp}}ͱ͍͏໊લͷAMI͕Ͱ͖Δ
7"4*-: *OD "84ʹαʔόΛཱͯΔ༷ࢠ # packerͰ࡞ͬͨ࠷৽ͷAMI-IDΛऔͬͯ͘ΔϫϯϥΠφʔ $ aws ec2 describe-images
--owners self \ | jq '.Images[]|select((select(.Name != null)|.Name|contains("packer-ubuntu")))' \ | jq 'sort_by(.CreationDate)|reverse|.[0].ImageId' --slurp -r ami-12345678 # => ͜ͷAMIͰΠϯελϯεΛཱͯΔ # => ηΩϡϦςΟάϧʔϓͳͲΛॻ͖ࠐΜͩεΫϦϓτͰΠϯελϯεੜ
7"4*-: *OD "84ʹαʔόΛཱͯΔ༷ࢠ $ cat /path/to/chef-repo/nodes/api-stg.json { "name": "api-stg", "automatic":
{ "fqdn": "api-stg" }, "chef_environment" : "staging", "run_list": [ “role[packer-api-api-configure]" ] } $ pwd /path/to/chef-repo $ knife zero bootstrap <ΠϯελϯεͷIP> --sudo -N api-stg --no-converge $ knife zero converge ‘name:api-stg’ --sudo
7"4*-: *OD ϩʔΧϧʹαʔόΛཱͯΔ༷ࢠ $ cat Vagrantfile config.vm.define 'api' do |api|
... api.vm.provision 'chef_zero' do |chef| chef_zero_conf(chef, run_list: 'role[packer-api-api-configure]') end ... def chef_zero_conf(chef, run_list:) ... chef.run_list = run_list chef.environment = 'vagrant' ... $ vagrant up api
7"4*-: *OD ઓུ w ✅ݱঢ়ͷࢿ࢈Λ༗ޮ׆༻ ϓϩϏδϣχϯά$IFG w ✅ຊ൪։ൃಉ͡ϨγϐͰߏཧ͢Δ ࠩҟ$IFGͷ&OWJSPONFOUTͰԿͱ͔͢Δ w
✅ࠓޙͷߋ৽͕༰қɾຊ൪ͱ։ൃͷဃΛى͜͞ͳ͍ ΞΫγϣϯͰߋ৽Ͱ͖ΔૉఢͳԿ͔Λ͏
7"4*-: *OD 1SPT w ݶΓͳ͘ຊ൪ʹ͍ۙڥͰύοέʔδͷݕূ w DIFGSFDJQFͷݕূ
7"4*-: *OD $POT w Πϝʔδͷੈཧ w MBUFTUΛ͏ͱܾΊͯ͠·͑ෆཁ
7"4*-: *OD 5JQT w QBDLFSEFCVHNPEFศརͳͷͰͲΜͲΜ͏͖ QBDLFS͕ϓϩϏδϣχϯά͍ͯ͠Δαʔό44)͢Δใ͕Β͑Δ w BQUHFUͷBVUPVQEBUFཁҙ 6CVOUVىಈ࣌ʹABQUHFUVQEBUFA͕ࣗಈͰΓɺDIFGͱͿ͔ͭΔ EJTBCMFʹ͢Δ͔TMFFQͰִؒௐ
7"4*-: *OD ·ͱΊ w QBDLFSͰෳͷ7.ΠϝʔδΛಉ࣌ʹੜ ݱࡏͷQBDLFSҠߦ͘Β͍ w DIFGͰߏཧ w ຊ൪ͱ։ൃͰಉ͡༰ͷ7.Λ͑ΔڥΛߏங
7"4*-: *OD 8FBSFIJSJOH IUUQTXXXXBOUFEMZDPNDPNQBOJFTWBTJMZJOGP PLBEBQBO