Chef notes

Sometime back I had to fiddle with Chef. I created some notes, posting it over here, so that I won’t loose it. Don’t think it’ll be useful much to anyone else other than me 🙂 Its basically a list of instructions that is scattered on their site.

So, anyone other than me, please ignore this post!

Write a cookbook
chef generate repo ~/chef-repo
=> Install starter kit to create .chef directory and certs that we need to communicate with chef server
cd ~/chef-repo
chef generate cookbook cookbooks/COOKBOOK_NAME

Create a recipe:
chef generate recipe cookbooks/COOKBOOK_NAME RECIPE_NAME ## RECIPE_NAME shouldn’t have suffix. Eg. it should be ‘webserver and not ‘webserver.rb’
=> Write the script in RECIPE_NAME.rb file that got generated

How to refer(include) a recipe(RECIPE_NAME) in another recipe:
include_recipe 'COOKBOOK_NAME::RECIPE_NAME' ## Eg: include_recipe 'my_cookbook::webserver'

## By default the recipe that gets called is ‘cookbooks/COOKBOOK_NAME/recipes/default.rb’
## So include any other recipe in this using include_recipe

Create a file:
chef generate file cookbooks/COOKBOOK_NAME FILE_NAME.txt

How to upload the cookbook to the chef server. There are 2 ways:
## Option 1. Prefer this one. This one takes up the dependencies if any.
## Create a file named Berksfile in the ~/chef-repo/cookbooks/COOKBOOK_NAME directory
## Add the following to that file:
source ""
## Install the dependencies:
berks install
## Finally upload (along with dependencies):
berks upload ## OR without SSL => berks upload --no-ssl-verify
## Option 2. This one just uploads the cookbook. Won’t download dependencies
knife cookbook upload COOKBOOK_NAME

View uploaded cookbooks:
knife cookbook list

Bootstraping the node
knife ssl fetch ##Save the SSL certificate
## Verify bootstrap process was successful. Either check in chef manage console or do:
## On Windows
knife node list | findstr NODE_NAME_WINDOWS
## On Linux
knife node list | grep NODE_NAME_WINDOWS

How to reference another cookbook:
## Append following to ~/chef-repo/cookbooks/COOKBOOK_NAME/metadata.rb:
depends 'ANOTHER_COOKBOOK_NAME', '~> MAJOR.MINOR.PATCH' ## Eg: depends 'sql_server', '~> 2.4.0'

How to override third party cookbook’s attributes:
## Create a custom attribute file that overrides third party attribute values:
chef generate attribute cookbooks/COOKBOOK_NAME default
## Add override values as follows in the generated ‘cookbooks/COOKBOOK_NAME/attributes/default.rb‘:
## Eg: default['sql_server']['accept_eula'] = true
## Eg: default['sql_server']['version'] = '2012'
## Eg: default['sql_server']['instance_name'] = 'MSSQLSERVER'

Modifying cookbook version:
## Edit ~/chef-repo/cookbooks/COOKBOOK_NAME/metadata.rb to change the version

Applying cookbook on node:
## Run the following directly on the NODE, (NOT ON THE workstation):

Java: Add lib folder to classpath

Adding non standard, non-maven, custom jars in a maven project is a common issue. And this SO post is usually the first googled result. But here is another easier way: Use addjars-maven-plugin. Its easier, no need to run any script, no installing of jars manually, or use the dreaded system scope. Using this also means, the shaded uber jar that gets created will contain the custom jars.

How to use?

Add the jars to a lib folder directly inside the project directory (the project directory now contains lib, src and other usual stuff). Now add this to the pom:


This may not be recognised by the IDE (my Intellij didn’t), but it will work via CLI. So no worries! Very useful in those rare cases, where you have a dozen of custom jars!

My Developer Personality

I took a Developer Personality Test, conducted by DZone and it almost sums up what I am! Here’s the result I got:

Here are your results!

Independent vs Collaborative

You are Independent!

You prefer to spend most of your time working in an isolated environment.  You rarely want to collaborate because you have a better chance of solving problems on your own.  If you do have to collaborate on the direction of a project, you dislike it when you have to defend your position or when others try to muddy your plans for the project.  It’s better to have one strong vision for a project from the lead programmer on that project.  Having a large team or allowing others to have significant control over the project risks communication errors, a muddied code base, and inefficiencies.  If one developer has a firm grasp on the entire codebase, they’ll be much better at fixing and improving it quickly.

Good code doesn’t happen in a vacuum.  You need a team to keep you energized and on your toes so that you’re constantly improving the project code using the entire team’s varied experience and strengths.  You like to talk frequently with colleagues and discuss ideas so that you can learn from others and spark ideas.  It doesn’t matter what their experience level is, you can always learn something by including everyone.  A solo coder can’t possibly code a large software project with the speed and quality that a team can.

