Migrating data from exitsted chef11 servers to new chef12 server

It’s not clear to me if you’re running Chef 11 open source server or Enterprise Chef 11 server (you didn’t say). I’m going to assume you’re running Chef 11 open source server.

I’d recommend the Chef supplied tooling for this. If you install the Chef 12 package (chef-server-core) on the Chef 11 systems, you get all the upgrade tooling (But don’t run reconfigure). Your Chef 11 server will still be present and continue to work - the only thing that will change is that the chef-server-ctl command will point to the Chef 12 version (located at /opt/opscode/bin/chef-server-ctl), but you can still access the Chef 11 chef-server-ctl by pointing to it directly at /opt/chef-server/bin/chef-server-ctl. Be aware of this for any scripts you might run against your server or when working on the box directly. You can then use the upgrade tooling to achieve what you want, without doing an in-place upgrade on the server. Once you’re done, you can uninstall the Chef 12 package and fix the path and everything on the Chef 11 server will be back to how it was.

This process works because the Chef 12 server installs to a different direction from Chef 11 open source server. The in-place upgrade, when you run the chef-server-ctl upgrade command is actually 3 steps: download the data from the Chef 11 server, transform it to the needed format for the Chef 12 server, upload it to the Chef 12 server. There are commands that will let you run these steps individually, so you can download the data from your Chef 11 server, transform it, then copy it over to a fresh box and upload it to the new Chef 12 server. This will capture everything you need in the process.

Docs on the in-place upgrade are here: https://docs.chef.io/upgrade_server.html#from-chef-server-osc

Docs on the individual commands to do what you want are here: https://docs.chef.io/upgrade_server_open_source_notes.html#manual-upgrades

Note that there are a slew of command line options here. You can run chef-server-ctl upgrade --help to see them all. One thing to realize about the process is that by default it will download your Chef 11 data to a directory under /tmp and it will transform the data by copying it to another directory in /tmp and making the needed transforms. These directories are somewhat randomized so this process can be repeated and for security reasons, but you can find them by looking in /tmp and find the dirs with chef11 and chef12 in the name. The data in them is just json, so it’s possibly to go in and manually change something if you want before upload to the Chef 12 server. This data is also not deleted off the server, so if something goes wrong it’s still available, and so you can grab it for backup if needed (you are hopefully backing up your server already).

One last point about upgrades: the Chef 11 open source server did not have orgs, where as the Chef 12 server does. During the upgrade process the tooling asks you to supply a default org. This is the org that any requests that come into the server that don’t specify an org will be routed too. This keeps you from needing to go update all your client.rbs with the org name. You should probably still do that at some point, but just so you’re aware of this point.

Hopefully that helps. If you need more clarification, just ask and I’ll do the best I can to answer any questions.

Mark Mzyk
Chef Software Engineer