In the previous parts of this tutorial we have launched instances (servers) in the cloud, but those were created by Test Kitchen, running on our workstation. Those instances are as good as they can be, but the cookbook did not reside on the Chef server.
To launch pre-production and production instances in the cloud, first we need to upload the cookbook to the Chef server. In Beginner’s Guide to DevOps Engineering part 4. Connect to the Chef server we have already connected our workstation to the Chef server.
Upload the cookbook to the Chef server
To make your cookbook available for all the servers of the organization we will upload the cookbook to the Chef server.
- In the folder of the cookbook open a Bash window
- Execute the command to upload the cookbook to the Chef server
knife cookbook upload COOKBOOK_NAME --freeze
Don’t forget to add the –freeze option to the end to protect the version of the cookbook from accidental changes.
Launch the server in the Cloud
There are many ways to launch servers in a scripted way, we are going to review a few options. One is to use RightScale, a Cloud Management Platform, that can manage servers in multiple cloud environments.
Create a new Deployment
- Using your web browser log into the RightScale Cloud Management user interface,
- In the Manage menu select Deployment and click the New button,
- Enter the name of the new deployment,
- To add the new deployment to your bookmarks,
- On the left side in the Bookmarks section click the Add link,
- If necessary shorten the name of the bookmark and click OK,
- To reorder the bookmarks
- Click the Edit link and drag the bookmark to the desired position,
- Click the Done link to save your changes.
Create the CAT file
CAT files are Ruby like scripts that describe the configuration of the instance. It contain the name of the deployment the server should be placed it, the cloud attributes to assign security groups, regions, availability zones, set the drive size, specify security keys. The easiest way to configure a server is to copy an existing RightScale Self Service CAT file and update it with the new values.
If this is the first CAT file in your organization, get help from RightScale support and get a sample file from them.
If your organization already has a library of CAT files
- Make a copy of an existing CAT file
- Update the values to customize it for your server
- Application name
- Chef runlist
- Security group
- Deployment name
- Load balancer name
- Instance type
Upload the CAT file to RightScale
- Open the RightScale Self Service user interface,
- Select Designer on the left,
- Click the Upload CAT button and select the CAT file,
- Click the Upload button in the lower right corner,
- In the green popup in the upper right corner click the Publish to catalog link,
- In the lower right corner click the Yes, Publish button.
Launch the server in RightScale Self Service
- In the RightScale Self Service interface select Catalog on the left side,
- Select the catalog item you want to launch,
- Enter a name for the instance to be able to identify it later and select the instance in the dropdown list,
- Click the Launch CloudApp button.
To monitor the server launch
- In your web browser open the RightScale user interface,
- In the design menu select Deployments,
- Select the deployment of the instance,
- Click the instance to see in formation on it.
to the Tutorials page