Abstract vs Low-Level

You are both Abstract & Low-Level!

You prefer to write in languages and frameworks that simplify development as much as possible and use as few characters and lines of code as possible. The trajectory of software development has always been toward making life easier and error-free. Programming has always been about adding more abstraction layers to simplify tasks, so why not trust the technology on your layer and don’t worry about handling the lower layers?

The more abstraction tools and high-level languages we build, the further we get from understanding and controlling the deeper components in our programs.  This means lower performance and endless bug searches.  Developers today need to have a stronger understanding of compilers, memory management, pointer arithmetic, and other low-level topics.

Frontier vs Conservative

You are Conservative!

You like to work at the cutting edge.  Using too many old languages and technologies bores you, and it severely hinders your software’s potential to keep outdated technologies in it for too long. Developers need keep their ears to the ground for new technologies and new versions of tools that they already use.  Even if the community and maturity of the project isn’t at a level that most enterprises would consider “safe,” you’re willing to be an early adopter if you believe the community and the technology has momentum.  Development technology is changing faster every day, and we need to constantly be adopting new tools and methods to keep up.

It seems like every 10 years we forget all the problems we solved in the previous decade and start to build ‘new’ tools that solve the same problems, even though there is a perfectly good solution that has existed for years.  Enterprises have it right when they make conservative decisions about their technology stack. Why would you hang your business on a technology with only a few years of maturity in just a handful of production use cases?  Technologies like PHP, Java, and SQL have been mainstays of the development industry for years, and it takes a lot of time for new technologies to make it into that maturity tier.

Generalist vs Specialist

You are both a Generalist & a Specialist!

You like to be known as a “Jack of all Trades” and a reference for others on your team. You jump at every chance to enhance your skills in a wide variety technology topics, not just the ones that apply to your day to day work.  You don’t always know when it might be useful to have these extra skills, but when the time comes, you are ready.  If more developers took the time to learn other skills outside of the ones relevant to their project, they’d work more seamlessly with the rest of their organization because they’d have more empathy and understanding of the challenges that their colleagues face.

If you’re a Jack of all Trades, you’re a master of none. Mastery in one or two areas is what makes you valuable.  What’s the point of learning skills for other jobs you don’t have and can’t control? When you plan for a project or do technical research, it’s always focused on something you’re working on. You don’t get side-tracked. If you learn a new skill, it’s because the project requires that you do it. Most or all of your hobby projects are also building your mastery of the skills you use at your job.

Idealist vs Pragmatist

You are an Idealist!

You believe in the power of well-defined processes. It’s crucial to an organization’s success that they create and follow appropriate and effective processes for building software. Trying to improvise or play it by ear invites the possibility of workflow errors that can decrease the quality of the software or even cause major product failures. Planning is also extremely important to you.  You like to research all of the things you will need to know before starting a project.  It’s important to find out the best architecture for your software beforehand, and then strictly implement that architecture with objective best practices.  The more planning and scaffolding you do in the beginning, the less overall work you will have to do to complete the software.

Speed is your best weapon in a competitive industry, and to quickly prototype and build new products, you need to have a flexible, pragmatic process.  You don’t have a few months to plan your projects, you need to just start coding and a good path for the project will reveal itself.  Great products are made through frequent feedback and releases, so why shouldn’t your plan be just as adaptable? Your plan should be adapted to changes in the software, and your expertise should be adapted to the project. You shouldn’t spend your precious time studying a problem that you’re not certain to run into while coding your projects.  Trying to build test coverage for every possible scenario and having long meetings throughout the process are a waste of time and distract you from doing more productive work.

RIP Thulika Keyboard.. (sob).. (sob)

Just got to know that Google has came up with an handwriting recognition app – Google Handwriting Input.

And the good part is it has got Indian language support. Yay!!

But the bad part is that, it means the demise of my very own Thulika Keyboard. I had created it about 2 years back, and at that time there was no handwriting recognition app for any Indian language. I also had opensourced it, and have got requests from many to translate it to their language(Arabic, Hausa, Tamil to name a few) and some even have used it as part of their school/college projects.

RIP Thulika Keyboard, it was pleasure to have you around(it’s still out there, so you can download it and play with it, but with Google’s new app, mine seems a bit primitive 😦 ).


Google’s new app is awesome though, it recognises full words (mine could only do a letter at a time), and speaking about recognition, its very good at that.

So, here is me(Thulika), the old out dated tech giving way for the new stylish Google app 😉