{"id":21808,"date":"2015-04-01T17:00:00","date_gmt":"2015-04-01T22:00:00","guid":{"rendered":"https:\/\/blog.planview.com\/faster-vms-vagrant-and-chef\/"},"modified":"2015-04-01T17:00:00","modified_gmt":"2015-04-01T22:00:00","slug":"faster-vms-vagrant-and-chef","status":"publish","type":"post","link":"https:\/\/blog.planview.com\/faster-vms-vagrant-and-chef\/","title":{"rendered":"Faster VMs with Vagrant and Chef"},"content":{"rendered":"<figure>\n<div class=\"feature-image\"><img decoding=\"async\" class=\"aligncenter size-full\" src=\"https:\/\/media.planview.com\/tasktop_blog\/wp-content\/uploads\/vagrant-cachier-cache_0.png\" alt=\"Faster VMs with Vagrant and Chef\"><\/div>\n<\/figure>\n<div class=\"body\">\n<div>\n<p>Developing and testing changes in an environment that is the same as the deployment environment is one of the magic ingredients of the DevOps way. For engineers at Tasktop working on the <a href=\"\/testing-for-the-api-economy\">Integration Factory<\/a>, provisioning a new VM can occur multiple times in a day, so any inefficiencies in the process are painful. I recently stumbled across <a href=\"https:\/\/github.com\/fgrehm\/vagrant-cachier\">vagrant-cachier<\/a> which reduces network usage and speeds up local Vagrant-based provisioning, drastically improving VM provisioning times.<\/p>\n<p>Install vagrant-cachier as follows:<\/p>\n<pre style=\"font-family: monospace\">$ vagrant plugin install vagrant-cachier\r\n<\/pre>\n<p>Then add the following to your <tt style=\"font-family: monospace\">~\/.vagrant.d\/Vagrantfile<\/tt><\/p>\n<pre style=\"font-family: monospace\">Vagrant.configure(&quot;2&quot;) do |config|\r\n  if Vagrant.has_plugin?(&quot;vagrant-cachier&quot;)\r\n    config.cache.scope = :box\r\n  end\r\nend\r\n<\/pre>\n<p>That&#x92;s all! The next time you provision a VM using Vagrant, you should see a local cache being created under <tt style=\"font-family: monospace\">~\/.vagrant.d\/cache<\/tt><\/p>\n<p><img data-src=\"https:\/\/media.planview.com\/tasktop_blog\/wp-content\/uploads\/vagrant-cachier-cache_0.png\" class=\"lazyload\"><\/p>\n<p>As you can see, vagrant-cachier creates a local cache of dependencies including those provided by apt-get, chef, and of course anything under <tt style=\"font-family: monospace\">\/var\/cache<\/tt>.<br \/>This technique is especially helpful for remote developers who are not on 100GB Ethernet to servers hosting VM dependencies.<\/p>\n<p>It&#x92;s easy to try it yourself and collect before\/after results. Here&#x92;s what I observed before vagrant-cachier:<\/p>\n<pre style=\"font-family: monospace\">$ time vagrant up \r\nBringing machine &apos;default&apos; up with &apos;virtualbox&apos; provider...\r\n[default] Importing base box &apos;ubuntu-14.04-x86&apos;...\r\n[default] Matching MAC address for NAT networking...\r\n[default] Setting the name of the VM...\r\n...\r\nreal4m44.142s\r\nuser0m4.895s\r\nsys0m3.132s\r\n$ \r\n<\/pre>\n<p>After enabling vagrant-cachier:<\/p>\n<pre style=\"font-family: monospace\">$ time vagrant up \r\nBringing machine &apos;default&apos; up with &apos;virtualbox&apos; provider...\r\n[default] Importing base box &apos;ubuntu-14.04-x86&apos;...\r\n[default] Matching MAC address for NAT networking...\r\n[default] Setting the name of the VM...\r\n...\r\nreal3m18.506s\r\nuser0m7.617s\r\nsys0m5.261s\r\n$ \r\n<\/pre>\n<p>In this real-world example of a simple VM running MySQL downloading dependencies over a VPN, I was able to reduce the provisioning time by 30%! The effect in real time is larger of course for VMs that have more dependencies.<\/p>\n<p>Many thanks to <a href=\"https:\/\/twitter.com\/fgrehm\">@fgrehm<\/a> for vagrant-cachier, which helps to eliminate much of the pain of waiting for VMs to come up when using Vagrant and Chef.<br \/>Find out more at <a href=\"http:\/\/fgrehm.viewdocs.io\/vagrant-cachier\">http:\/\/fgrehm.viewdocs.io\/vagrant-cachier<\/a>.<\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Developing and testing changes in an environment that is the same as the deployment environment is one of the magic ingredients of the DevOps way. For engineers at Tasktop working on the Integration Factory, provisioning a new VM can occur multiple times in a day, so any inefficiencies in the process are painful. I recently&#8230;<\/p>\n","protected":false},"author":233,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_editorskit_title_hidden":false,"_editorskit_reading_time":0,"_editorskit_is_block_options_detached":false,"_editorskit_block_options_position":"{}","footnotes":""},"categories":[9548],"tags":[],"class_list":["post-21808","post","type-post","status-publish","format-standard","hentry","category-engineering-teams"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.8 (Yoast SEO v26.8) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Faster VMs with Vagrant and Chef | Tasktop Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.planview.com\/faster-vms-vagrant-and-chef\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Faster VMs with Vagrant and Chef\" \/>\n<meta property=\"og:description\" content=\"Developing and testing changes in an environment that is the same as the deployment environment is one of the magic ingredients of the DevOps way. For engineers at Tasktop working on the Integration Factory, provisioning a new VM can occur multiple times in a day, so any inefficiencies in the process are painful. I recently...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.planview.com\/faster-vms-vagrant-and-chef\/\" \/>\n<meta property=\"og:site_name\" content=\"Planview Blog\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/www.facebook.com\/pages\/Planview-Inc\/89422974772\" \/>\n<meta property=\"article:published_time\" content=\"2015-04-01T22:00:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/media.planview.com\/tasktop_blog\/wp-content\/uploads\/vagrant-cachier-cache_0.png\" \/>\n<meta name=\"author\" content=\"Tasktop Blogger\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@Planview\" \/>\n<meta name=\"twitter:site\" content=\"@Planview\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Tasktop Blogger\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/blog.planview.com\/faster-vms-vagrant-and-chef\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/blog.planview.com\/faster-vms-vagrant-and-chef\/\"},\"author\":{\"name\":\"Tasktop Blogger\",\"@id\":\"https:\/\/blog.planview.com\/#\/schema\/person\/35676ea677995199889c0b6456156ce2\"},\"headline\":\"Faster VMs with Vagrant and Chef\",\"datePublished\":\"2015-04-01T22:00:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/blog.planview.com\/faster-vms-vagrant-and-chef\/\"},\"wordCount\":258,\"publisher\":{\"@id\":\"https:\/\/blog.planview.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/blog.planview.com\/faster-vms-vagrant-and-chef\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/media.planview.com\/tasktop_blog\/wp-content\/uploads\/vagrant-cachier-cache_0.png\",\"articleSection\":[\"Engineering Teams\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/blog.planview.com\/faster-vms-vagrant-and-chef\/\",\"url\":\"https:\/\/blog.planview.com\/faster-vms-vagrant-and-chef\/\",\"name\":\"Faster VMs with Vagrant and Chef | Tasktop Blog\",\"isPartOf\":{\"@id\":\"https:\/\/blog.planview.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/blog.planview.com\/faster-vms-vagrant-and-chef\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/blog.planview.com\/faster-vms-vagrant-and-chef\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/media.planview.com\/tasktop_blog\/wp-content\/uploads\/vagrant-cachier-cache_0.png\",\"datePublished\":\"2015-04-01T22:00:00+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/blog.planview.com\/faster-vms-vagrant-and-chef\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/blog.planview.com\/faster-vms-vagrant-and-chef\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/blog.planview.com\/faster-vms-vagrant-and-chef\/#primaryimage\",\"url\":\"https:\/\/media.planview.com\/tasktop_blog\/wp-content\/uploads\/vagrant-cachier-cache_0.png\",\"contentUrl\":\"https:\/\/media.planview.com\/tasktop_blog\/wp-content\/uploads\/vagrant-cachier-cache_0.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/blog.planview.com\/faster-vms-vagrant-and-chef\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/blog.planview.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Faster VMs with Vagrant and Chef\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/blog.planview.com\/#website\",\"url\":\"https:\/\/blog.planview.com\/\",\"name\":\"Planview Blog\",\"description\":\"Leading the conversation on digital connected work\",\"publisher\":{\"@id\":\"https:\/\/blog.planview.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/blog.planview.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/blog.planview.com\/#organization\",\"name\":\"Planview\",\"url\":\"https:\/\/blog.planview.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/blog.planview.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/blog.planview.com\/wp-content\/uploads\/2015\/06\/planview-logo-black.png\",\"contentUrl\":\"https:\/\/blog.planview.com\/wp-content\/uploads\/2015\/06\/planview-logo-black.png\",\"width\":280,\"height\":66,\"caption\":\"Planview\"},\"image\":{\"@id\":\"https:\/\/blog.planview.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"http:\/\/www.facebook.com\/pages\/Planview-Inc\/89422974772\",\"https:\/\/x.com\/Planview\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/blog.planview.com\/#\/schema\/person\/35676ea677995199889c0b6456156ce2\",\"name\":\"Tasktop Blogger\",\"url\":\"https:\/\/blog.planview.com\/author\/tasktop-blogger\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Faster VMs with Vagrant and Chef | Tasktop Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blog.planview.com\/faster-vms-vagrant-and-chef\/","og_locale":"en_US","og_type":"article","og_title":"Faster VMs with Vagrant and Chef","og_description":"Developing and testing changes in an environment that is the same as the deployment environment is one of the magic ingredients of the DevOps way. For engineers at Tasktop working on the Integration Factory, provisioning a new VM can occur multiple times in a day, so any inefficiencies in the process are painful. I recently...","og_url":"https:\/\/blog.planview.com\/faster-vms-vagrant-and-chef\/","og_site_name":"Planview Blog","article_publisher":"http:\/\/www.facebook.com\/pages\/Planview-Inc\/89422974772","article_published_time":"2015-04-01T22:00:00+00:00","og_image":[{"url":"https:\/\/media.planview.com\/tasktop_blog\/wp-content\/uploads\/vagrant-cachier-cache_0.png","type":"","width":"","height":""}],"author":"Tasktop Blogger","twitter_card":"summary_large_image","twitter_creator":"@Planview","twitter_site":"@Planview","twitter_misc":{"Written by":"Tasktop Blogger","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blog.planview.com\/faster-vms-vagrant-and-chef\/#article","isPartOf":{"@id":"https:\/\/blog.planview.com\/faster-vms-vagrant-and-chef\/"},"author":{"name":"Tasktop Blogger","@id":"https:\/\/blog.planview.com\/#\/schema\/person\/35676ea677995199889c0b6456156ce2"},"headline":"Faster VMs with Vagrant and Chef","datePublished":"2015-04-01T22:00:00+00:00","mainEntityOfPage":{"@id":"https:\/\/blog.planview.com\/faster-vms-vagrant-and-chef\/"},"wordCount":258,"publisher":{"@id":"https:\/\/blog.planview.com\/#organization"},"image":{"@id":"https:\/\/blog.planview.com\/faster-vms-vagrant-and-chef\/#primaryimage"},"thumbnailUrl":"https:\/\/media.planview.com\/tasktop_blog\/wp-content\/uploads\/vagrant-cachier-cache_0.png","articleSection":["Engineering Teams"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/blog.planview.com\/faster-vms-vagrant-and-chef\/","url":"https:\/\/blog.planview.com\/faster-vms-vagrant-and-chef\/","name":"Faster VMs with Vagrant and Chef | Tasktop Blog","isPartOf":{"@id":"https:\/\/blog.planview.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/blog.planview.com\/faster-vms-vagrant-and-chef\/#primaryimage"},"image":{"@id":"https:\/\/blog.planview.com\/faster-vms-vagrant-and-chef\/#primaryimage"},"thumbnailUrl":"https:\/\/media.planview.com\/tasktop_blog\/wp-content\/uploads\/vagrant-cachier-cache_0.png","datePublished":"2015-04-01T22:00:00+00:00","breadcrumb":{"@id":"https:\/\/blog.planview.com\/faster-vms-vagrant-and-chef\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.planview.com\/faster-vms-vagrant-and-chef\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blog.planview.com\/faster-vms-vagrant-and-chef\/#primaryimage","url":"https:\/\/media.planview.com\/tasktop_blog\/wp-content\/uploads\/vagrant-cachier-cache_0.png","contentUrl":"https:\/\/media.planview.com\/tasktop_blog\/wp-content\/uploads\/vagrant-cachier-cache_0.png"},{"@type":"BreadcrumbList","@id":"https:\/\/blog.planview.com\/faster-vms-vagrant-and-chef\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blog.planview.com\/"},{"@type":"ListItem","position":2,"name":"Faster VMs with Vagrant and Chef"}]},{"@type":"WebSite","@id":"https:\/\/blog.planview.com\/#website","url":"https:\/\/blog.planview.com\/","name":"Planview Blog","description":"Leading the conversation on digital connected work","publisher":{"@id":"https:\/\/blog.planview.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.planview.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/blog.planview.com\/#organization","name":"Planview","url":"https:\/\/blog.planview.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blog.planview.com\/#\/schema\/logo\/image\/","url":"https:\/\/blog.planview.com\/wp-content\/uploads\/2015\/06\/planview-logo-black.png","contentUrl":"https:\/\/blog.planview.com\/wp-content\/uploads\/2015\/06\/planview-logo-black.png","width":280,"height":66,"caption":"Planview"},"image":{"@id":"https:\/\/blog.planview.com\/#\/schema\/logo\/image\/"},"sameAs":["http:\/\/www.facebook.com\/pages\/Planview-Inc\/89422974772","https:\/\/x.com\/Planview"]},{"@type":"Person","@id":"https:\/\/blog.planview.com\/#\/schema\/person\/35676ea677995199889c0b6456156ce2","name":"Tasktop Blogger","url":"https:\/\/blog.planview.com\/author\/tasktop-blogger\/"}]}},"_links":{"self":[{"href":"https:\/\/blog.planview.com\/wp-json\/wp\/v2\/posts\/21808","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.planview.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.planview.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.planview.com\/wp-json\/wp\/v2\/users\/233"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.planview.com\/wp-json\/wp\/v2\/comments?post=21808"}],"version-history":[{"count":0,"href":"https:\/\/blog.planview.com\/wp-json\/wp\/v2\/posts\/21808\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.planview.com\/wp-json\/wp\/v2\/media?parent=21808"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.planview.com\/wp-json\/wp\/v2\/categories?post=21808"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.planview.com\/wp-json\/wp\/v2\/tags?post=21808"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}