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

1-Up Your DevOps Workflow

juliaferraioli
September 28, 2015

1-Up Your DevOps Workflow

At all points of the development cycle, there’s a story to take your application into running at Google scale easily with HashiCorp tools. You can easily use Vagrant to create reliable environments on Compute Engine, Packer to build up images that can then be used to spin up instances astonishingly rapidly, Terraform to manage the cluster so you can easily and quickly make changes.

One can easily see how Consul would fit into the example application, managing configuration between the different components of the application

We think it’s a pretty symbiotic relationship, and I highly recommend testing it out for yourself.

juliaferraioli

September 28, 2015
Tweet

More Decks by juliaferraioli

Other Decks in Technology

Transcript

  1. @juliaferraioli ‹#›
    Julia Ferraioli
    Senior Fungi Advocate
    @juliaferraioli, google.com/+JuliaFerraioli
    1-Up Your DevOps Workflow
    With Google Cloud Platform and Atlas

    View full-size slide

  2. @juliaferraioli ‹#›
    Sneak peek
    0
    1
    2
    3
    Demo
    Toolbox
    Cycle: Create, Build, Deploy
    Success! And Coping

    View full-size slide

  3. @juliaferraioli ‹#›
    Demo? Demo. Demo!

    View full-size slide

  4. @juliaferraioli ‹#›

    View full-size slide

  5. @juliaferraioli ‹#›
    ‹#›
    Hyperspace

    View full-size slide

  6. @juliaferraioli ‹#›
    ‹#›
    ● Open source on GitHub
    Hyperspace

    View full-size slide

  7. @juliaferraioli ‹#›
    ‹#›
    ● Open source on GitHub
    ● Written by @ken_pratt and @icco
    Hyperspace

    View full-size slide

  8. @juliaferraioli ‹#›
    ‹#›
    ● Open source on GitHub
    ● Written by @ken_pratt and @icco
    ● Javascript frontend, Go backend
    Hyperspace

    View full-size slide

  9. @juliaferraioli ‹#›
    ‹#›
    ● Open source on GitHub
    ● Written by @ken_pratt and @icco
    ● Javascript frontend, Go backend
    ● Multiplayer game
    Hyperspace

    View full-size slide

  10. @juliaferraioli ‹#›
    ‹#›
    ● Open source on GitHub
    ● Written by @ken_pratt and @icco
    ● Javascript frontend, Go backend
    ● Multiplayer game
    ● Unlimited bounds
    Hyperspace

    View full-size slide

  11. @juliaferraioli ‹#›
    ‹#›
    ● Open source on GitHub
    ● Written by @ken_pratt and @icco
    ● Javascript frontend, Go backend
    ● Multiplayer game
    ● Unlimited bounds
    ● Pretty fun
    Hyperspace

    View full-size slide

  12. @juliaferraioli ‹#›
    What’s in my toolbox?

    View full-size slide

  13. @juliaferraioli ‹#›
    Performance
    The Google
    Toolbox

    View full-size slide

  14. @juliaferraioli ‹#›
    Performance
    The Google
    Toolbox

    View full-size slide

  15. @juliaferraioli ‹#›
    Performance
    The Google &
    HashiCorp Toolbox

    View full-size slide

  16. @juliaferraioli ‹#›
    Create

    View full-size slide

  17. @juliaferraioli ‹#›
    Decisions, decisions...

    View full-size slide

  18. @juliaferraioli ‹#›
    Decisions, decisions...

    View full-size slide

  19. @juliaferraioli ‹#›
    Decisions, decisions...

    View full-size slide

  20. @juliaferraioli ‹#›
    Decisions, decisions...

    View full-size slide

  21. @juliaferraioli ‹#›
    A little Vagrant here, a little Vagrant there

    View full-size slide

  22. @juliaferraioli ‹#›
    A little Vagrant here, a little Vagrant there

    View full-size slide

  23. @juliaferraioli ‹#›
    The simplest of Vagrantfiles
    Vagrant.configure("2") do |config|
    config.vm.box = "ubuntu/trusty64"
    config.vm.network "forwarded_port", guest: 9393, host: 9393
    config.vm.provision "shell", path: "bootstrap.sh"
    config.vm.provision "shell", path: "hyperspace-be.sh"
    config.vm.provision "shell", path: "hyperspace-fe.sh"
    end

    View full-size slide

  24. @juliaferraioli ‹#›
    A little Vagrant here, a little Vagrant there

    View full-size slide

  25. @juliaferraioli ‹#›
    A little Vagrant here, a little Vagrant there

    View full-size slide

  26. @juliaferraioli ‹#›
    A little Vagrant here, a little Vagrant there

    View full-size slide

  27. @juliaferraioli ‹#›
    Continuum of Computing

    View full-size slide

  28. @juliaferraioli ‹#›
    Continuum of Computing
    Virtualized hardware Abstracted computing power

    View full-size slide

  29. @juliaferraioli ‹#›
    Continuum of Computing
    Virtualized hardware Abstracted computing power
    Compute Engine
    Infrastructure 

    at Google speed

    View full-size slide

  30. @juliaferraioli ‹#›
    Continuum of Computing
    Virtualized hardware Abstracted computing power
    Compute Engine
    Infrastructure 

    at Google speed
    App Engine
    Build your scalable app 

    faster

    View full-size slide

  31. @juliaferraioli ‹#›
    Continuum of Computing
    Virtualized hardware Abstracted computing power
    Container Engine
    Manages your container cluster
    and actively schedules your
    containers
    Compute Engine
    Infrastructure 

    at Google speed
    App Engine
    Build your scalable app 

    faster

    View full-size slide

  32. @juliaferraioli ‹#›
    Continuum of Computing
    Virtualized hardware Abstracted computing power
    Container Engine
    Manages your container cluster
    and actively schedules your
    containers
    Compute Engine
    Infrastructure 

    at Google speed
    App Engine
    Build your scalable app 

    faster

    View full-size slide

  33. @juliaferraioli ‹#›
    [In a parallel universe…]
    $ vagrant plugin install vagrant-google

    View full-size slide

  34. @juliaferraioli ‹#›
    [In a parallel universe…]
    Vagrant.configure("2") do |config|
    config.vm.box = "gce"
    config.vm.provider :google do |google, override|
    google.google_project_id = ""
    google.google_client_email = ""
    google.google_json_key_location = ""
    override.ssh.username = ""
    override.ssh.private_key_path = "/.ssh/google_compute_engine"
    google.machine_type = "n1-standard-1"
    google.image = "ubuntu-1404-trusty-v20150909a"
    google.zone = "us-central1-f"
    google.name = "hashiconf-gce-#{Time.now.to_i}"
    {...omitted script files for screen…}
    end
    end

    View full-size slide

  35. @juliaferraioli ‹#›
    [In a parallel universe…]
    Vagrant.configure("2") do |config|
    config.vm.box = "gce"
    config.vm.provider :google do |google, override|
    google.google_project_id = ""
    google.google_client_email = ""
    google.google_json_key_location = ""
    override.ssh.username = ""
    override.ssh.private_key_path = "/.ssh/google_compute_engine"
    google.machine_type = "n1-standard-1"
    google.image = "ubuntu-1404-trusty-v20150909a"
    google.zone = "us-central1-f"
    google.name = "hashiconf-gce-#{Time.now.to_i}"
    {...omitted script files for screen…}
    end
    end

    View full-size slide

  36. @juliaferraioli ‹#›
    [In a parallel universe…]
    Vagrant.configure("2") do |config|
    config.vm.box = "gce"
    config.vm.provider :google do |google, override|
    google.google_project_id = ""
    google.google_client_email = ""
    google.google_json_key_location = ""
    override.ssh.username = ""
    override.ssh.private_key_path = "/.ssh/google_compute_engine"
    google.machine_type = "n1-standard-1"
    google.image = "ubuntu-1404-trusty-v20150909a"
    google.zone = "us-central1-f"
    google.name = "hashiconf-gce-#{Time.now.to_i}"
    {...omitted script files for screen…}
    end
    end

    View full-size slide

  37. @juliaferraioli ‹#›
    [In a parallel universe…]
    $ vagrant up --provider=google

    View full-size slide

  38. @juliaferraioli ‹#›

    View full-size slide

  39. @juliaferraioli ‹#›
    Build

    View full-size slide

  40. @juliaferraioli ‹#›
    Creating a Compute Engine image with Packer
    hyperspace-[be/fe].json
    "builders": [
    {
    "type": "googlecompute",
    "project_id": "{{user `project_id`}}",
    "account_file": "pkey.json",
    "zone": "us-central1-f",
    "source_image": "ubuntu-1404-trusty-v20150909a",
    "image_name": "hyperspace-[be/fe]-{{timestamp}}"
    }
    ],
    "provisioners": [...
    {
    "type": "shell",
    "script": "scripts/hyperspace-[be/fe].sh"
    },
    ...]

    View full-size slide

  41. @juliaferraioli ‹#›
    Creating a Compute Engine image with Packer
    hyperspace-[be/fe].json
    "builders": [
    {
    "type": "googlecompute",
    "project_id": "{{user `project_id`}}",
    "account_file": "pkey.json",
    "zone": "us-central1-f",
    "source_image": "ubuntu-1404-trusty-v20150909a",
    "image_name": "hyperspace-[be/fe]-{{timestamp}}"
    }
    ],
    "provisioners": [...
    {
    "type": "shell",
    "script": "scripts/hyperspace-[be/fe].sh"
    },
    ...]

    View full-size slide

  42. @juliaferraioli ‹#›
    ‹#›
    hyperspace-[be/fe].sh

    View full-size slide

  43. @juliaferraioli ‹#›
    ‹#›
    ● Installs Go, NGINX
    ● Clones & builds hyperspace
    ● Adds hyperspace to NGINX config
    ● Makes hyperspace start upon reboot
    ● Restarts the NGINX server
    hyperspace-[be/fe].sh

    View full-size slide

  44. @juliaferraioli ‹#›
    Creating a Compute Engine image with Packer
    hyperspace-[be/fe].json
    "post-processors": [
    [
    {
    "type": "atlas",
    "token": "{{user `atlas_token`}}",
    "artifact": "{{user `atlas_username`}}/hyperspace-[be/fe]",
    "artifact_type": "google.image",
    "metadata": {
    "created_at": "{{timestamp}}"
    }
    }
    ]
    ]

    View full-size slide

  45. @juliaferraioli ‹#›
    Creating a Compute Engine image with Packer
    hyperspace-[be/fe].json
    "post-processors": [
    [
    {
    "type": "atlas",
    "token": "{{user `atlas_token`}}",
    "artifact": "{{user `atlas_username`}}/hyperspace-[be/fe]",
    "artifact_type": "google.image",
    "metadata": {
    "created_at": "{{timestamp}}"
    }
    }
    ]
    ]

    View full-size slide

  46. @juliaferraioli ‹#›
    Building with Packer
    $ packer push -name /hyperspace-fe hyperspace-fe.json
    $ packer push -name /hyperspace-be hyperspace-be.json

    View full-size slide

  47. @juliaferraioli ‹#›
    Deploy

    View full-size slide

  48. @juliaferraioli ‹#›
    Deploy and configure with Terraform
    main.tf
    provider "google" {
    account_file = "${file("pkey.json")}"
    project = "hashiconf-demo"
    region = "us-central1"
    }
    resource "atlas_artifact" "hyperspace-[be/fe]" {
    name = "${var.ATLAS_USERNAME}/hyperspace-[be/fe]"
    type = "google.image"
    }

    View full-size slide

  49. @juliaferraioli ‹#›
    Deploy and configure with Terraform
    main.tf
    provider "google" {
    account_file = "${file("pkey.json")}"
    project = "hashiconf-demo"
    region = "us-central1"
    }
    resource "atlas_artifact" "hyperspace-[be/fe]" {
    name = "${var.ATLAS_USERNAME}/hyperspace-[be/fe]"
    type = "google.image"
    }

    View full-size slide

  50. @juliaferraioli ‹#›
    Deploy and configure with Terraform
    main.tf
    provider "google" {
    account_file = "${file("pkey.json")}"
    project = "hashiconf-demo"
    region = "us-central1"
    }
    resource "atlas_artifact" "hyperspace-[be/fe]" {
    name = "${var.ATLAS_USERNAME}/hyperspace-[be/fe]"
    type = "google.image"
    }

    View full-size slide

  51. @juliaferraioli ‹#›
    Deploy and configure with Terraform
    main.tf
    provider "google" {
    account_file = "${file("pkey.json")}"
    project = "hashiconf-demo"
    region = "us-central1"
    }
    resource "atlas_artifact" "hyperspace-[be/fe]" {
    name = "${var.ATLAS_USERNAME}/hyperspace-[be/fe]"
    type = "google.image"
    }

    View full-size slide

  52. @juliaferraioli ‹#›
    Deploy and configure with Terraform
    main.tf
    resource "google_compute_instance" "hyperspace-be" {
    name = "hyperspace-be"
    machine_type = "n1-standard-1"
    zone = "us-central1-f"
    disk {
    image = "${atlas_artifact.hyperspace-be.id}"
    }
    ...

    View full-size slide

  53. @juliaferraioli ‹#›
    Deploy and configure with Terraform
    main.tf
    resource "google_compute_instance" "hyperspace-be" {
    name = "hyperspace-be"
    machine_type = "n1-standard-1"
    zone = "us-central1-f"
    disk {
    image = "${atlas_artifact.hyperspace-be.id}"
    }
    ...

    View full-size slide

  54. @juliaferraioli ‹#›
    Deploy and configure with Terraform
    main.tf
    resource "google_compute_instance" "hyperspace-be" {
    name = "hyperspace-be"
    machine_type = "n1-standard-1"
    zone = "us-central1-f"
    disk {
    image = "${atlas_artifact.hyperspace-be.id}"
    }
    ...

    View full-size slide

  55. @juliaferraioli ‹#›
    Deploy and configure with Terraform
    main.tf
    ...
    network_interface {
    network = "default"
    access_config { // Ephemeral IP }
    }
    count = 1
    lifecycle = {
    create_before_destroy = true
    }
    }

    View full-size slide

  56. @juliaferraioli ‹#›
    Deploy and configure with Terraform
    main.tf
    ...
    network_interface {
    network = "default"
    access_config { // Ephemeral IP }
    }
    count = 1
    lifecycle = {
    create_before_destroy = true
    }
    }

    View full-size slide

  57. @juliaferraioli ‹#›
    Deploy and configure with Terraform
    $ terraform apply

    View full-size slide

  58. @juliaferraioli ‹#›
    Success! And Coping

    View full-size slide

  59. @juliaferraioli ‹#›
    Using Terraform to adapt and update
    $ terraform apply

    View full-size slide

  60. @juliaferraioli ‹#›
    HashiCorp + Google Cloud Platform
    =
    a great way to develop, deploy, & manage

    View full-size slide

  61. @juliaferraioli ‹#›
    Resources
    0
    1
    2
    3
    4
    5
    Google Cloud Platform: https://cloud.google.com/docs/
    Code from the presentation: https://goo.gl/mqrw62
    Consul & Google Cloud Platform: http://goo.gl/tC2KP1
    Slides: https://speakerdeck.com/juliaferraioli/1-up-your-devops-workflow-1
    Spaaaaaace: https://github.com/kenpratt/hyperspace
    Vagrant & GCE: https://github.com/mitchellh/vagrant-google

    View full-size slide

  62. @juliaferraioli ‹#›
    https://cloud.google.com/free-trial/

    View full-size slide

  63. @juliaferraioli ‹#›
    Creative Commons image by Feans

    View full-size slide