Table of contents
1.
Introduction
2.
Installation
2.1.
Connect to Supermarket
2.2.
Upgrade a Private Supermarket
3.
Configuration
4.
Backup and Restore
4.1.
CookBook Backup
4.2.
Database Backup
4.3.
Cookbook Restore
4.4.
Database Restore
5.
Frequently Asked Questions
5.1.
What is Chef infra server?
5.2.
What are LDAP and SAML?
5.3.
What is Chef automation?
6.
Conclusion
Last Updated: Mar 27, 2024
Medium

Brief about Chef Private Supermarket

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

Introduction

Chef Supermarket is a collaborative cookbook repository. It has a searchable cookbook repository and a user-friendly web interface. Cookbooks in the Chef Supermarket are available to all Chef users.

Chef Private Supermarket

The private Chef Supermarket is installed on the internal network behind a firewall. It behaves similarly to the public Chef Supermarket, with the exception of changing the location from which community cookbooks are maintained.

In this blog, we will briefly discuss what chef Private supermarket is. We will also see the installation and configuration of the Chef Private Supermarket.

Installation

The source code of the chef supermarket can be found on the below-mentioned links:

Chef’s Community Platform

Supermarket Cookbook for Omnibus install

There are a few requirements for the Chef Supermarket. Let’s have a look at all of those requirements.

✴️ Operational Chef Infra Server, which serves as the OAuth 2.0 provider.
 

✴️ A chef infrastructure server user account with administrative rights.
 

✴️ A user account key for the Chef server.
 

✴️ A Linux host that is x86_64 compatible and has at least 2 GB of memory.
 

✴️ The hosts of the Chef Infra Server and Supermarket have synchronized their system clocks.
 

✴️ Having enough disc space on the server to accommodate the project's cookbook storage needs or having the necessary login information for an Amazon Simple Storage Service (S3) bucket.

We can install the Chef Supermarket with and without a cookbook. 

To install the Supermarket with cookbook, we can use supermarket-omnibus-cookbook.

We can also install Supermarket without a cookbook. You can refer to the below-mentioned documentation to get more insights.

Install Supermarket With Cookbook

Install Supermarket without cookbook

After installing the Supermarket we can connect to it using the steps mentioned below.

Connect to Supermarket

Follow the instructions below to connect to the supermarket.

  1. Enter the hostname for Chef Supermarket in the browser. If a certificate is not provided as part of the installation process, a private Chef Supermarket will produce and utilize a self-signed certificate (via the wrapper cookbook).
     
  2. Accept the SSL certificate if it is displayed when connecting to Chef Supermarket via a web browser. For the private Chef Supermarket that is used in production, a reliable SSL certificate should be applied.
     
  3. Click the Create Account link after opening Chef Supermarket in a web browser. If the user is not already logged in, a prompt to log in to the Chef Infra Server is displayed. Give the Chef Supermarket permission to authenticate using the Chef Infra Server account.

Upgrade a Private Supermarket

You can upgrade a private supermarket using the steps mentioned below:

  1. Close the server that runs Private Supermarket.
     
  2. /var/opt/supermarket should be backed up.
     
  3. Get the Chef Supermarket package.
     
  4. Utilizing the proper package manager for your distribution, upgrade your system with the new package.
     
  5. Reconfigure the settings using the below command on the server where Chef Supermarket is installed.
     
sudo supermarket-ctl reconfigure

Configuration

All of the Chef Supermarket's non-default configuration parameters are stored in the supermarket.rb file. Only non-default values should be added to the supermarket.rb file because the default values are already included in the Chef Supermarket setup. The supermarket-ctl reconfigure command applies these configuration settings. Since the supermarket.rb file is a Ruby file, the configuration file can contain conditional statements.

Backup and Restore

Frequent Backup is required to ensure we don’t lose any important files or data. We can backup supermarket data frequently and then restore it later.

Let’s look at how we can backup the database and cookbook.

CookBook Backup

It is necessary to back up the local cookbook storage location on the Supermarket server if Supermarket is not set up to use AWS S3 storage for cookbooks.

/var/opt/supermarket/data/cookbook versions is the default location.

Use the below-mentioned commands to backup the cookbook.

cd /var/opt/supermarket/data/
tar cvzf ~/supermarket_cookbook_versions.tar.gz cookbook_versions

Database Backup

There are various formats available for database exports. For example, the following syntax can be used to create a database export in the .dump format:

/opt/supermarket/embedded/bin/pg_dump --host localhost --username supermarket --dbname supermarket --port 15432 --format c --blobs --verbose --file ~/supermarket_database_backup.dump

After backing up data, Now it’s time to restore the data.

Cookbook Restore

When restoring cookbooks, confirm that the Supermarket user has permission to write to the cookbook directory.
To restore your cookbook files, run the following command:

cd /var/opt/supermarket/data/
tar xvzf /supermarket_cookbook_versions.tar.gz

Database Restore

Backups cannot be transferred between Supermarket versions using the restore feature. Backups must be restored to the same Supermarket version that was in use when they were made.

Use the following command to restore the database:

/opt/supermarket/embedded/bin/pg_restore --username supermarket --host localhost --port 15432 --clean --no-acl --no-owner --dbname supermarket --verbose ~/supermarket_database_backup.dump

 

Other Things can also be done in the private supermarket, like monitoring supermarket, Supermarket logs, and lastly, we can always upgrade to the latest version of the supermarket.

Frequently Asked Questions

What is Chef infra server?

Cookbooks, node policies, and managed node metadata are all stored on the Chef Infra Server, a central location for configuration data.
 

What are LDAP and SAML?

SAML stands for Security Assertion Markup Language, and LDAP stands for Lightweight Directory Access Protocol. Both protocols are generally employed to securely authenticate users' identities and authorize their access to an organization's resources.
 

What is Chef automation?

Developers, operations, and security professionals may seamlessly collaborate to provide infrastructure and application upgrades at the speed of business with the aid of the enterprise platform Chef Automate.

Conclusion

In this blog, we briefly discussed chef's private supermarket. We talked about installation, configuration, and how we can backup and restore the data. 

If you think this blog has helped you enhance your knowledge about the above question, and if you want to learn more, check out our articles. 

🔥 Chef - Configuration Overview
 

🔥 Chef InSpec Profiles
 

🔥 Chef Manage
 

🔥 Chef Integration

And many more on our Coding Ninjas Studio.

Visit our website to read more such blogs. Make sure that you enroll in the courses we provide, take mock tests, solve problems available, and interview puzzles. Also, you can pay attention to interview stuff- interview experiences and an interview bundle for placement preparations. 

Please upvote our blog to help other ninjas grow.

Happy Learning!

Live masterclass