As some of you may know I was recently DDoSed and Was Terminated by Linode for being flooded with 5.11MB/s of Traffic 3 times over a 5 day period. This left me looking for a new solution. I only had a ZNC Server and a couple of DNS Servers with them so it was no big Loss. (For DNS I now use AWS Route 53 its awesome) Any way in my search I came across DigitalOcean and must say I am very impressed with their Pricing, and no bullshit infrastructure. I thought while I was at it I would get better acquainted with chef as although I have used chef in the past I never setup my own chef server so decided to do so. I also found out how simple it is to bootstrap and run an SSD Cloud Instance on DigitalOcean with  Chef.

Preperation

To get started you will need a DigitalOcean account. If you sign up through this link you can get started with a free $10. In the interest of full disclosure if you spend $25 I  get $25 in my account too! Once you have your account create a CentOS 6 x64 Virtual Machine. I highly recommend 2GB RAM Minimum if you want to follow these instructions as Chef does get OOM Killed pretty quickly with any lower.

Server Installation

Now that you have your VM you will want to grab the Chef Server (For RHEL) and Chef Development Kit (For your OS) from https://downloads.chef.io Stick the Server rpm on your server and simply to.

This will install the chef server core. Once you have done so you will need to add your FQDN into your /etc/hosts file. Mine looks like this

This will let chef detect your FQDN when configuring itself for the first time. To Configure Chef you use the chef-server-ctl tool you got when you installed chef. You call the tool with the reconfigure argument

Since this is the first time you have configured chef go ahead and grab a beer/tea/coffee since this step will take a little time.

Server Configuration

If you have followed me so far you should have the workings of a chef server! now we need to configure the server before setting up your Workstation. Since chef can have multiple organisations and users we will need to configure a user.

So mine will look like this

Now we have our user, We need to associate them with an organisation.

So mine will be

And thats it. You have configured your chef server!

Workstation Setup

So now we need to configure our workstation. Hopefully you downloaded your package for your OS. I am using MacOSX however this will work for everyone. Simply install the package for your OS. Now we need a repo. For speed we can use the pre-created repo available on github. This is not the recommended method however it does work. Clone the repo.

Now you have the repo cloned we need to add a .chef folder.

Once you have got this far we need to configure the knife tool. Knife is your gateway to becoming a great chef! these parts take place inside the .chef folder

Now we ned to place the certificates we generated above in this directory. This is how knife communicates with the chef server. Download these using your method of choice, I use scp.

Awesome so far you have your certificates. Now we need to create a file called knife.rb inside the .chef folder. The contents should be as follows.

It is VERY important you use your FQDN in the chef_server_url, failure to do so will cause issues with SSL Validation. Now we need to fetch our SSL Certificate. Do this from the chef-repo directory

If all went well you can now check your chef installation.

Congratulations if you followed this guide you should now have a working chef Server and Workstation Setup. Stay Tuned for Part 2 Where we will learn how to create and Bootstrap SSD Cloud Server with DigitalOcean and Chef! Get Your $10 and DigitalOcean Account Here : https://www.digitalocean.com/?refcode=368a394500c1