Project: Building a Chef 12 Server on DigitalOcean
scottalanmiller last edited by scottalanmiller
So tonight I am working on building a new Chef 12 server on Digital Ocean. I am going to be working from the DO documentation which has me using Ubuntu 14.04 LTS as the base for the server. Setting this Droplet up in their NYC datacenter. I have built Chef before, but going to go for the latest this time (I've built 11 before and worked on 10 and 11), going with the open source community version and doing it by DO's directions instead of the ones from OpsCode.
My one divergence from the directions right at the beginning is to build a much smaller instance than the one that they suggest. OpsCode recommends four cores and 4GB of RAM. DigitalOcean runs their example on four cores and 8GB of RAM. I've found that these things are often overkill and am going to see what we can do with a single core and 1GB of RAM since this will be lightly used and growing it in the future is very simple to do.
Let's have some fun with DevOps!
Droplet creation is underway. Since I am going for such a small deployment, it is only $10/mo. Not bad at all.
Following good naming convention, the new server is: dny-lnx-chef
DNY: DigitalOcean New York
Chef: The application running there.
Added the new node into DNS on CloudFlare. We use key based access so it is already accessible from our main Jump Station.
Getting all system updates applied before getting down to business.
Downloading Chef 12.1.2 now.
sudo dpkg -i chef-server-core_12.1.2-1_amd64.deb
There was a warning in the DO instructions here: This will install the base Chef 12 system onto the server. If you have selected a server with less powerful hardware than the recommended amount, this step may fail.
But even on this little single core, 1GB RAM Droplet everything appears to have gone smoothly, no errors were generated.
I always add a few extra packages of my own:
sudo apt-get install htop sysstat fail2ban
Turn on SAR data collection:
sudo vi /etc/default/sysstat
Set the value of ENABLED to true.
Because we are creating an instance that is so tiny and tight on resources, it would be smart to set up some swap space right from the beginning to make sure that we are as well situated as possible. This is a pretty standard procedure but DigitalOcean actually has a specific How To made for this specific to Ubuntu 14.04.
sudo fallocate -l 3G /swapfile sudo chmod 600 /swapfile sudo mkswap /swapfile sudo swapon /swapfile
You will want to make that swap file permanent too:
echo "/swapfile none swap sw 0 0" >> /etc/fstab
Next up, reconfiguring chef:
sudo chef-server-ctl reconfigure
This step takes several minutes to run, so don't be surprised.
Now it is time to create an admin user. Of course, you will need to modify this command for your own purposes.
chef-server-ctl user-create USERNAME FIRST_NAME LAST_NAME EMAIL PASSWORD
This last step will output a private key. Make sure to save this before going on to do anything else.
Now to make our first organization, we will make a test one to get started.
chef-server-ctl org-create SHORTNAME LONGNAME --association_user USERNAME -f filename
That's the format, here is a real command:
chef-server-ctl org-create test "Chef Testing NonProd" --association_user scott -f scott.pem