compared with
Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (36)

View Page History
*Proposal*

We would like to extend the Zend\Cloud class to manage the deploy phase of a PHP application in a cloud environment. In particular we would like to insert some features to manage the computational resources (servers) (instances) in a cloud environment. The idea is to provide an abstract interface to manage the computational resources instances of different vendors.
There are other open source projects that provide these abstraction layer for cloud services for different computer languages. For instance:

* [Amazon Elastic Compute Cloud (EC2)|http://aws.amazon.com/ec2/]
* [GoGrid PHP API|http://wiki.gogrid.com/wiki/index.php/API:PHP_API_Developer_Home]
* [deltacloud|http://incubator.apache.org/deltacloud/]
{zone-data}

{zone-data:requirements}
* This component *will* include a factory method.
* This component *will* use the Zend\Service\* class to manage the Adapter of each cloud computing vendors (so far we have only available the class Zend_Service_Amazon_Ec2). Zend\Service\Amazon\Ec2).
* This component *will not* save any data using Zend_\Cache or the filesystem.
{zone-data}

{zone-data:milestones}

* Milestone 1: Proposal \[DONE\]
* Milestone 2: Working prototype supporting use cases #1, #2 .. #8 \[DONE\]
* Milestone 3: Working prototype supporting use cases #9 \[DONE\]
* Milestone 4: Working prototype supporting use cases #10 (we will need SSH support)
* Milestone 4: Working prototype supporting use cases #10 (you need the SSH extension enabled "ext/ssh2") \[DONE\]
* Milestone 5: Unit tests \[DONE\]
* Milestone 6: Initial documentation exists.

$nodeId= 'i-32242-sd';

$status= $infrastructure->statusNode($nodeId); $infrastructure->statusInstance($nodeId);

echo "The node $nodeId is in the $status status";
$nodeId= 'i-32242-sd';

if ($infrastructure->rebootNode($nodeId)) ($infrastructure->rebootInstance($nodeId)) {
echo "The node $nodeId has been rebooted successfully";
}
||UC-04||
{code:php}
$nodeId= 'i-11111-xx';

$options= array (
'type' => 'default',
'ami' => 'ami-1111',
'region' => 'eu-west'
);

$result= $infrastructure->createNode($nodeId,$options);

if ($result!==false) {
echo "The node $nodeId has been created successfully with the following data:\n";
print_r($result);
}
{code}

$nodeId= 'i-32242-sd';

if ($infrastructure->stopNode($nodeId)) ($infrastructure->stopInstance($nodeId)) {
echo "The node $nodeId has been stopped successfully.";
}
$nodeId= 'i-32242-sd';

if ($infrastructure->startNode($nodeId)) ($infrastructure->startInstance($nodeId)) {
echo "The node $nodeId has been started successfully.";
}
$nodeId= 'i-32242-sd';

if ($infrastructure->destroyNode($nodeId)) ($infrastructure->destroyInstance($nodeId)) {
echo "The node $nodeId has been destroyed successfully.";
}
$nodeId= 'i-32242-sd';

$images= $infrastructure->imagesNode(); $infrastructure->imagesInstance();

if ($images!==false) {
echo "The available images in the cloud are:\n";
print_r ($images);
print_r ($images);
}
{code}

{code:php}

use Zend\Cloud\Infrastructure\Instance;

$nodeId= 'i-32242-sd';

$monitor= $infrastructure->monitorNode();
$cpuUsage= $infrastructure->monitorInstance($nodeId,Instance::MONITOR_CPU);

if ($monitor!==false) {
echo "The system information of the node $nodeId are:\n";
print_r ($monitor);
echo "The CPU usage of the instance $nodeId is as follow:\n";
print_r ($cpuUsage);
}
{code}

$nodeId= 'i-32242-sd';

$param= array (
Instance::SSH_USERNAME => 'username',
Instance::SSH_PASSWORD => 'password'
);

$cmd= 'ls -la /var/www';

$output= $infrastructure->deployNode($nodeId,array($cmd)); $infrastructure->deployInstance($nodeId,$param,$cmd);

if ($output!==false) {
echo "The files in the DocumentRoot of the $nodeId node instance are:\n";
print_r ($output);
print_r ($output);
}
{code}