Table of contents
1.
Introduction
2.
Upgrade in Chef
2.1.
Disable Automatic Upgrade
3.
Upgrade to 3.X in Chef Automate
3.1.
Normal Upgrade to 20220329091442 
3.2.
Airgapped Upgrade to 20220329091442 
3.3.
Path Upgrade from Version 20220329091442 to 3.0.x
4.
Upgrade Chef Automate to 4.0.x
4.1.
Upgrade Path from 3.0.49 to 4.0.x
5.
Frequently Asked Question
5.1.
Is the 3.0.x version higher than 20220329091442?
5.2.
Can we disable the automatic upgrade in chef automate?
5.3.
What precautions should we take before upgrading?
5.4.
How to handle downtime?
5.5.
How do you verify whether the service is working or not?
6.
Conclusion
Last Updated: Mar 27, 2024
Medium

CHEF - UPGRADE

Author dhananjay
0 upvote
Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

This post will walk you through upgrading Chef Automate to various versions in various ways. You can choose to upgrade any version according to your need. It is essential to upgrade from time to time to utilize the smooth functionality of the chef automates without any problem.

Upgrade in Chef

Upgrade in Chef

Suppose there is a patch update or minor upgrade available in chef automate. In that case, it will automatically be upgraded without any issues. Still, for a major upgrade like the chef has added some new features, you need to manually upgrade your Chef Automate, which is not a hard task.

You just need to add --major flag in CLI for a major upgrade.

chef-automate upgrade run --major

Disable Automatic Upgrade

If you don't want to upgrade, automatically change the upgarde_strategy setting to none in config.toml file.

upgrade_stratergy = “ none “


To manually upgrade to a minor version, run the command:

chef-automate upgrade run

Upgrade to 3.X in Chef Automate

As we have mentioned, chef automate will automatically upgrade to a minor version, but you need to do it yourself to upgrade to a major version. To upgrade to 3.0.X, you need to first upgrade to version 20220329091442; follow the instructions below:

First, check the current version of your chef automates by:

sudo chef-automate version

If the current version is less than 20220329091442, then you can proceed to upgrade.

Normal Upgrade to 20220329091442 

  • Run command in CLI
sudo chef-automate upgrade run

 

  • Check services status
sudo chef-automate status

Airgapped Upgrade to 20220329091442 

Internet-connected machine

  •  Download Chef Automate CLI:
curl https://packages.chef.io/files/current/latest/chef-automate-cli/chef-automate_linux_amd64.zip | gunzip - > chef-automate && chmod +x chef-automate

 

  • Create bundle version 20220329091442
./chef-automate airgap bundle create --version 20220329091442

 

  • Move the latest automate-20220329091442.aib file and CLI chef-automate to the airgapped machine running Chef Automate.

 

Now on airgapped machine running Chef Automate

sudo ./chef-automate upgrade run --airgap-bundle automate-20220329091442.aib

 

  • Check services status by:
sudo chef-automate status

Path Upgrade from Version 20220329091442 to 3.0.x

Upgrade Path

There will be four possible ways by which you can upgrade.

  1. With Embedded PostgreSQL
     
  • First, start a major upgrade
sudo chef-automate upgrade run --major

 

  • Check upgrade Status
sudo chef-automate upgrade status

 

  • Migrate data from PostgreSQL 9.6 to 13
sudo chef-automate post-major-upgrade migrate --data=PG

 

  • Check services status
sudo chef-automate status

 

  • Verify data in chef automate
sudo chef-automate post-major-upgrade clear-data --data=PG

 

2. With External PostgreSQL
 

  • To manually update your PostgreSQL version check out external PostgreSQL upgrade official documentation available by Chef Automate.

     
  • start major upgrade
sudo chef-automate upgrade run --major

 

  • Check services status
sudo chef-automate status


There are two more ways to upgrade our path; You can check out the official documentation link for the other two methods. 

  1. Air-Gapped Environment With Embedded PostgreSQL
     
  2. Air-Gapped Environment With External PostgreSQL

Upgrade Chef Automate to 4.0.x

Upgrade Path

Before upgrading the path check out the current version if it is less than 3.0.49 then first upgrade it to 3.0.X. check out the steps given above.

Check version

sudo chef-automate version

If the current version is  3.0.X then you can upgrade with:

chef-automate upgrade run --major

Upgrade Path from 3.0.49 to 4.0.x

Upgrade With Embedded Elasticsearch

  • First, start a major upgrade
sudo chef-automate upgrade run --major

 

  • Check upgrade Status
sudo chef-automate upgrade status

 

  • Switch off maintenance
sudo chef-automate maintenance off

 

  • Copy the relevant configuration fields of elasticsearch into opensearch configuration.
To apply this use config patch command

 

  • Move data from elasticsearch to opensearch 
sudo chef-automate post-major-upgrade migrate --data=es

 

  • Check services status
sudo chef-automate status

 

  • Delete old elasticsearch data
sudo chef-automate post-major-upgrade clear-data --data=es

 

 Upgrade with External Elasticsearch

  • First, start a major upgrade
sudo chef-automate upgrade run --major

 

  • Check upgrade Status
sudo chef-automate upgrade status

 

  • You have to upgrade your external elasticsearch to opensearch manually.
     
  • Copy the relevant configuration fields of elasticsearch into opensearch configuration.
     
  • Switch off maintenance
sudo chef-automate maintenance off

 

There are two more ways to upgrade our path; You can check out the official documentation link for the other two methods. 

Air-Gapped Environment With Embedded ElasticSearch
 

Air-Gapped Environment With External ElasticSearch

Frequently Asked Question

Is the 3.0.x version higher than 20220329091442?

Yes, the version before 20220329091442 is a lower version of chef automates than 3.0.X.

Can we disable the automatic upgrade in chef automate?

Just make upgrade_stratergy = "none "in confid,toml file in chef automate.

What precautions should we take before upgrading?

Just back up your data before upgrading to a higher version.

How to handle downtime?

Just enter sudo chef-automate maintenance to turn on maintenance, and the environment will handle the downtime.

How do you verify whether the service is working or not?

sudo chef-automate status

Conclusion

We learned how we could upgrade to different versions of chef automate in various possible ways. And we have also known other useful commands that we can use in chef automate CLI, like how to check the current version and how we can disable automatic upgrades.

To learn more about the chef, you can check out the following articles:

CHEF - HIGH AVAILABILITY

CHEF - SETTINGS

CHEF - DEPLOYMENT

Chef-shell (executable) - DEBUGGING TOOL

To learn more about DSA, competitive coding, and many more knowledgeable topics, please look into the guided paths on Coding Ninjas Studio. Also, you can enroll in our courses and check out the mock test and problems available to you. Please check out our interview experiences and interview bundle for placement preparations.

Live masterclass