From DreamFactory
Jump to: navigation, search


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.


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.

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.

//* The instance provisioners available from this console
use DreamFactory\Enterprise\Common\Enums\PortableTypes;

return [
    //  The default provisioner
    'default' => 'dreamfactory',
    //  The provisioners, or "hosts" of our instances, or "guests".
    'hosts'   => [
        /** DreamFactory v2.x */
        '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/',

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 `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.