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 ‹#› Sneak peek 0 1 2 3 Demo Toolbox

    Cycle: Create, Build, Deploy Success! And Coping
  2. @juliaferraioli ‹#› ‹#› • Open source on GitHub • Written

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

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

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

    by @ken_pratt and @icco • Javascript frontend, Go backend • Multiplayer game • Unlimited bounds • Pretty fun Hyperspace
  6. @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
  7. @juliaferraioli ‹#› Continuum of Computing Virtualized hardware Abstracted computing power

    Compute Engine Infrastructure 
 at Google speed App Engine Build your scalable app 
 faster
  8. @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
  9. @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
  10. @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 = "<project id>" google.google_client_email = "<service account email>" google.google_json_key_location = "<account json file>" override.ssh.username = "<username>" override.ssh.private_key_path = "<path to key>/.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
  11. @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 = "<project id>" google.google_client_email = "<service account email>" google.google_json_key_location = "<account json file>" override.ssh.username = "<username>" override.ssh.private_key_path = "<path to key>/.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
  12. @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 = "<project id>" google.google_client_email = "<service account email>" google.google_json_key_location = "<account json file>" override.ssh.username = "<username>" override.ssh.private_key_path = "<path to key>/.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
  13. @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" }, ...]
  14. @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" }, ...]
  15. @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
  16. @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}}" } } ] ]
  17. @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}}" } } ] ]
  18. @juliaferraioli ‹#› Building with Packer $ packer push -name <name>/hyperspace-fe

    hyperspace-fe.json $ packer push -name <name>/hyperspace-be hyperspace-be.json
  19. @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" }
  20. @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" }
  21. @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" }
  22. @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" }
  23. @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}" } ...
  24. @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}" } ...
  25. @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}" } ...
  26. @juliaferraioli ‹#› Deploy and configure with Terraform main.tf ... network_interface

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

    { network = "default" access_config { // Ephemeral IP } } count = 1 lifecycle = { create_before_destroy = true } }
  28. @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