Summary
I want to update my Chef Infra Server to 14.x directly from 12.x
- If you are on 12.17.15, go for it, following the directions in https://docs.chef.io/server/upgrades/#upgrade-matrix
- If you are not on 12.17.15, you will need to get there before attempting any upgrade to 14.x
An example: I have a Tiered install which I tried to upgrade 12.3.1 -> 14.0.65.
This is not a viable upgrade, as any upgrade to 14.x must be preceded
by an upgrade to at least 12.17.15 as specified in https://docs.chef.io/server/upgrades/#upgrade-matrix
Distribution
Product | Version | Topology |
Chef Infra Server | 12.x | Tiered |
Process
Plan
Preparation: If you are on 12.17.15, then review these directions to get to the latest 14.x https://docs.chef.io/server/upgrades/#upgrading-to-14x Do not miss the sections for 14.8 and 14.14
If you are not yet on 12.17.15, then review these directions as well as the 14.x directions above to formulate your upgrade plan. https://docs.chef.io/server/upgrades/#upgrading-to-121715
As always, have a snapshot or other tested backup ready if something goes wrong in your upgrade process.
Troubleshoot
Analysis:
In a system where a direct upgrade to 14.x was attempted, I can see problem like the following.
If I look at the opscode_chef_sqitch_tags.txt from the gather-logs bundle for the system improperly upgraded 12.x to 14.x, I can see the sqitch(python database migration tool) tag for the most recently applied database migration at the bottom of the file. This was the last migration applied. It looks like this. These entries can be mapped to migration numbers like 1.20, 1.27, and from there to sets of Chef Infra Server versions.
7d3c17f721a95112c339aa01a1c54f9683dc2872|@node-policyfile-fields|enterprise_chef|63eb3cecdba8633b7b9fd39db18e35cbdb942a13|Add policyfile fields to node|2016-07-21 07:47:45.587248+00|root|root@sgct2chefba01p.apac.nsroot.net|2015-09-05 01:47:34+00|Daniel DeLeo|ddeleo@lorentz.local
This last migration equated to Chef Server 12.3.1 or 1.27 in
/var/opt/opscode/upgrades/migration-level file system terms on an operating Chef Infra Server. I know this by digging around in the migrations available for Chef Server 12.3.1. The
sqitch tag above is @node-policyfile-fields or 1.27
You can see that this is true by looking at https://github.com/chef/chef-server/tree/12.3.1/omnibus/files/private-chef-upgrades/001
Also, in a working system, you can find the actual migrations at the path given below. Each one of these files corresponds to a single migration as detailed above and are defined by their name or sqitch tag. /opt/opscode/embedded/service/opscode-erchef/schema/deploy
To look directly at the database and compare sqitch-added migrations,
we can do something like this. To look at the addition of the
new fields to the nodes table for policyfiles in particular, we can do this
sudo su - opscode-pgsql
Last login: Thu Feb 17 18:55:21 UTC 2022
-sh-4.2$ psql
opscode-pgsql=# \c opscode_chef
You are now connected to database "opscode_chef" as user
"opscode-pgsql".
opscode_chef=# \d nodes
Table "public.nodes"
Column | Type | Collation | Nullable | Default
-------------------+-----------------------------+-----------+----------+---------
id | character(32) | | not null |
authz_id | character(32) | | not null |
org_id | character(32) | | not null |
name | text | | not null |
environment | text | | not null |
last_updated_by | character(32) | | not null |
created_at | timestamp without time zone | | not null |
updated_at | timestamp without time zone | | not null |
serialized_object | bytea | | |
policy_group | character varying(255) | | |
policy_name | character varying(255) | | |
Indexes:
"nodes_pkey" PRIMARY KEY, btree (id)
"nodes_authz_id_key" UNIQUE CONSTRAINT, btree (authz_id)
"nodes_org_id_environment_index" btree (org_id, environment)
"nodes_org_id_name_key" UNIQUE CONSTRAINT, btree (org_id, name)
"nodes_policy_group" btree (org_id, policy_group)
"nodes_policy_name" btree (org_id, policy_name)
Referenced by:
TABLE "node_policy" CONSTRAINT "node_policy_node_id_fkey" FOREIGN KEY (node_id) REFERENCES nodes(id) ON DELETE CASCADE
\q
exit
These changes to the nodes table are produced by 1.27 with the DDL listed at
https://github.com/chef/chef-server/blob/12.3.1/src/oc_erchef/schema/deploy/node_policy_name_policy_group.sql
It adds the policy_name and policy_group fields and their attendant indexes to the nodes table.
12.17.15 has migration-level 1.34, so to get there, you would need 6
more migrations from https://github.com/chef/chef-server/tree/12.17.15/omnibus/files/private-chef-upgrades/001
Comments
0 comments
Article is closed for comments.