|
| 1 | +# Orchestration |
| 2 | + |
| 3 | +**Orchestration** is a service that can be used to create and manage cloud |
| 4 | +resources. Examples of such resources are databases, load balancers, |
| 5 | +servers and software installed on them. |
| 6 | + |
| 7 | +## Concepts |
| 8 | + |
| 9 | +To use the Orchestration service effectively, you should understand several |
| 10 | +key concepts: |
| 11 | + |
| 12 | +* **Template**: An Orchestration template is a JSON or YAML document that |
| 13 | +describes how a set of resources should be assembled to produce a working |
| 14 | +deployment. The template specifies what resources should be used, what |
| 15 | +attributes of these resources are parameterized and what information is |
| 16 | +output to the user when a template is instantiated. |
| 17 | + |
| 18 | +* **Resource**: A resource is a template artifact that represents some component of your desired architecture (a Cloud Server, a group of scaled Cloud Servers, a load balancer, some configuration management system, and so forth). |
| 19 | + |
| 20 | +* **Stack**: A stack is a running instance of a template. When a stack is created, |
| 21 | +the resources specified in the template are created. |
| 22 | + |
| 23 | +## Getting started |
| 24 | + |
| 25 | +### 1. Instantiate an OpenStack or Rackspace client. |
| 26 | + |
| 27 | +To use the Orchestration service, you must first instantiate a `OpenStack` or `Rackspace` client object. |
| 28 | + |
| 29 | +* If you are working with an OpenStack cloud, instantiate an `OpenCloud\OpenStack` client as follows: |
| 30 | + |
| 31 | + ```php |
| 32 | + use OpenCloud\OpenStack; |
| 33 | + |
| 34 | + $client = new OpenStack('<OPENSTACK CLOUD IDENTITY ENDPOINT URL>', array( |
| 35 | + 'username' => '<YOUR OPENSTACK CLOUD ACCOUNT USERNAME>', |
| 36 | + 'password' => '<YOUR OPENSTACK CLOUD ACCOUNT PASSWORD>' |
| 37 | + )); |
| 38 | + ``` |
| 39 | + |
| 40 | +* If you are working with the Rackspace cloud, instantiate a `OpenCloud\Rackspace` client as follows: |
| 41 | + |
| 42 | + ```php |
| 43 | + use OpenCloud\Rackspace; |
| 44 | + |
| 45 | + $client = new Rackspace(Rackspace::US_IDENTITY_ENDPOINT, array( |
| 46 | + 'username' => '<YOUR RACKSPACE CLOUD ACCOUNT USERNAME>', |
| 47 | + 'apiKey' => '<YOUR RACKSPACE CLOUD ACCOUNT API KEY>' |
| 48 | + )); |
| 49 | + ``` |
| 50 | + |
| 51 | +### 2. Obtain an Orchestration service object from the client. |
| 52 | +All Orchestration operations are done via an _orchestration service object_. To |
| 53 | +instantiate this object, call the `orchestrationService` method on the `$client` |
| 54 | +object as shown in the following example: |
| 55 | + |
| 56 | +```php |
| 57 | +$region = '<CLOUD REGION NAME>'; |
| 58 | +$orchestrationService = $client->orchestrationService(null, $region); |
| 59 | +``` |
| 60 | + |
| 61 | +Any stacks and resources created with this `$orchestrationService` instance will |
| 62 | +be stored in the cloud region specified by `$region`. |
| 63 | + |
| 64 | +### 3. Create a stack from a template. |
| 65 | +```php |
| 66 | +$stack = $orchestrationService->createStack(array( |
| 67 | + 'name' => 'simple-lamp-setup', |
| 68 | + 'templateUrl' => 'https://raw.githubusercontent.com/rackspace-orchestration-templates/lamp/master/lamp.yaml', |
| 69 | + 'parameters' => array( |
| 70 | + 'server_hostname' => 'web01', |
| 71 | + 'image' => 'Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)' |
| 72 | + ), |
| 73 | + 'timeoutMins' => 5 |
| 74 | +)); |
| 75 | +``` |
| 76 | + |
| 77 | +[ [Get the executable PHP script for this example](/samples/Orchestration/quickstart.php) ] |
| 78 | + |
| 79 | +## Next steps |
| 80 | + |
| 81 | +Once you have created a stack, there is more you can do with it. See [complete user guide for orchestration](USERGUIDE.md). |
0 commit comments