1-Up Your DevOps Workflow

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.

62b2249a42d624dc93357931f0f5d2f1?s=128

juliaferraioli

September 28, 2015
Tweet

Transcript

  1. 2.

    @juliaferraioli ‹#› Sneak peek 0 1 2 3 Demo Toolbox

    Cycle: Create, Build, Deploy Success! And Coping
  2. 8.

    @juliaferraioli ‹#› ‹#› • Open source on GitHub • Written

    by @ken_pratt and @icco • Javascript frontend, Go backend Hyperspace
  3. 9.

    @juliaferraioli ‹#› ‹#› • Open source on GitHub • Written

    by @ken_pratt and @icco • Javascript frontend, Go backend • Multiplayer game Hyperspace
  4. 10.

    @juliaferraioli ‹#› ‹#› • Open source on GitHub • Written

    by @ken_pratt and @icco • Javascript frontend, Go backend • Multiplayer game • Unlimited bounds Hyperspace
  5. 11.

    @juliaferraioli ‹#› ‹#› • Open source on GitHub • Written

    by @ken_pratt and @icco • Javascript frontend, Go backend • Multiplayer game • Unlimited bounds • Pretty fun Hyperspace
  6. 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
  7. 30.

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

    Compute Engine Infrastructure 
 at Google speed App Engine Build your scalable app 
 faster
  8. 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
  9. 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
  10. 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 = "<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. 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 = "<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. 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 = "<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. 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" }, ...]
  14. 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" }, ...]
  15. 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
  16. 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}}" } } ] ]
  17. 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}}" } } ] ]
  18. 46.

    @juliaferraioli ‹#› Building with Packer $ packer push -name <name>/hyperspace-fe

    hyperspace-fe.json $ packer push -name <name>/hyperspace-be hyperspace-be.json
  19. 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" }
  20. 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" }
  21. 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" }
  22. 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" }
  23. 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}" } ...
  24. 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}" } ...
  25. 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}" } ...
  26. 55.

    @juliaferraioli ‹#› Deploy and configure with Terraform main.tf ... network_interface

    { network = "default" access_config { // Ephemeral IP } } count = 1 lifecycle = { create_before_destroy = true } }
  27. 56.

    @juliaferraioli ‹#› Deploy and configure with Terraform main.tf ... network_interface

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