Search code examples
chef-infrachef-recipecookbook

How many cookbook versions is safe to store on chef server


As I keep uploading updated versions of my cookbooks to chef server I have to wonder if there is a limit to the number of versions of a cookbook chef server can store.

Is this something I should even be concerned about or is it a none issue? Disk space is obviously not what I'm worried about here.


Solution

  • I don't think there's going to be a good answer to this question. I'd say that you don't want to design your workflow around this problem and definitely don't want to be deleting cookbooks every time you upload.

    Periodic garbage collection (once or twice a year) is probably a good idea, but its going to depend deeply on how you structure your cookbooks and their dependencies and how much you 'stress' the dep solver (gecode or molinillo) that you're using.

    If you're not seeing slow dep solving, then there's no need to do it. If you are seeing slow dep solving then you should strongly consider doing it.

    If you have a large site with dozens of people contributing to hundreds of cookbooks, and you haven't garbage collected old, out of date cookbook versions for years and some of your popular cookbooks have hundreds or thousands of versions stored on the server... Probably be useful to think about it.

    If you're just setting out and its mostly your team and a few dozen cookbooks and at most you have a few dozen versions, then its less likely to be an issue.

    If you're somewhere in between... maybe?

    ADDED (Oct 8 2016): Another issue to consider is that with lots of cookbook versions sometimes the depsolver becomes "overly clever" in picking extremely old cookbook versions that you've forgotten about but which allow it to satsify all its constraints. I just recently ran into this with two cookbooks that had conflicting constraints (dovecot wanted ohai ~> 3.0 while chef_nginx wanted ohai ~> 4.0) to solve this problem the depsolver helpfully downgraded my wrapper cookbook to a version that was so old that I was using uw-imapd instead of dovecot, which removed the ohai constraint from dovecot and made the depsolver happy, while making me quite sad because Ubuntu hasn't even shipped uw-imapd for years now. One way to deal with this is to be more a lot more explicit about constraining cookbooks to the latest versions with pins. You can also simply dump those unused versions out of your chef-server, though, so that they're not available for depsolving.