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
530
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
5.4k
テレメトリーシグナルの相関、してますか? 第一原理からのデバッグを支える計装 / Do you utilize telemetry correlations?
ymotongpoo
3
650
OpenTelemetryのここ4年の流れ / OpenTelemetry in last 4+ years
ymotongpoo
17
4.2k
信頼性目標とシステムアーキテクチャー / Reliability Objective and System Architecture
ymotongpoo
18
9.2k
継続的プロファイルによる大規模アプリケーションの性能改善 / Improving massive application clusters with continuous profiling
ymotongpoo
0
290
SLOは何を実現するのか / What does SLO achieve?
ymotongpoo
2
320
Goのメモリ管理 / Memory management in Go
ymotongpoo
11
5.7k
SREの理念と原則〜SREの「人間的」側面 / SRE from humanism
ymotongpoo
1
930
Other Decks in Technology
See All in Technology
Jetpack Composeで始めるServer Cache State
ogaclejapan
2
170
あの日俺達が夢見たサーバレスアーキテクチャ/the-serverless-architecture-we-dreamed-of
tomoki10
0
430
【re:Invent 2024 アプデ】 Prompt Routing の紹介
champ
0
140
祝!Iceberg祭開幕!re:Invent 2024データレイク関連アップデート10分総ざらい
kniino
2
250
MLOps の現場から
asei
6
630
NilAway による静的解析で「10 億ドル」を節約する #kyotogo / Kyoto Go 56th
ytaka23
3
370
複雑性の高いオブジェクト編集に向き合う: プラガブルなReactフォーム設計
righttouch
PRO
0
110
OpenShift Virtualizationのネットワーク構成を真剣に考えてみた/OpenShift Virtualization's Network Configuration
tnk4on
0
130
多領域インシデントマネジメントへの挑戦:ハードウェアとソフトウェアの融合が生む課題/Challenge to multidisciplinary incident management: Issues created by the fusion of hardware and software
bitkey
PRO
2
100
Postman と API セキュリティ / Postman and API Security
yokawasa
0
200
ゼロから創る横断SREチーム 挑戦と進化の軌跡
rvirus0817
2
260
UI State設計とテスト方針
rmakiyama
2
430
Featured
See All Featured
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
Adopting Sorbet at Scale
ufuk
73
9.1k
Unsuck your backbone
ammeep
669
57k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
48
2.2k
Imperfection Machines: The Place of Print at Facebook
scottboms
266
13k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Why Our Code Smells
bkeepers
PRO
335
57k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
How STYLIGHT went responsive
nonsquared
95
5.2k
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