Setting up Chef

1. First you need to install git as your version control system.[TERMINAL]

OSX: In OSX can install this with xcode .

xcode-select --install

2. Install wget to download the chef-repo template from the Opscode page[TERMINAL]

OSX:

cd ~/Downloads
curl -O http://ftp.gnu.org/gnu/wget/wget-1.15.tar.gz
tar -zxvf wget-1.15.tar.gz
cd wget-1.15/
./configure --with-ssl=openssl
make
sudo make install
rm -rf ~/Downloads/wget*

3. Set up up Github to store and manage your chef-repo and share it with others[TERMINAL]

ssh-keygen -t rsa -C "den.seidel@gmail.com" #press just enter and when ask give type you passphrase
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
pbcopy < ~/.ssh/id_rsa.pub #copies the key to your clipboard go to github.com and set the key up there
ssh -T git@github.com #test it

4. Set up chef-repo, download template from Obscode and upload it to github[TERMINAL]

cd ~/ #go to home directory
wget http://github.com/opscode/chef-repo/tarball/master
tar zvf master -x
mv opscode-chef-repo-f9d4b0c/ chef-repo
cd chef-repo/
git init .
git remote add origin git@github.com:den53/chef-repo.git
git add .
git commit -m "initial commit"
git push -u origin master

For a deep introduction to git and github I suggest https://www.udacity.com/course/ud775

5. Install Chef on your terminal/workstation[TERMINAL]

This will download Ruby and all the required Ruby gems into /opt/chef/ embedded. By adding the /opt/chef/embedded/bin directory to your .bash_profile, the Chef command-line tools will be available in your shell.
cd ~/chef-repo/
curl -L https://www.opscode.com/chef/install.sh | sudo bash
echo 'export PATH="/opt/chef/embedded/bin:$PATH"'>> ~/.bash_profile && source ~/.bash_profile

6. Setup a Chef Server on Obscode (alternatively you can set up your private hosted Chef server)[SERVER]

Go to Hosted Chef (https://www.getchef.com/chef/choose-your-version/) and sign up. After registering your account, it is time to prepare your organization to be used with your chef-repo repository.

Go to http://manage.opscode.com/organizations login and download the validation key and configuration file. Now regenerate the validation key for your organization and save it as <your- organization-short-name>.pem in the .chef directory inside your chef-repo repository. Also regenerate your user pulic key and save it in the .chef directory.

7. Create your cookbook[TERMINAL]

knife cookbook create my_cookbook

8. Upload your new cookbook to the Chef Server[TERMINAL]

knife cookbook upload my_cookbook

You can set up a node[NODE] via Vagrant here my example Vegrantfile:
Vagrant.configure("2") do |config|
config.vm.box = "opscode-centos-7.0"
config.vm.box_url = "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-7.0_chef-provisionerless.box"
config.omnibus.chef_version = :latest
config.vm.provision :chef_client do |chef|
chef.provisioning_path = "/etc/chef"
chef.chef_server_url = "https://api.opscode.com/organizations/dennisseidel"
chef.validation_key_path = "~/chef-repo/.chef/dennisseidel-validator.pem"
chef.validation_client_name = "dennisseidel-validator"
chef.node_name = "server"
end
end

9. Add the cookbook to your node’s (here: server1) run list[TERMINAL]:

knife node run_list add server1 recipe[my_cookbook]

10. Run Chef Client on your node [NODE]

sudo chef-client

11. Install a community cookbook (iptables) [TERMINAL]

cd ~/chef-repo/
knife cookbook site install iptables

11. Upload cookbooks to chef server [TERMINAL]

knife cookbook upload --all

12. Manage cookbook dependencies with Berkshelf

cd ~/chef-repo/
vim Gemfile
bundle install

Gemfile:
source 'https://rubygems.org'
gem 'berkshelf'

Edit your cookbook’s metadata:
vim ~/chef-repo/cookbooks/my_cookbook/metadata.rb
...
depends 'chef-client'
depends 'yam'
depends 'ntp'

Edit your cookbook’s default recipe:
vim ~/chef-repo/cookbooks/my_cookbook/recipes/default.rb
include_recipe "chef-client"
include_recipe "yam"
include_recipe "ntp"

Create your Berksfile:
cd ~/chef-repo/
vim Berksfile

site :opscode

metadata

My Developer Setup Version 1

Since I switch from my architect position designing smart systems to it specialist developing this solution myself. My learning is that I need several environment that I can adapt very flexible. In the following post I will describe what tools I use to create this adaptive Setup.

The foundation of all developer setup is the hardware. I currently use an 11 inch macbook air. But I am no advocate of Apple even though my employer has a close partnership with the green fruit 🙂 There I advice to search a portable devices with a long battery life and enough power to run at least one virtual machine with out performance issues. I actually advice to use a Windows devices because there is better support for Office and Productivity products that you will need in the business life.

The development environment are several virtual machines one for mobile development where I use a hackingtosh as my OS. For my connectivity/internet of things and smart industry development environment I use a set of Unix (centOS) based machine. Most of them I start in headless mode via vagrant. This way I can set up a complete DevOps system and mirror the environment of my customers on my machine.

The configuration and installation of all machine includes chef and the scripts for chef (cookbooks) are under source control with git on jazz.net.

I will extend this post with further details and the topics like my editor vim, my terminal configuration with dotfiles and zsh as well as my keybinding management.  To be continued …