A Introduction of Packer
-
Upload
freyr-lin -
Category
Technology
-
view
192 -
download
0
description
Transcript of A Introduction of Packer
![Page 1: A Introduction of Packer](https://reader034.fdocuments.net/reader034/viewer/2022052508/5594552c1a28ab8b118b463a/html5/thumbnails/1.jpg)
Let Packer Simplify your work— It’s all about DevOps
Packer
![Page 2: A Introduction of Packer](https://reader034.fdocuments.net/reader034/viewer/2022052508/5594552c1a28ab8b118b463a/html5/thumbnails/2.jpg)
Content
•Why Packer created
•How to use Packer
•What are typical application scenarios of Packer
![Page 3: A Introduction of Packer](https://reader034.fdocuments.net/reader034/viewer/2022052508/5594552c1a28ab8b118b463a/html5/thumbnails/3.jpg)
“I want a server”“OK☺”
![Page 4: A Introduction of Packer](https://reader034.fdocuments.net/reader034/viewer/2022052508/5594552c1a28ab8b118b463a/html5/thumbnails/4.jpg)
Set up machine & network.. 2 hour Install operation system.. 30 min Install software.. N hour Configuring & deploying.. N hour
About 10 years ago…
We got VMware, VirtualBox.. We got Puppet, Chef, Ansible.. Everything is automatic!! Setup machine is just one click..
About 20 years ago…
1 daySetup machine, Setup OS, Manually setup software, etc
Setup machine, Auto setup everything3 hours
![Page 5: A Introduction of Packer](https://reader034.fdocuments.net/reader034/viewer/2022052508/5594552c1a28ab8b118b463a/html5/thumbnails/5.jpg)
About 5 years ago…
We got clouds! !We don’t even need to have our own machine! !What a perfect world..
Auto setup everything30 mins
![Page 6: A Introduction of Packer](https://reader034.fdocuments.net/reader034/viewer/2022052508/5594552c1a28ab8b118b463a/html5/thumbnails/6.jpg)
We trigger up a instance then trigger the auto-configure tool, and we can just waiting.. !I like AWS, I like Anisble, it make everything automatical, what we need to do is just waiting..
Why we still have to keep waiting ?
Hold..
![Page 7: A Introduction of Packer](https://reader034.fdocuments.net/reader034/viewer/2022052508/5594552c1a28ab8b118b463a/html5/thumbnails/7.jpg)
1 min Start up instance
30 mins
29 mins Auto-configure server
Put everything
into the image
![Page 8: A Introduction of Packer](https://reader034.fdocuments.net/reader034/viewer/2022052508/5594552c1a28ab8b118b463a/html5/thumbnails/8.jpg)
![Page 9: A Introduction of Packer](https://reader034.fdocuments.net/reader034/viewer/2022052508/5594552c1a28ab8b118b463a/html5/thumbnails/9.jpg)
Usage
![Page 10: A Introduction of Packer](https://reader034.fdocuments.net/reader034/viewer/2022052508/5594552c1a28ab8b118b463a/html5/thumbnails/10.jpg)
Packer Template File
1. { 2. "variables": { 3. "aws_access_key": "", 4. "aws_secret_key": "" 5. }, 6. "builders": [ 7. { 8. "type": "amazon-ebs", 9. "access_key": "{{user `aws_access_key`}}", 10. "secret_key": "{{user `aws_secret_key`}}", 11. "region": "us-east-1", 12. "source_ami": "ami-de0d9eb7", 13. "instance_type": "t1.micro", 14. "ssh_username": "ubuntu", 15. "ami_name": "packer {{timestamp}}" 16. } 17. ], 18. "provisioners": [ 19. { 20. "type": "shell", 21. "script": "setup_things.sh" 22. } 23. ] 24. }
• builders (required) • description (optional) • variables (optional) • provisioners (optional) • post-processors (optional)
![Page 11: A Introduction of Packer](https://reader034.fdocuments.net/reader034/viewer/2022052508/5594552c1a28ab8b118b463a/html5/thumbnails/11.jpg)
Packer Command-line
packer build [-var ‘variable_name=value_string’] <template_file.json>
packer inspect <template_file.json>
packer validate <template_file.json>
packer fix <template_file.json>
Inspect
validate
build
fix
![Page 12: A Introduction of Packer](https://reader034.fdocuments.net/reader034/viewer/2022052508/5594552c1a28ab8b118b463a/html5/thumbnails/12.jpg)
Demo
![Page 13: A Introduction of Packer](https://reader034.fdocuments.net/reader034/viewer/2022052508/5594552c1a28ab8b118b463a/html5/thumbnails/13.jpg)
Packer as part of pipeline
Developing Testing Delivering
★ Fit for small system
★ Deploying can be tedious for large system
★ Take longer time and more network bandwidth with new test environment added
![Page 14: A Introduction of Packer](https://reader034.fdocuments.net/reader034/viewer/2022052508/5594552c1a28ab8b118b463a/html5/thumbnails/14.jpg)
Packer as part of pipeline
Developing PackingTesting Delivering
Deliver imagesSafer deployment
Time saving
Parallel builds
![Page 15: A Introduction of Packer](https://reader034.fdocuments.net/reader034/viewer/2022052508/5594552c1a28ab8b118b463a/html5/thumbnails/15.jpg)
Product Env.
Testing Env.
Developing
Packer
![Page 16: A Introduction of Packer](https://reader034.fdocuments.net/reader034/viewer/2022052508/5594552c1a28ab8b118b463a/html5/thumbnails/16.jpg)
—— Dr. Packer
Configure once, Use anywhere
http://www.packer.io https://github.com/mitchellh/packer