Provisioning

From DreamFactory
Jump to: navigation, search
m
m
Line 1: Line 1:
 
== Provisioners ==
 
== Provisioners ==
In the DFE world, a *provisioner* represents a contract to: manage instances, in a virtual environment, in a specific manner. This is physically represented in code by classes that adhere to one or more pre-defined interfaces. The diagram below shows the **DreamFactory** instance provisioner in code form.
+
In the DFE world, a *provisioner* represents a contract to manage virtual instances in a specific manner. This is physically represented in code by classes that adhere to one or more pre-defined *interfaces*. Below is the class/UML diagram of the **DreamFactory** provisioner.
  
 
[[file:Dfe-software-provisioning.png]]
 
[[file:Dfe-software-provisioning.png]]
  
Each provisioner is comprised of one or more *services* which provide portions of the provisioning process. This is not necessary. Provisioning may be completed by a single service. However, for flexibility and future expansion, the provisioning system is driven completely by configuration and discovery.
+
Each provisioner is comprised of one or more *sub-provisioners* which each provide a slice of the provisioning process. This is my no means necessary, and provisioning may be completed by a single service. For flexibility and future expansion, the provisioning system is driven completely by configuration and discovery.
  
 
The default **DreamFactory** provisioner is installed via composer using the `dreamfactory/dfe-dreamfactory-provisioner` package. This package consists of a service which adheres to the provisioning contracts stated above, and can be used to create and manage instances. It consists of three sub-provisioners. These are the *instance*, *storage*, and *database*.  
 
The default **DreamFactory** provisioner is installed via composer using the `dreamfactory/dfe-dreamfactory-provisioner` package. This package consists of a service which adheres to the provisioning contracts stated above, and can be used to create and manage instances. It consists of three sub-provisioners. These are the *instance*, *storage*, and *database*.  
  
In the DFE world, each **DreamFactory** instance requires provisioning management, storage facilities, and database access. These individual parts are managed by the three separate sub-provisioners defined in the library, and sub-sequential configuration. The default/shipping configuration is shown below.
+
To enable this provisioner, a section is added to the `config/provisioners.php` configuration file as shown below. This example stanza lives within the `provisioners.hosts` config array.
+
<pre>
+
<?php
+
//******************************************************************************
+
//* The instance provisioners available from this console
+
//******************************************************************************
+
use DreamFactory\Enterprise\Common\Enums\PortableTypes;
+
  
return [
+
<source lang="php">
    //  The default provisioner
+
     'dreamfactory' => [
    'default' => 'dreamfactory',
+
         'provides'    => [
    //  The provisioners, or "hosts" of our instances, or "guests".
+
            PortableTypes::INSTANCE => DreamFactory\Enterprise\Provisioners\DreamFactory\InstanceProvisioner::class,
     'hosts'   => [
+
            PortableTypes::STORAGE  => DreamFactory\Enterprise\Provisioners\DreamFactory\StorageProvisioner::class,
         /** DreamFactory v2.x */
+
            PortableTypes::DATABASE => DreamFactory\Enterprise\Provisioners\DreamFactory\DatabaseProvisioner::class,
        'dreamfactory' => [
+
            /********************************************************************************
+
            * The namespace for our provisioning classes. This is optional and you may specify
+
            * fully qualified class names in the "provides" section. You cannot mix and match
+
            * however. If an "namespace" key exists, it will be pre-pended to all provisioner
+
            * classes.
+
            ********************************************************************************/
+
            /** 'namespace'    => 'App\Provisioners\Acme, */
+
            /********************************************************************************
+
            * Each provisioner has a set of "sub-provisioners". The important one is the
+
            * "instance" provisioner. Also required are two standard sub-provisioners.
+
            *
+
            * The first is "storage" which is the class responsible for instance storage
+
            * provisioning. The second is "db", or the class/service responsible for instance
+
            * database provisioning. Currently, all three (instance,db,storage) are required.
+
            * However, even though the methods are required to exist by the contract, they
+
            * may have empty method bodies and do nothing.
+
            *
+
            * Any of these "resource" sub-provisioners may implement the "PortableData"
+
            * interface, making them available for import/export services from the console and
+
            * dashboard. The "dreamfactory" provisioner does this and offers import/export services
+
            * through the provisioning sub-system.
+
            *
+
            * Developers may add additional sub-provisioners to the list in their own
+
            * provisioner host class.
+
            ********************************************************************************/
+
            'provides'    => [
+
                PortableTypes::INSTANCE => DreamFactory\Enterprise\Provisioners\DreamFactory\InstanceProvisioner::class,
+
                PortableTypes::STORAGE  => DreamFactory\Enterprise\Provisioners\DreamFactory\StorageProvisioner::class,
+
                PortableTypes::DATABASE => DreamFactory\Enterprise\Provisioners\DreamFactory\DatabaseProvisioner::class,
+
            ],
+
            /********************************************************************************
+
            * Provisioners may provide "offerings" or options that dictate certain features of
+
            * the available guest(s). Selecting a version for instance (as below). It can be
+
            * used for anything and provides an automatic UI in the Dashboard for user selection.
+
            ********************************************************************************/
+
            'offerings'    => [],
+
            /** The instance-provided resource discovery uri */
+
            'resource-uri' => '/api/v2/system/',
+
 
         ],
 
         ],
 +
        'offerings'    => [],
 +
        'resource-uri' => '/api/v2/system/',
 
     ],
 
     ],
];
+
</source>
</pre>
+
  
