Note: Please go to to access the current RightScale documentation set. Also, feel free to Chat with us!
Home > Guides > Chef Cookbooks Developer Guide > End User > RightScale Support of Chef > Breakdown of a Server launched with a Chef-based ServerTemplate

Breakdown of a Server launched with a Chef-based ServerTemplate


The following document will explain the technical details behind how Chef recipes are executed on a server in the RightScale platform.

Table of Contents


Create or Import a Chef-based ServerTemplate

When you import or create a ServerTemplate that uses Chef cookbooks and recipes, RightScale will fetch (retrieve) the referenced cookbooks from their source location, which is typically a source control management repository services like GitHub or SVN, and save a complete copy of a cookbook and all of its contents to RightScale's own repository service called Repose






Create a Server

The next step is to use the Chef-based ServerTemplate to create a server or server array. Remember, a server inherits its scripts from its ServerTemplate.

Launch a Server

Several actions take place when you launch a server.



  1. The first step is to use the ServerTemplate to create a server.
  2. When you launch a server from the RightScale dashboard/API, RightScale makes a request to the cloud provider (on your behalf) for the desired instance.
  3. Once the instance is provisioned by the cloud provider, the image is loaded onto the virtual machine, which installs the RightLink agent. Once the image is loaded onto the VM, the RightLink agent makes a request to the RightScale core system for all of the components that are needed to complete the boot process.
  4. RightLink retrieves the following items from RightScale so that it can properly execute the list of boot scripts. Only the cookbooks that are required to complete the current Chef run list are retrieved. Recipes and RightScripts that are listed as operational or decommission scripts are ignored.
    • Chef Run List - contains the list of Chef recipes and/or RightScripts that will be executed on the server. (i.e. ServerTemplate's boot scripts)  
    • Inputs (Chef Attributes) - the specified values that will be used for each referenced attribute in a Chef recipe. Input hierarchy rules apply. Inputs are stored in a persistent file: /etc/rightscale.d/chef.js
    • Cookbooks - RightLink retrieves the required cookbooks from Repose. Only the cookbooks that contain the recipes that are needed to complete the boot script process and any cookbook dependencies will be retrieved. The entire contents of a cookbook including all of its recipes, attributes, metadata files, etc. are copied.  Note: Recipes can reference other recipes and resources that are in different cookbooks. In such cases, any cookbook dependencies as described in the cookbook's metadata will also be retrieved. All cookbooks are saved to the instance's local disk in the following path: /var/cache/rightscale/cookbooks
      The cookbooks are stored in a format that maintains the repository hierarchy, which is used to determine which recipe should be executed if multiple cookbook repositories contain a cookbook and recipe with the same name. Notice that the cookbooks are not retrieved from the actual source control repositories themselves. Therefore, it's important to make sure that Repose is always in-sync with your repositories. RightScale regularly refreshes cookbook repositories, however if you recently modified your cookbooks, you can manually refresh the repositories so that Repose has a copy of your latest changes.
    • Attachments - (for RightScripts only) the file attachments to any RightScript.
    • RightScripts - (for RightScripts only) the code for any referenced RightScripts.
    • Packages - (for RightScripts only) 
  5. For each cookbook, RightLink then downloads the following Chef resources in sequential order (if available) onto the instance's ephemeral drive.
    1. Libraries - Located in the cookbook's directory. (/var/cache/rightscale/cookbooks/default/<Repository_SHA>/cookbook_name/libraries)
    2. Providers - Located in the cookbook's directory. (/var/cache/rightscale/cookbooks/default/<Repository_SHA>/cookbook_name/providers)
    3. Resources - Located in the cookbook's directory. (/var/cache/rightscale/cookbooks/default/<Repository_SHA>/cookbook_name/resources)
    4. Attributes - Located in the cookbook's directory. (/var/cache/rightscale/cookbooks/default/<Repository_SHA>/cookbook_name/attributes)
    5. Definitions - Located in the cookbook's directory. (/var/cache/rightscale/cookbooks/default/<Repository_SHA>/cookbook_name/definitions)
    6. Recipes - Located in the cookbook's directory. (/var/cache/rightscale/cookbooks/default/<Repository_SHA>/cookbook_name/recipes) If there are any Chef recipes that include Ruby Blocks ('ruby_block' resource) to pass in pure Ruby code, the code will be executed in sequential order. However, any raw Ruby code that is not placed in a Ruby Block will be executed first, before the Chef run list is executed. 
  6. RightLink runs the Chef converge on the run list. Meanwhile, the custom RightScale Logger sends audits to RightScale in real-time so that audit entries can be displayed in the dashboard.
  7. If the run list executes successfully, the node attributes are persisted to /etc/rightscale.d/chef.js so that it can be loaded before the next converge.


You must to post a comment.
Last modified
09:42, 7 Oct 2014



This page has no classifications.



© 2006-2014 RightScale, Inc. All rights reserved.
RightScale is a registered trademark of RightScale, Inc. All other products and services may be trademarks or servicemarks of their respective owners.