# How can I find a way to easily speed up bootstrapping nodes?

**URL:** <https://discourse.chef.io/t/how-can-i-find-a-way-to-easily-speed-up-bootstrapping-nodes/9768>\
**Category:** Chef Infra (archive)\
**Created:** [October 26, 2016, 12:06am UTC](https://discourse.chef.io/t/how-can-i-find-a-way-to-easily-speed-up-bootstrapping-nodes/9768 "2016-10-26T00:06:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Don](https://avatars.discourse-cdn.com/v4/letter/d/ed655f/32.png) [@Don](https://discourse.chef.io/u/Don)\
**Post date:** [October 26, 2016, 12:06am UTC](https://discourse.chef.io/t/how-can-i-find-a-way-to-easily-speed-up-bootstrapping-nodes/9768/1 "2016-10-26T00:06:39Z")

</div>

I have been struggling with speeding up bootstrapping nodes and it seems quite difficult to find an easy way.  
First, I tried using Squid proxy but chef bootstrap uses https communication to download packages and my squid proxy doesn’t cache the contents with https communication. I have tried Squid to cache for https communication but it seems pretty complicating and not recommended by its design purpose.  
So second, I have tried making local apt repo(since I usually work with Ubuntu) to speed up downloading the packages but it seems there is no option for ‘chef bootstrap’ to download chef packages from a specific URL.  
Can anybody help me to solve this problem? Am I doing wrong or misunderstanding?  
Please help.

Thank you,  
Dongwon

---

<div class="post-metadata">

**Author:** ![kkeane](https://avatars.discourse-cdn.com/v4/letter/k/9fc29f/32.png) [@kkeane](https://discourse.chef.io/u/kkeane)\
**Post date:** [October 26, 2016, 1:35am UTC](https://discourse.chef.io/t/how-can-i-find-a-way-to-easily-speed-up-bootstrapping-nodes/9768/2 "2016-10-26T01:35:58Z")

</div>

Bootstrapping basically just involves copying a script over to the node and executing it. The script is not very complicated, actually; it just sets up /etc/chef and adds a basic configuration file and a validation key, installs chef and then runs it.

There are several options:

- You can create your own bootstrapping script, based on the default one.
- You can install the chef client before bootstrapping. The package manager (apt in your case) should recognize that the package is already installed, and not re-download it.

In my own system, I am taking the second approach. My systems are CentOS and specific to my site, so my script would be fairly useless for you, but the general idea might help.

My OS gets installed with kickstarter in an unattended install. I simply added installing chef to the kickstarter script. The kickstarter script also sets up the validation key and configuration file in /etc/chef, and then launches the initial chef run.

That’s pretty much all the bootstrapping process does, so my systems don’t really need to be bootstrapped at all; it happens automatically at OS install time.

Kevin Keane  
Whom the IT Pros Call  
The NetTech  
[http://www.4nettech.com](http://www.4nettech.com)  
Our values: Privacy, Liberty, Justice  
See [https://www.4nettech.com/corp/the-nettech-values.html](https://www.4nettech.com/corp/the-nettech-values.html)

---

<div class="post-metadata">

**Author:** ![Don](https://avatars.discourse-cdn.com/v4/letter/d/ed655f/32.png) [@Don](https://discourse.chef.io/u/Don)\
**Post date:** [October 26, 2016, 4:11am UTC](https://discourse.chef.io/t/how-can-i-find-a-way-to-easily-speed-up-bootstrapping-nodes/9768/3 "2016-10-26T04:11:36Z")

</div>

I will also choose the second one.  
Thank you so much!

---

<div class="post-metadata">

**Author:** ![spuder](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/spuder/32/1382_2.png) [@spuder](https://discourse.chef.io/u/spuder)\
**Post date:** [October 26, 2016, 4:11pm UTC](https://discourse.chef.io/t/how-can-i-find-a-way-to-easily-speed-up-bootstrapping-nodes/9768/4 "2016-10-26T16:11:57Z")

</div>

Use [packer.io](http://packer.io) to automate making new golden images on a schedule.

> **[Packer by HashiCorp](https://www.packer.io/)**
>
> Packer is a free and open source tool for creating golden images for multiple platforms from a single source configuration.

Packer includes a ‘chef-client’ and ‘chef-solo’ provisioner that will install chef for you, and optionally run any cookbooks.

> **[Chef Client - Provisioners - Packer by HashiCorp](https://www.packer.io/docs/provisioners/chef-client.html)**
>
> The chef-client Packer provisioner installs and configures software on machines built by Packer using chef-client. Packer configures a Chef client to talk to a remote Chef Server to provision the machine.

Having chef preinstalled on the image, will save several minutes bootstrapping.

Here is a snippet on a windows packer image

```auto
    {
      "type": "chef-solo",
      "guest_os_type": "windows",
      "install_command": "powershell.exe -Command \". { iwr -useb https://omnitruck.chef.io/install.ps1 } | iex; install\"",
      "cookbook_paths": ["cookbooks"],
      "run_list": []
    },

```

On ubuntu images, we just use a simple bash script

```auto
    "type": "shell",
    "environment_vars": [
      "HOME_DIR=/home/vagrant",
      "http_proxy={{user `http_proxy`}}",
      "https_proxy={{user `https_proxy`}}",
      "no_proxy={{user `no_proxy`}}"
    ],
    "execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E sh -eux '{{.Path}}'",
    "scripts": [
      "scripts/ubuntu/common/install-chef.sh",
      "scripts/ubuntu/common/vagrant.sh",
      "scripts/ubuntu/common/cleanup.sh",
      "scripts/ubuntu/common/minimize.sh"
    ]

```

where [install-chef.sh](http://install-chef.sh) looks like:

```auto
#!/bin/bash
curl -L https://omnitruck.chef.io/install.sh | sudo bash

```

---

<div class="post-metadata">

**Author:** ![Don](https://avatars.discourse-cdn.com/v4/letter/d/ed655f/32.png) [@Don](https://discourse.chef.io/u/Don)\
**Post date:** [October 26, 2016, 11:45pm UTC](https://discourse.chef.io/t/how-can-i-find-a-way-to-easily-speed-up-bootstrapping-nodes/9768/5 "2016-10-26T23:45:58Z")

</div>

Thank you for the recommendation!  
I will try that soon as well.