The `provides` section details the sub-provisioners available with this provisioner configuration. As you see, there are the three discussed: instance, storage, and database. The order is not important because, in this case, the InstanceProvisioner class makes the sub-provisioning requests.  
+
The top level is the mnemonic name of the provisioner, **dreamfactory** in this case. This may contain the following elements:
 +
 
 +
* `provides`: an array of sub-provisioners that make up the entire provisioner. The **dreamfactory** provisioner consists of three sub-provisioners: instance, storage, and database.  
 +
* `offerings`: an array of options that are provided to the end-user during provisioning. These can be versions or other feature selections offered by the guest location and/or instance.
 +
* `resource-uri`: an endpoint at the provisioned instance where the console can communicate with it.
 +
 +
== ProvisionManager ==
 +
The **ProvisionManager**, and its **Provision** *facade*, resolve and oversee all provisioning requests.
  
The `offerings` section allows a provisioner to provide options, or *offerings*, to the requestor regarding the provisioning of instances. A different version number perhaps, or data "tags" and/or text.
+
[[file:provisioning-manager.png]]

Revision as of 15:37, 15 September 2015

Provisioners

In the DFE world, a *provisioner* represents a contract to manage virtual instances in a specific manner. This is physically represented in code by classes that adhere to one or more pre-defined *interfaces*. Below is the class/UML diagram of the **DreamFactory** provisioner.

Dfe-software-provisioning.png

Each provisioner is comprised of one or more *sub-provisioners* which each provide a slice of the provisioning process. This is my no means necessary, and provisioning may be completed by a single service. For flexibility and future expansion, the provisioning system is driven completely by configuration and discovery.

The default **DreamFactory** provisioner is installed via composer using the `dreamfactory/dfe-dreamfactory-provisioner` package. This package consists of a service which adheres to the provisioning contracts stated above, and can be used to create and manage instances. It consists of three sub-provisioners. These are the *instance*, *storage*, and *database*.

To enable this provisioner, a section is added to the `config/provisioners.php` configuration file as shown below. This example stanza lives within the `provisioners.hosts` config array.

    'dreamfactory' =&gt; [
        'provides'     =&gt; [
            PortableTypes::INSTANCE =&gt; DreamFactory\Enterprise\Provisioners\DreamFactory\InstanceProvisioner::class,
            PortableTypes::STORAGE  =&gt; DreamFactory\Enterprise\Provisioners\DreamFactory\StorageProvisioner::class,
            PortableTypes::DATABASE =&gt; DreamFactory\Enterprise\Provisioners\DreamFactory\DatabaseProvisioner::class,
        ],
        'offerings'    =&gt; [],
        'resource-uri' =&gt; '/api/v2/system/',
    ],

The top level is the mnemonic name of the provisioner, **dreamfactory** in this case. This may contain the following elements:

* `provides`: an array of sub-provisioners that make up the entire provisioner. The **dreamfactory** provisioner consists of three sub-provisioners: instance, storage, and database. 
* `offerings`: an array of options that are provided to the end-user during provisioning. These can be versions or other feature selections offered by the guest location and/or instance.
* `resource-uri`: an endpoint at the provisioned instance where the console can communicate with it.

ProvisionManager

The **ProvisionManager**, and its **Provision** *facade*, resolve and oversee all provisioning requests.

Provisioning-manager.png