Home > developer > content development > Add a New Chef Cookbook and Pack to OneOps
Plan how you want your component to work. The following are some questions regarding design. Although there are others, hopefully these help. Always refer to existing examples like Tomcat.
stop
, start
, restart
, attach-debugger
, others?/etc/init.d
or an upstart alternative? This will be in the recipe.The existing Tomcat cookbook is used as an example here.
metadata.rb
.)These recipes are shown as action buttons on the OneOps GUI when you click that component in the “Operations” phase. When clicked, OneOps calls that recipe from that cookbook. For example, start/stop/restart of Tomcat.
The attribute metadata is OneOps specific here. Checkout the attributes in the Tomcat cookbook metadata.rb when the cookbook will be parsed later by the rake install command. This metadata is fed to the CMS DB as a model that tells the OneOps GUI how to render these attributes on the component (cookbook) configuration page.
Variables
These are variables that can be used while providing values for the cookbook attributes (next step). These variables are shown in the GUI and their values can be edited by the end userResource
Define resources. There should be one resource per cookbook. You can set values for the attributes here by substituting the variables. Another synonym for resource is “component”. These resources are shown as a list on the platform details page. Users can click them and edit attributes if needed.Dependency
Define the dependency among the resources you defined above. This is called “depends_on”. This enables OneOps to create the deployment sequence plan.ManagedVia
Define the manage-via relation. See the Tomcat pack for an example.Now you are ready to test your cookbook and pack. You need to push your model (cookbook and pack metadata) to the CMS DB. This is done by calling a knife plugin developed by OneOps. This plugin can parse the cookbook metadata and pack and push it to CMS. Follow these steps:
export CMSAPI=http://cms.<your-server>:8080/
. This pairs well with the shared UI on https://web.dev.<your-server>.com/
cd to the packer directory.$ circuit install
.BE CAREFUL when you use this because you load everything and that impacts others that use the same dev server. This takes some time and pushes all the metadata as CI (configuration item) objects to the CMS. In general, if you are only working on a single cookbook/pack, use the individual commands, not ALL. Remember that if you are using a shared dev-packer CMS backend, that modifying model/packs from one dev environment will affect anybody using that dev-packer environment as a backend.
$ bundle exec knife model sync <cookbook-name>
$ bundle exec knife pack sync platform/<platform-name> --reload
OR
BE CAREFUL when you use this because you impact others that use the same dev server!
$ circuit model
$ circuit packs
$ curl http://cms.<your-server>.com:8080/transistor/rest/cache/md/clear
Need a jump start on Ruby coding? Check out the Chef Ruby reference page.