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
20130727 Packerの紹介 (Python Developers Festa 201...
Search
ymotongpoo
August 02, 2013
Technology
3
520
20130727 Packerの紹介 (Python Developers Festa 2013.07)
introducing packer, mentioning installation, usage and extension.
ymotongpoo
August 02, 2013
Tweet
Share
More Decks by ymotongpoo
See All by ymotongpoo
オブザーバビリティのマクロからミクロまで / Observability from macro to micro
ymotongpoo
13
4.8k
テレメトリーシグナルの相関、してますか? 第一原理からのデバッグを支える計装 / Do you utilize telemetry correlations?
ymotongpoo
3
610
OpenTelemetryのここ4年の流れ / OpenTelemetry in last 4+ years
ymotongpoo
17
3.8k
信頼性目標とシステムアーキテクチャー / Reliability Objective and System Architecture
ymotongpoo
18
9.1k
継続的プロファイルによる大規模アプリケーションの性能改善 / Improving massive application clusters with continuous profiling
ymotongpoo
0
270
SLOは何を実現するのか / What does SLO achieve?
ymotongpoo
2
310
Goのメモリ管理 / Memory management in Go
ymotongpoo
11
5.6k
SREの理念と原則〜SREの「人間的」側面 / SRE from humanism
ymotongpoo
1
880
Other Decks in Technology
See All in Technology
ドメイン名の終活について - JPAAWG 7th -
mikit
33
20k
社内で最大の技術的負債のリファクタリングに取り組んだお話し
kidooonn
1
550
Amazon Personalizeのレコメンドシステム構築、実際何するの?〜大体10分で具体的なイメージをつかむ〜
kniino
1
100
Terraform Stacks入門 #HashiTalks
msato
0
350
Taming you application's environments
salaboy
0
190
サイバーセキュリティと認知バイアス:対策の隙を埋める心理学的アプローチ
shumei_ito
0
380
OCI Network Firewall 概要
oracle4engineer
PRO
0
4.1k
複雑なState管理からの脱却
sansantech
PRO
1
140
100 名超が参加した日経グループ横断の競技型 AWS 学習イベント「Nikkei Group AWS GameDay」の紹介/mediajaws202411
nikkei_engineer_recruiting
1
170
初心者向けAWS Securityの勉強会mini Security-JAWSを9ヶ月ぐらい実施してきての近況
cmusudakeisuke
0
120
SREによる隣接領域への越境とその先の信頼性
shonansurvivors
2
520
なぜ今 AI Agent なのか _近藤憲児
kenjikondobai
4
1.4k
Featured
See All Featured
A designer walks into a library…
pauljervisheath
204
24k
Designing for humans not robots
tammielis
250
25k
Statistics for Hackers
jakevdp
796
220k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
Optimising Largest Contentful Paint
csswizardry
33
2.9k
Teambox: Starting and Learning
jrom
133
8.8k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
720
Agile that works and the tools we love
rasmusluckow
327
21k
Faster Mobile Websites
deanohume
305
30k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
Being A Developer After 40
akosma
86
590k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Transcript
ࢁޱೳ id : ymotongpoo 1 1BDLFSͷհ 1ZUIPO%FWFMPQFST'FTUB
͓લɺ୭Αʁ • ࢁޱೳʢ·͙ͪΑ͠;Έʣ • :PV5VCF5FDIOJDBM"DDPVOU.BOBHFS (PPHMF*OD • JEZNPUPOHQPP –
ͱΜʔͱݺΕ͍ͯ·͢ • :"."(6$)*XFCMPH – ZNPUPOHQPPIBUFOBCMPHDPN 2
͓લɺ୭Αʁ • (P͕͖Ͱ͢ • (P$POGFSFODFͱ͍͏ΠϕϯτΛ͠·ͨ͠ • Թઘʹߦ͘ʮ(PཏԹઘʯͱ͍͏ԹઘاըΛ͠· ͨ͠ • ઌిߥઢΛିͬͨ͠ʮిंͰ(Pʯ
ͱ͍͏ΠϕϯτΛ͠·ͨ͠ 3
͓લɺ୭Αʁ 4
ཱྀͷࢥ͍ग़ 5
"HFOEB • 1BDLFSͬͯφχʁ • 1BDLFSΛͬͯΈΔ • 1BDLFSΛ֦ுͯ͠ΈΔ 6
7 ͬͯφχʁ
1BDLFSͬͯφχʁ • 7BHSBOUͷ࡞ऀ.JUDIFMM)BTIJNPUP࡞ • (P • ʹWFSTJPOެ։ – ൃද࣌࠷৽൛ •
ެࣜαΠτ – http://www.packer.io 8
9
10 Packer is a tool for creating identical machine images
for multiple platforms from a single source configuration. Platform A Platform B Platform C Machine Image A Machine Image B Machine Image C
11 ͦΕͬͯ 7BHSBOUͱ͔ 'BCSJDͱ͔ͱ φχ͕ҧ͏ͷʁ
֤ϓϩϏδϣχϯάπʔϧͱͷҧ͍ 12 OS distribution pkg pkg 7BHSBOU'BCSJDجຊతͳ04Πϝʔδͷ্ʹ ઃఆΛߦ͏ • パッケージのインストール
• 設定ファイルのコピー • スクリプトの実行 etc… file script Machine Image
֤ϓϩϏδϣχϯάπʔϧͱͷҧ͍ 13 1BDLFSͦͦͷϚγϯΠϝʔδΛ࡞ Packer config Packer OS distribution Machine Image
A OS distribution Machine Image B
7FFXFFͱφχ͕ҧ͏ͷʁ • 7FFXFFͱͬͯΔ͜ͱ͍ۙ – 7FFXFF7JSUVBM#PY 7.XBSF'VTJPO ,7. 1BSBMMFMTΛ࡞ΕΔ –
֦ͨͩ͠ுػߏͳ͍ – ϓϩϏδϣχϯά7BHSBOUݶఆ 14
ݱঢ়ରԠϓϥοτϑΥʔϜ 15
16 1BDLFSΛͬͯΈΔ
Πϯετʔϧ 17 $ wget http://path/to/packer.binary.zip $ unzip packer.binary.zip
18 Ҏ্
Πϯετʔϧ (PͳͷͰ֤ڥ༻ͷόΠφϦΛ͑ྑ͍ 19 http://www.packer.io/downloads.html
ઃఆϑΝΠϧ • ઃఆϑΝΠϧ+40/ܗࣜͰهड़ • (PͷUFYUUFNQMBUFʹ४ڌͯ͠ɺมΛຒΊࠐ Ή͜ͱՄೳ • ཁૉͭ – CVJMEFSTԾϚγϯΛ࡞͢ΔΠϯϑϥͷࢦఆ
– QSPWJTJPOFSTϏϧυྃޙͷ؆୯ͳϓϩϏδϣχϯ ά – QPTUQSPDFTTPSTϓϩϏδϣχϯάྃޙͷॲཧ 20
ઃఆϑΝΠϧ { "builders": [{
"type": "amazon-‐ebs", "access_key": "YOUR KEY HERE", "secret_key": "YOUR SECRET KEY HERE", "region": "us-‐east-‐1", "source_ami": "ami-‐de0d9eb7", "instance_type": "t1.micro", "ssh_username": "ubuntu", "ami_name": "packer-‐example {{.CreateTime}}" }], “provisoners”: [ “type”: “shell”, “scripts”: [ “initial-‐install.sh” ] ], “post-‐prosessors”: [{ “type”: “compress”, “format”: “tar.gz” }] } 21
࣮ߦ͢Δ 22 $ packer validate $ packer build config.json
ςοςϨʔ 23
24 1BDLFSΛ֦ுͯ͠ΈΔ
1BDLFS1MVHJOT • packerίϚϯυඪ४ͰϓϥάΠϯΛୟ͍ͯ ͍Δ 25 $ ls
packer packer-‐builder-‐amazon-‐ebs packer-‐builder-‐digitalocean packer-‐builder-‐virtualbox packer-‐builder-‐vmware packer-‐command-‐build packer-‐command-‐fix packer-‐command-‐validate packer-‐post-‐processor-‐vagrant packer-‐provisioner-‐file packer-‐provisioner-‐shell શ෦ϓϥάΠϯ
1BDLFS1MVHJOT • ϓϥάΠϯͷ࡞(PͰͷΈ࡞Մೳ – ֤ͨͩ͠ϓϥάΠϯಠཱͨ͠ίϚϯυͱͯ͠࡞ – ໋໊نଇpacker-‐TYPE-‐NAME ྫ
QBDLFSCVJMEFSBNB[POFCT QBDLFSDPNNBOEWBMJEBUF 26
1BDLFS1MVHJOT • ֦ுΛՃͨ͠Β$HOME/.packerconfig ʹ Ճͷ֦ுΛॻ͍͓ͯ͘ – ઈରύε or ૬ରύε
or PATH͕௨͍ͬͯΔͱ͜Ζ – ඪ४ίϚϯυಉܗࣜͰϋʔυίʔυ͞Ε͍ͯΔ 27 { "builders": { "custom-‐cloud": "packer-‐builer-‐custom-‐cloud" }, "commands": { "spam": "packer-‐command-‐spam", "egg": "packer-‐command-‐egg" } }
1BDLFSશମͷίʔυߏ 28 packerίϚϯυ buildersͰݺΕΔඪ४֦ு܈ post-‐processorsͰݺΕΔඪ४֦ு܈ provinoersͰݺΕΔඪ४֦ு܈ packerͰݺΕΔඪ४֦ு܈ ͍͚ͭͩ͜ݟΕྑ͍ ඪ४֦ு܈ͷNBJOHP
1BDLFSશମͷίʔυߏ • ύοέʔδͩͱҎԼͷͭ • QBDLFSQBDLFS – 1BDLFSͷίΞɾ֦ு։ൃͷͨΊͷύοέʔδ • QBDLFSQBDLFSQMVHJO –
ϓϥάΠϯ֦ுͷJOUFSGBDFͷఆٛͷΈ 29 github.com/mitchellh/packer/packer github.com/mitchellh/packer/packer/plugin
#VJMEFSͷ֦ு 30 Packer Plugins type Builder interface {
Prepare(...interface{}) error Run(ui Ui, hook Hook, cache Cache) (Artifact, error) Cancel() } • 1SFQBSF ઃఆϑΝΠϧͷಡΈࠐΈͱલॲཧ – ͍͍ͨͯmap[string]interface{} Ͱ͞ΕΔ • 3VO ϚγϯΠϝʔδͷ࡞Λߦ͏ – Artifact JOUFSGBDFΛ࣮ͨ͠TUSVDUʹϚγϯΠϝʔδʢͷϝλσʔλʣ • $BODFM $USMDͳͲ͕ԡ͞Εͨ࣌ͷޙॲཧ
$PNNBOEͷ֦ு 31 Packer Plugins type Command interface {
Help() string Run(env Environment, args []string) int Synopsis() string } • )FMQ packer COMMAND -‐-‐helpͰग़ྗ͞ΕΔϝοηʔδ • 3VO ࣮ࡍͷίϚϯυͷ࣮ߦ – ىಈதͷ1BDLFSͷ΄΅ͯ͢ͷใΛͱΕΔ • CVJMEFS 6* $BDIF QPTUQSPDFTTPS QSPWJTJPOFS • 4ZOPQTJT packer -‐-‐helpͰग़ྗ͞ΕΔ͍ϝοηʔδ – 50จࣈఔ
ͦͷଞͷ֦ு • QPTUQSPDFTTPS • QSPWJTJPOFS – QSPWJTPOFSͷϑοΫCVJMEFSଆͷ֦ுͰ࣮͢Δඞ ཁ͕͋Δ 32 Packer
Plugins ࠓճॏཁ͡Όͳ͍ͷͰলུ
33 ·ͱΊ
34 Packer is a tool for creating identical machine images
for multiple platforms from a single source configuration. Platform A Platform B Platform C Machine Image A Machine Image B Machine Image C
·ͱΊ • ϓϩϏδϣχϯάΛޠΔલʹɺϚγϯΠϝʔδ ͷ͜ͱΛߟ͑Α͏ • ֦ு࡞ΕΔͷͰɺࣾڥ༻ʹ֦ு͕࡞Ε ͯΑ͍ • (Pྑ͍ –
ඪ४ͷ+40/ύʔαΦϓγϣϯύʔαɺόΠφϦ 35
36