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

Build Immutable Infrastrusructure Using Packer ...

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest. →

Build Immutable Infrastrusructure Using Packer and Digital Ocean

A cloud infrastructure is immutable if changes to it are versioned, controlled and doesn't drift away from the plan. Packer is a tool that allows you to build machine images that are immutable. One of the cloud providers supported by packer is DigitalOcean. DigitalOcean offers a simple and elegant interface where you can spin up instances from the machine images created by packer.

Avatar for Amos Chidiebube

Amos Chidiebube

October 28, 2017

More Decks by Amos Chidiebube

Other Decks in Technology

Transcript

  1. Speaker Bio • DevOps Engineer at Andela. • Lifelong Learner

    and teacher. • Technical Writer. • Organizer of Hashicorp User Group Lagos>> http://bit.ly/2vhXI3I • Aspiring philanthropist ☺. See >> https://www.youtube.com/watch?v=d6oychIjcCE&t=10s • Aspiring Google Developer Expert (Cloud).
  2. Hactoberfest!!! Contribute to an Open Source Project today and be

    World Class. Create 4 PR’s before October 31st and stand a chance to win a shirt from Digital Ocean. https://hacktoberfest.digitalocean.com/ A thousand miles starts with a step. Better late than never.
  3. Agenda • Reflections. • What Immutable Infrastructure means. • Packer

    as a tool to build Immutable Infrastructure. • Packer and Digital Ocean at Work. • Q&A.
  4. When was the last time any of you setup a

    cloud server or virtual machine (Iaas) and how was the setup done ? Reflections
  5. It’s high time we stopped root sshing into production servers

    to run adhoc commands or install softwares. Reflections...
  6. Immutable means Unchanging over time or Unable to be changed.

    So after initial setup no more changes to the server ? Immutable Infrastructure…
  7. Your Infrastructure is immutable if the changes are controlled, versioned,

    repeatable and doesn’t drift away from specified setup. Immutable Infrastructure...
  8. ALL THE TIME!!! Except at a very very small scale..

    When to use Immutable Infrastructure
  9. • Testable Infrastructure. • Reproduce production. • Confident changes. •

    Expandable servers because of existing snapshots. • Easy to scale. • Avoid key man syndrome. • Sleep with your 2 eyes closed. Some Benefits of Immutable Infrastructure
  10. • Packer . • Docker. ◦ Application re-architecture. ◦ Service

    discovery. ◦ Shared data volumes. Sometimes it’s worth it and sometimes it’s not.. That is where packer comes in. Ways to Build Immutable Infrastructure.
  11. Today, we’ll jointly learn how to Build Immutable and Scalable

    Machine Images on Digital Ocean Using PACKER.
  12. • Droplet. • Variables. • Builders. • Provisioners. • Post

    processors. Some terms to keep in mind as we move along..
  13. Builders Provisioners Post-processors Digital Ocean Amazon EC2 Azure Docker File

    Shell Ansible PowerShell Vagrant Compress Docker push Amazon Import template.json Basic Flow of a packer script.
  14. • What we need. Active Digital ocean account, packer. •

    Documentation exists here >> https://www.packer.io/docs/builders/digitalocean.html • Demo github repo >> https://github.com/Chidiebube/do_meetup_lagos • Install packer. • Build out the template.json file. • Build out variable.json file to hold our digital ocean API key. • Configure provisioners. • Add nginx configuration files. • Build out bash script to provision our image. • Validate and build your packer scripts. • Create a digital ocean droplet. • Update the new droplet domain IP to serve our static html page. Too much grammar, let’s do a little demo.
  15. • Ubuntu version to be built. Some of the bash

    commands doesn’t work on earlier ubuntu versions like Ubuntu 14. • Not setting bash debug commands like `set -e`, `set -x`,`set -o pipefail`. These commands makes debugging easy and also prevents packer from building half baked machine image. Major Issues Faced.
  16. After building and provisioning using packer, it also allows you

    to seamlessly transition into docker when you are ready to dockerize your app. The packer post-processor facilitates this. Good news for Docker Lovers.