Although Puppet application orchestration can help you manage any distributed set of infrastructure, it’s primarily designed to configure an application stack. The simple application stack used in the following extended example comprises a database server on one machine and a web server that connects to the database on another machine.
With previous Puppet coding techniques, you’d write classes and defined types to define the configuration for these services, and you’d pass in class parameter data to tell the web server class how to connect to the database. With application orchestration, you can write Puppet code so this information can be exchanged automatically. And when you run Puppet, the services will be configured in the correct order, rather than repeatedly until convergence.
The following diagrams illustrate the major steps in the application orchestration workflow—from authoring your application to configuring it with the Puppet orchestrator.
In the applications you compose, application components share information with each other by exporting and consuming environment-wide service resources.
First, in this example, called
lamp, we create the
Sql service resource in
An application component is an independent bit of Puppet code that can be used alongside one or more other components to create an application. Components are often defined types that consist of traditional Puppet resources that describe the configuration of the component (file, package, and service, for example).
Next, the database component is defined in
The produces statement, contained in
lamp/manifests/db.pp expresses that the
Lamp::Db component produces the
Sql service resource. The produces statement is included outside of the defined type.
The application definition (or model) is where you connect all the pieces together. It describes the relationship between the application components and the exchanged service resources. As it shares the name of the module, it is in
The application instance is where you create a unique version of your application and specify which nodes to use for each component.
puppet app show shows the details of your application instances.
puppet job run runs Puppet across all the nodes in the order specified in your application instance.
puppet job list shows running and completed Orchestration jobs.
At the start of a job run, the orchestrator prints a Job Plan that shows what’s included in the run and the expected node run priority. The nodes are grouped by depth. Nodes in level 0 have no dependencies and will run first. Nodes in the levels below are dependent on nodes in higher levels.
As your job progresses, the orchestrator will print results of each node run after it completes. A “Success!” message prints when all jobs complete.