SlideShare a Scribd company logo
1 of 34
Download to read offline
October 2011




Manage cloud infrastructures
in PHP using ZF2 (and ZF1)
Enrico Zimuel
Zend Technologies
About me
                                                        October 2011




                           • Software Engineer since 1996
                               – Assembly x86, C/C++, Java, Perl, PHP
                           •   Enjoying PHP since 1999
                           •   PHP Engineer at Zend since 2008
                           •   ZF Core Team from April 2011
Email: enrico@zend.com     •   B.Sc. Computer Science and
                                 Economics from University of
                                 Pescara (Italy)
Summary
                                       October 2011




●   Cloud computing in PHP
●   ZendServiceRackspace
●   Simple Cloud API
●   ZendCloudInfrastructure for ZF2 and ZF1
●   Adapters: Amazon Ec2, Rackspace
●   Examples
Cloud computing

              October 2011
Cloud for developers
                                             October 2011




●   Needs for developers:
    ●   Standard API (Open Stack, Open Cloud
        Computing Interface, ?)
    ●   Development infrastructures
    ●   Libraries/Frameworks “cloud ready”
API for the cloud
                                           October 2011




●   API (Application Programming Interface), to
    interact with cloud services
●   Typically use REST-based APIs
●   Each vendor exposes a property API
●   Learning curve for each cloud vendor
PHP libraries for cloud
                                                  October 2011




●   Amazon Web Services
    ●   AWS SDK for PHP, http://aws.amazon.com/sdkforphp/
●   Windows Azure
    ●   PHPAzure, http://phpazure.codeplex.com/
●   Rackspace
    ●   php-cloudfiles, http://bit.ly/ptJa1Y
●   GoGrid
    ●   GoGridClient, http://bit.ly/o7MeLA
ZF services for cloud
                                      October 2011




●   ZendServiceAmazon
●   ZendServiceGoGrid (under dev)
●   ZendServiceNirvanix
●   ZendServiceRackspace
●   ZendServiceWindowsAzure
October 2011




ZendServiceRackspace
ZendServiceRackspace
                                        October 2011




●   Manage the following cloud services of
    Rackspace:
    ● Servers
    ● Files


●   Provide a full OO interface for the API of
    Rackspace (ver 1.0)
●   Release: ZF1 1.11.12+, ZF2 dev3+
Example: authentication
                                                October 2011




$user = 'username';
$key = 'secret key';

$rackspace = new ZendServiceRackspaceFiles($user,$key);

if ($rackspace->authenticate()) {
   echo "Authentication successfully";
} else {
   printf("ERROR: %s",$rackspace->getErrorMsg());
}
Example: store object
                                               October 2011


…
$container = $rackspace->createContainer('test');
if (!$rackspace->isSuccessful()) {
    die('ERROR: '.$rackspace->getErrorMsg());
}
$name = 'example.jpg';
$file = file_get_contents($name);
$metadata = array (
    'foo' => 'bar'
);
$rackspace->storeObject('test',$name,$file,$metadata);
if ($rackspace->isSuccessful()) {
    echo 'Object stored successfully';
} else {
    printf("ERROR: %s",$rackspace->getErrorMsg());
}
Example: create a server
                                                     October 2011

$user = 'username';
$key = 'secret key';

$rackspace = new ZendServiceRackspaceServers($user,$key);

$data = array (
    'name'     => 'test',
    'imageId' => '49',
    'flavorId' => '1',
);
$server = $rackspace->createServer($data);

if (!$rackspace->isSuccessful()) {
    die('ERROR: '.$rackspace->getErrorMsg());
}

printf("Server name    : %sn",$server->getName());
printf("Server Id      : %sn",$server->getId());
printf("Admin password : %sn",$server->getAdminPass());
October 2011




Simple Cloud API
Simple Cloud API
                                           October 2011




●   The Simple Cloud API is a common API for
    accessing cloud application services offered by
    multiple vendors
●   Starting from November 2010 the Simple Cloud
    API is part of Zend Framework under the
    classname:
    ●   Zend_Cloud (ZF1)
    ●   ZendCloud (ZF2)
simplecloud.org
                  October 2011
Why we need it?
                                              October 2011




●   Vendor lock-in
    ●   In economics, vendor lock-in makes a customer
        dependent on a vendor for products and
        services, unable to use another vendor without
        substantial switching costs
●   Portability
    ●   reuse the existing code instead of creating new
        code when moving software from an environment
        to another
The architecture
                    October 2011




      ZendCloud




     ZendService
The architecture (2)
                                              October 2011




                      ZendCloud

Document      Queue                Storage   Infrastructure



                      ZendService
ZendCloud as abstraction
                                               October 2011




●   ZendCloud is an abstraction of the main features
    of some cloud vendors
●   Vendor specific functions may not be included in
    ZendCloud (for portability reason)
    ●   For instance, Amazon S3 has a cleanBucket
        operation that is not implemented in ZendCloud
●   You can access the concrete adapters to use
    specific functions (getAdapter)
ZendCloudDocumentService

                                            October 2011




●   Abstracts the interfaces to all major document
    databases - both in the cloud and locally
    deployed
●   Adapters:
    ●   Amazon SimpleDB
    ●   Windows Azure
ZendCloudQueueService

                                         October 2011




●   The QueueService implements access to
    message queues available as local or remote
    services.
●   Adapters:
    ●   Amazon Sqs
    ●   Windows Azure
    ●   ZendQueue
ZendCloudStorageService

                                                October 2011




●   The storage service in the Simple Cloud API implements
    a basic interface for file storage on the cloud
●   Adapters:
    ●   Amazon S3
    ●   Windows Azure
    ●   Nirvanix
    ●   Filesystem
    ●   Rackspace (under dev)
October 2011




ZendCloudInfrastructure
ZendCloudInfrastructure

                                             October 2011




●   Manage instances (servers) of a cloud computing
    infrastructure
●   Release ZF1: 1.11.12+, ZF2: dev3+
●   Adapters:
    ●   Amazon Ec2
    ●   Rackspace Cloud Servers
    ●   GoGrid (under dev)
    ●   Windows Azure (under dev)
Basic operations

                                                         October 2011




●   Create a new instance
●   Delete an instance
●   Start/stop/reboot an instance
●   List available instances
●   Get the status of an instance (running, stop, etc)
●   Monitor an instance (CPU, RAM, Network, etc)
●   Deploy an instance
●   Execute remote shell command (using SSH2)
Image of an instance

                                             October 2011




●   An image of an instance is the collection of the
    following information:
    ●   Operating system (OS)
    ●   Memory available (RAM)
    ●   CPU type
Example: Amazon Ec2 adapter

                                                   October 2011




use ZendCloudInfrastructureAdapterEc2 as Ec2Adapter,
    ZendCloudInfrastructureFactory;

$key    = 'key';
$secret = 'secret';
$region = 'region';

$infrastructure = Factory::getAdapter(array(
    Factory::INFRASTRUCTURE_ADAPTER_KEY =>
'ZendCloudInfrastructureAdapterEc2',
    Ec2Adapter::AWS_ACCESS_KEY => $key,
    Ec2Adapter::AWS_SECRET_KEY => $secret,
    Ec2Adapter::AWS_REGION     => $region,
));
Example: create instance

                                                    October 2011




$param= array (
    'imageId'      => 'your-image-id',
    'instanceType' => 'your-instance-type',
);

$instance= $infrastructure->createInstance('name', $param);

if ($instance===false) {
   die ('Error');
}

printf ("Name of the instance: %sn", $instance->getName());
printf ("ID of the instance : %sn", $instance->getId());
Example: reboot and wait for
                status change
                                                         October 2011




if (!$infrastructure->rebootInstance('instance-id')) {
    die ('Error in the execution of the reboot command');
}
echo 'Reboot command executed successfully';

if ($infrastructure->waitStatusInstance('instance-id',
Instance::STATUS_RUNNING)) {
    echo 'The instance is ready';
} else {
    echo 'The instance is not ready yet';
}
Wait for status change

                                           October 2011




waitStatusInstance (string $id, string
$status,integer $timeout=30)
●   Wait the status change of an instance for a
    maximum time of n seconds (30 by default).
●   Return true if the status changes as expected,
    false otherwise.
Example: monitor an instance

                                                                  October 2011


use ZendCloudInfrastructureInstance;

$cpuUsage= $infrastructure->monitorInstance(
            'instance-id',Instance::MONITOR_CPU);

var_dump($cpuUsage);

array(2) {                                   [2] => array(2) {
 ["series"] => array(3) {                      ["timestamp"] => int(1318348920)
   [0]=> array(2) {                            ["value"] => int(60)
     ["timestamp"] => int(1318348800)        }
     ["value"]=> int(80)                    }
   }                                        ["average"] => string(3) "70"
   [1]=> array(2) {                     }
     ["timestamp"] => int(1318348860)
     ["value"] => int(70)
   }
Example: deploy an instance

                                                     October 2011




$nodeId= 'id-instance';

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

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

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

echo "The files in the DocumentRoot of the $nodeId instance
are:n";
print_r ($output);


Note: require the SSH2 extension
Thank you!
                                       October 2011




●   Vote this talk:
    ●   http://joind.in/3764
●   Comments and feedbacks:
    ●   enrico@zend.com




                               simplecloud.org

More Related Content

What's hot

How to build customizable multitenant web applications - PHPBNL11
How to build customizable multitenant web applications - PHPBNL11How to build customizable multitenant web applications - PHPBNL11
How to build customizable multitenant web applications - PHPBNL11Stephan Hochdörfer
 
Zend Framework Introduction
Zend Framework IntroductionZend Framework Introduction
Zend Framework IntroductionRafael Monteiro
 
03 - Qt UI Development
03 - Qt UI Development03 - Qt UI Development
03 - Qt UI DevelopmentAndreas Jakl
 
Java Symmetric
Java SymmetricJava Symmetric
Java Symmetricphanleson
 
Deprecated: Foundations of Zend Framework 2
Deprecated: Foundations of Zend Framework 2Deprecated: Foundations of Zend Framework 2
Deprecated: Foundations of Zend Framework 2Adam Culp
 
JavaOne TS-5098 Groovy SwingBuilder
JavaOne TS-5098 Groovy SwingBuilderJavaOne TS-5098 Groovy SwingBuilder
JavaOne TS-5098 Groovy SwingBuilderAndres Almiray
 
Php on the Web and Desktop
Php on the Web and DesktopPhp on the Web and Desktop
Php on the Web and DesktopElizabeth Smith
 
Symfony2 Service Container: Inject me, my friend
Symfony2 Service Container: Inject me, my friendSymfony2 Service Container: Inject me, my friend
Symfony2 Service Container: Inject me, my friendKirill Chebunin
 
Arduino、Web 到 IoT
Arduino、Web 到 IoTArduino、Web 到 IoT
Arduino、Web 到 IoTJustin Lin
 
Understanding PHP objects
Understanding PHP objectsUnderstanding PHP objects
Understanding PHP objectsjulien pauli
 
Get Started with Zend Framework 2
Get Started with Zend Framework 2Get Started with Zend Framework 2
Get Started with Zend Framework 2Mindfire Solutions
 
Into the ZF2 Service Manager
Into the ZF2 Service ManagerInto the ZF2 Service Manager
Into the ZF2 Service ManagerChris Tankersley
 
Building your first Node app with Connect & Express
Building your first Node app with Connect & ExpressBuilding your first Node app with Connect & Express
Building your first Node app with Connect & ExpressChristian Joudrey
 

What's hot (20)

Zend Framework 2
Zend Framework 2Zend Framework 2
Zend Framework 2
 
How to build customizable multitenant web applications - PHPBNL11
How to build customizable multitenant web applications - PHPBNL11How to build customizable multitenant web applications - PHPBNL11
How to build customizable multitenant web applications - PHPBNL11
 
Zend Framework Introduction
Zend Framework IntroductionZend Framework Introduction
Zend Framework Introduction
 
Zend Framework 2 Patterns
Zend Framework 2 PatternsZend Framework 2 Patterns
Zend Framework 2 Patterns
 
03 - Qt UI Development
03 - Qt UI Development03 - Qt UI Development
03 - Qt UI Development
 
ZF2 Presentation @PHP Tour 2011 in Lille
ZF2 Presentation @PHP Tour 2011 in LilleZF2 Presentation @PHP Tour 2011 in Lille
ZF2 Presentation @PHP Tour 2011 in Lille
 
Java Symmetric
Java SymmetricJava Symmetric
Java Symmetric
 
Deprecated: Foundations of Zend Framework 2
Deprecated: Foundations of Zend Framework 2Deprecated: Foundations of Zend Framework 2
Deprecated: Foundations of Zend Framework 2
 
JavaOne TS-5098 Groovy SwingBuilder
JavaOne TS-5098 Groovy SwingBuilderJavaOne TS-5098 Groovy SwingBuilder
JavaOne TS-5098 Groovy SwingBuilder
 
Php on the Web and Desktop
Php on the Web and DesktopPhp on the Web and Desktop
Php on the Web and Desktop
 
Symfony2 Service Container: Inject me, my friend
Symfony2 Service Container: Inject me, my friendSymfony2 Service Container: Inject me, my friend
Symfony2 Service Container: Inject me, my friend
 
Arduino、Web 到 IoT
Arduino、Web 到 IoTArduino、Web 到 IoT
Arduino、Web 到 IoT
 
Understanding PHP objects
Understanding PHP objectsUnderstanding PHP objects
Understanding PHP objects
 
Get Started with Zend Framework 2
Get Started with Zend Framework 2Get Started with Zend Framework 2
Get Started with Zend Framework 2
 
Into the ZF2 Service Manager
Into the ZF2 Service ManagerInto the ZF2 Service Manager
Into the ZF2 Service Manager
 
About Data::ObjectDriver
About Data::ObjectDriverAbout Data::ObjectDriver
About Data::ObjectDriver
 
Php on Windows
Php on WindowsPhp on Windows
Php on Windows
 
Apache ZooKeeper
Apache ZooKeeperApache ZooKeeper
Apache ZooKeeper
 
Building your first Node app with Connect & Express
Building your first Node app with Connect & ExpressBuilding your first Node app with Connect & Express
Building your first Node app with Connect & Express
 
Beyond Phoenix
Beyond PhoenixBeyond Phoenix
Beyond Phoenix
 

Similar to Manage cloud infrastructures in PHP using Zend Framework 2 (and 1)

How to Manage Cloud Infrastructures using Zend Framework
How to Manage Cloud Infrastructures using Zend FrameworkHow to Manage Cloud Infrastructures using Zend Framework
How to Manage Cloud Infrastructures using Zend FrameworkZend by Rogue Wave Software
 
DCEU 18: Docker Containers in a Serverless World
DCEU 18: Docker Containers in a Serverless WorldDCEU 18: Docker Containers in a Serverless World
DCEU 18: Docker Containers in a Serverless WorldDocker, Inc.
 
ILM - Pipeline in the cloud
ILM - Pipeline in the cloudILM - Pipeline in the cloud
ILM - Pipeline in the cloudAaron Carey
 
Amazon Cloud Services and Zend Framework
Amazon Cloud Services and Zend FrameworkAmazon Cloud Services and Zend Framework
Amazon Cloud Services and Zend FrameworkShahar Evron
 
Building a serverless company on AWS lambda and Serverless framework
Building a serverless company on AWS lambda and Serverless frameworkBuilding a serverless company on AWS lambda and Serverless framework
Building a serverless company on AWS lambda and Serverless frameworkLuciano Mammino
 
Ansible Tutorial.pdf
Ansible Tutorial.pdfAnsible Tutorial.pdf
Ansible Tutorial.pdfNigussMehari4
 
Building Scalable Applications with Laravel
Building Scalable Applications with LaravelBuilding Scalable Applications with Laravel
Building Scalable Applications with LaravelMuhammad Shakeel
 
Mythical Mysfits: Monolith to Microservice with Docker and AWS Fargate (CON21...
Mythical Mysfits: Monolith to Microservice with Docker and AWS Fargate (CON21...Mythical Mysfits: Monolith to Microservice with Docker and AWS Fargate (CON21...
Mythical Mysfits: Monolith to Microservice with Docker and AWS Fargate (CON21...Amazon Web Services
 
Kubernetes: training micro-dragons for a serious battle
Kubernetes: training micro-dragons for a serious battleKubernetes: training micro-dragons for a serious battle
Kubernetes: training micro-dragons for a serious battleAmir Moghimi
 
Making cloud native platform by kubernetes
Making cloud native platform by kubernetesMaking cloud native platform by kubernetes
Making cloud native platform by kubernetes어형 이
 
Build Your Kubernetes Operator with the Right Tool!
Build Your Kubernetes Operator with the Right Tool!Build Your Kubernetes Operator with the Right Tool!
Build Your Kubernetes Operator with the Right Tool!Rafał Leszko
 
Build your operator with the right tool
Build your operator with the right toolBuild your operator with the right tool
Build your operator with the right toolRafał Leszko
 
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on Kubernetes
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on KubernetesApache Druid Auto Scale-out/in for Streaming Data Ingestion on Kubernetes
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on KubernetesDataWorks Summit
 
Cloud State of the Union for Java Developers
Cloud State of the Union for Java DevelopersCloud State of the Union for Java Developers
Cloud State of the Union for Java DevelopersBurr Sutter
 
Kubernetes - training micro-dragons without getting burnt
Kubernetes -  training micro-dragons without getting burntKubernetes -  training micro-dragons without getting burnt
Kubernetes - training micro-dragons without getting burntAmir Moghimi
 
Ростислав Михайлив "Zend Framework 3 - evolution or revolution"
Ростислав Михайлив "Zend Framework 3 - evolution or revolution"Ростислав Михайлив "Zend Framework 3 - evolution or revolution"
Ростислав Михайлив "Zend Framework 3 - evolution or revolution"Fwdays
 
Automating Software Development Life Cycle - A DevOps Approach
Automating Software Development Life Cycle - A DevOps ApproachAutomating Software Development Life Cycle - A DevOps Approach
Automating Software Development Life Cycle - A DevOps ApproachAkshaya Mahapatra
 
node.js: Javascript's in your backend
node.js: Javascript's in your backendnode.js: Javascript's in your backend
node.js: Javascript's in your backendDavid Padbury
 

Similar to Manage cloud infrastructures in PHP using Zend Framework 2 (and 1) (20)

How to Manage Cloud Infrastructures using Zend Framework
How to Manage Cloud Infrastructures using Zend FrameworkHow to Manage Cloud Infrastructures using Zend Framework
How to Manage Cloud Infrastructures using Zend Framework
 
DCEU 18: Docker Containers in a Serverless World
DCEU 18: Docker Containers in a Serverless WorldDCEU 18: Docker Containers in a Serverless World
DCEU 18: Docker Containers in a Serverless World
 
ILM - Pipeline in the cloud
ILM - Pipeline in the cloudILM - Pipeline in the cloud
ILM - Pipeline in the cloud
 
Amazon Cloud Services and Zend Framework
Amazon Cloud Services and Zend FrameworkAmazon Cloud Services and Zend Framework
Amazon Cloud Services and Zend Framework
 
Building a serverless company on AWS lambda and Serverless framework
Building a serverless company on AWS lambda and Serverless frameworkBuilding a serverless company on AWS lambda and Serverless framework
Building a serverless company on AWS lambda and Serverless framework
 
Ansible Tutorial.pdf
Ansible Tutorial.pdfAnsible Tutorial.pdf
Ansible Tutorial.pdf
 
Building Scalable Applications with Laravel
Building Scalable Applications with LaravelBuilding Scalable Applications with Laravel
Building Scalable Applications with Laravel
 
Ansible - Hands on Training
Ansible - Hands on TrainingAnsible - Hands on Training
Ansible - Hands on Training
 
Mythical Mysfits: Monolith to Microservice with Docker and AWS Fargate (CON21...
Mythical Mysfits: Monolith to Microservice with Docker and AWS Fargate (CON21...Mythical Mysfits: Monolith to Microservice with Docker and AWS Fargate (CON21...
Mythical Mysfits: Monolith to Microservice with Docker and AWS Fargate (CON21...
 
Kubernetes: training micro-dragons for a serious battle
Kubernetes: training micro-dragons for a serious battleKubernetes: training micro-dragons for a serious battle
Kubernetes: training micro-dragons for a serious battle
 
Making cloud native platform by kubernetes
Making cloud native platform by kubernetesMaking cloud native platform by kubernetes
Making cloud native platform by kubernetes
 
Build Your Kubernetes Operator with the Right Tool!
Build Your Kubernetes Operator with the Right Tool!Build Your Kubernetes Operator with the Right Tool!
Build Your Kubernetes Operator with the Right Tool!
 
Build your operator with the right tool
Build your operator with the right toolBuild your operator with the right tool
Build your operator with the right tool
 
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on Kubernetes
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on KubernetesApache Druid Auto Scale-out/in for Streaming Data Ingestion on Kubernetes
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on Kubernetes
 
Cloud State of the Union for Java Developers
Cloud State of the Union for Java DevelopersCloud State of the Union for Java Developers
Cloud State of the Union for Java Developers
 
Ferrara Linux Day 2011
Ferrara Linux Day 2011Ferrara Linux Day 2011
Ferrara Linux Day 2011
 
Kubernetes - training micro-dragons without getting burnt
Kubernetes -  training micro-dragons without getting burntKubernetes -  training micro-dragons without getting burnt
Kubernetes - training micro-dragons without getting burnt
 
Ростислав Михайлив "Zend Framework 3 - evolution or revolution"
Ростислав Михайлив "Zend Framework 3 - evolution or revolution"Ростислав Михайлив "Zend Framework 3 - evolution or revolution"
Ростислав Михайлив "Zend Framework 3 - evolution or revolution"
 
Automating Software Development Life Cycle - A DevOps Approach
Automating Software Development Life Cycle - A DevOps ApproachAutomating Software Development Life Cycle - A DevOps Approach
Automating Software Development Life Cycle - A DevOps Approach
 
node.js: Javascript's in your backend
node.js: Javascript's in your backendnode.js: Javascript's in your backend
node.js: Javascript's in your backend
 

More from Enrico Zimuel

Password (in)security
Password (in)securityPassword (in)security
Password (in)securityEnrico Zimuel
 
Integrare Zend Framework in Wordpress
Integrare Zend Framework in WordpressIntegrare Zend Framework in Wordpress
Integrare Zend Framework in WordpressEnrico Zimuel
 
Introduzione alla Posta Elettronica Certificata (PEC): le regole tecniche
Introduzione alla Posta Elettronica Certificata (PEC): le regole tecnicheIntroduzione alla Posta Elettronica Certificata (PEC): le regole tecniche
Introduzione alla Posta Elettronica Certificata (PEC): le regole tecnicheEnrico Zimuel
 
Cryptography in PHP: use cases
Cryptography in PHP: use casesCryptography in PHP: use cases
Cryptography in PHP: use casesEnrico Zimuel
 
Framework software e Zend Framework
Framework software e Zend FrameworkFramework software e Zend Framework
Framework software e Zend FrameworkEnrico Zimuel
 
Strong cryptography in PHP
Strong cryptography in PHPStrong cryptography in PHP
Strong cryptography in PHPEnrico Zimuel
 
How to scale PHP applications
How to scale PHP applicationsHow to scale PHP applications
How to scale PHP applicationsEnrico Zimuel
 
Velocizzare Joomla! con Zend Server Community Edition
Velocizzare Joomla! con Zend Server Community EditionVelocizzare Joomla! con Zend Server Community Edition
Velocizzare Joomla! con Zend Server Community EditionEnrico Zimuel
 
Zend_Cache: how to improve the performance of PHP applications
Zend_Cache: how to improve the performance of PHP applicationsZend_Cache: how to improve the performance of PHP applications
Zend_Cache: how to improve the performance of PHP applicationsEnrico Zimuel
 
XCheck a benchmark checker for XML query processors
XCheck a benchmark checker for XML query processorsXCheck a benchmark checker for XML query processors
XCheck a benchmark checker for XML query processorsEnrico Zimuel
 
Introduzione alle tabelle hash
Introduzione alle tabelle hashIntroduzione alle tabelle hash
Introduzione alle tabelle hashEnrico Zimuel
 
Crittografia quantistica: fantascienza o realtà?
Crittografia quantistica: fantascienza o realtà?Crittografia quantistica: fantascienza o realtà?
Crittografia quantistica: fantascienza o realtà?Enrico Zimuel
 
Introduzione alla crittografia
Introduzione alla crittografiaIntroduzione alla crittografia
Introduzione alla crittografiaEnrico Zimuel
 
Crittografia è sinonimo di sicurezza?
Crittografia è sinonimo di sicurezza?Crittografia è sinonimo di sicurezza?
Crittografia è sinonimo di sicurezza?Enrico Zimuel
 
Sviluppo di applicazioni sicure
Sviluppo di applicazioni sicureSviluppo di applicazioni sicure
Sviluppo di applicazioni sicureEnrico Zimuel
 
Misure minime di sicurezza informatica
Misure minime di sicurezza informaticaMisure minime di sicurezza informatica
Misure minime di sicurezza informaticaEnrico Zimuel
 
La sicurezza delle applicazioni in PHP
La sicurezza delle applicazioni in PHPLa sicurezza delle applicazioni in PHP
La sicurezza delle applicazioni in PHPEnrico Zimuel
 

More from Enrico Zimuel (20)

Password (in)security
Password (in)securityPassword (in)security
Password (in)security
 
Integrare Zend Framework in Wordpress
Integrare Zend Framework in WordpressIntegrare Zend Framework in Wordpress
Integrare Zend Framework in Wordpress
 
Introduzione alla Posta Elettronica Certificata (PEC): le regole tecniche
Introduzione alla Posta Elettronica Certificata (PEC): le regole tecnicheIntroduzione alla Posta Elettronica Certificata (PEC): le regole tecniche
Introduzione alla Posta Elettronica Certificata (PEC): le regole tecniche
 
PHP goes mobile
PHP goes mobilePHP goes mobile
PHP goes mobile
 
Zend Framework 2
Zend Framework 2Zend Framework 2
Zend Framework 2
 
Cryptography in PHP: use cases
Cryptography in PHP: use casesCryptography in PHP: use cases
Cryptography in PHP: use cases
 
Framework software e Zend Framework
Framework software e Zend FrameworkFramework software e Zend Framework
Framework software e Zend Framework
 
Strong cryptography in PHP
Strong cryptography in PHPStrong cryptography in PHP
Strong cryptography in PHP
 
How to scale PHP applications
How to scale PHP applicationsHow to scale PHP applications
How to scale PHP applications
 
Velocizzare Joomla! con Zend Server Community Edition
Velocizzare Joomla! con Zend Server Community EditionVelocizzare Joomla! con Zend Server Community Edition
Velocizzare Joomla! con Zend Server Community Edition
 
Zend_Cache: how to improve the performance of PHP applications
Zend_Cache: how to improve the performance of PHP applicationsZend_Cache: how to improve the performance of PHP applications
Zend_Cache: how to improve the performance of PHP applications
 
XCheck a benchmark checker for XML query processors
XCheck a benchmark checker for XML query processorsXCheck a benchmark checker for XML query processors
XCheck a benchmark checker for XML query processors
 
Introduzione alle tabelle hash
Introduzione alle tabelle hashIntroduzione alle tabelle hash
Introduzione alle tabelle hash
 
Crittografia quantistica: fantascienza o realtà?
Crittografia quantistica: fantascienza o realtà?Crittografia quantistica: fantascienza o realtà?
Crittografia quantistica: fantascienza o realtà?
 
Introduzione alla crittografia
Introduzione alla crittografiaIntroduzione alla crittografia
Introduzione alla crittografia
 
Crittografia è sinonimo di sicurezza?
Crittografia è sinonimo di sicurezza?Crittografia è sinonimo di sicurezza?
Crittografia è sinonimo di sicurezza?
 
Sviluppo di applicazioni sicure
Sviluppo di applicazioni sicureSviluppo di applicazioni sicure
Sviluppo di applicazioni sicure
 
Misure minime di sicurezza informatica
Misure minime di sicurezza informaticaMisure minime di sicurezza informatica
Misure minime di sicurezza informatica
 
PHP e crittografia
PHP e crittografiaPHP e crittografia
PHP e crittografia
 
La sicurezza delle applicazioni in PHP
La sicurezza delle applicazioni in PHPLa sicurezza delle applicazioni in PHP
La sicurezza delle applicazioni in PHP
 

Recently uploaded

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 

Recently uploaded (20)

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 

Manage cloud infrastructures in PHP using Zend Framework 2 (and 1)

  • 1. October 2011 Manage cloud infrastructures in PHP using ZF2 (and ZF1) Enrico Zimuel Zend Technologies
  • 2. About me October 2011 • Software Engineer since 1996 – Assembly x86, C/C++, Java, Perl, PHP • Enjoying PHP since 1999 • PHP Engineer at Zend since 2008 • ZF Core Team from April 2011 Email: enrico@zend.com • B.Sc. Computer Science and Economics from University of Pescara (Italy)
  • 3. Summary October 2011 ● Cloud computing in PHP ● ZendServiceRackspace ● Simple Cloud API ● ZendCloudInfrastructure for ZF2 and ZF1 ● Adapters: Amazon Ec2, Rackspace ● Examples
  • 4. Cloud computing October 2011
  • 5. Cloud for developers October 2011 ● Needs for developers: ● Standard API (Open Stack, Open Cloud Computing Interface, ?) ● Development infrastructures ● Libraries/Frameworks “cloud ready”
  • 6. API for the cloud October 2011 ● API (Application Programming Interface), to interact with cloud services ● Typically use REST-based APIs ● Each vendor exposes a property API ● Learning curve for each cloud vendor
  • 7. PHP libraries for cloud October 2011 ● Amazon Web Services ● AWS SDK for PHP, http://aws.amazon.com/sdkforphp/ ● Windows Azure ● PHPAzure, http://phpazure.codeplex.com/ ● Rackspace ● php-cloudfiles, http://bit.ly/ptJa1Y ● GoGrid ● GoGridClient, http://bit.ly/o7MeLA
  • 8. ZF services for cloud October 2011 ● ZendServiceAmazon ● ZendServiceGoGrid (under dev) ● ZendServiceNirvanix ● ZendServiceRackspace ● ZendServiceWindowsAzure
  • 10. ZendServiceRackspace October 2011 ● Manage the following cloud services of Rackspace: ● Servers ● Files ● Provide a full OO interface for the API of Rackspace (ver 1.0) ● Release: ZF1 1.11.12+, ZF2 dev3+
  • 11. Example: authentication October 2011 $user = 'username'; $key = 'secret key'; $rackspace = new ZendServiceRackspaceFiles($user,$key); if ($rackspace->authenticate()) { echo "Authentication successfully"; } else { printf("ERROR: %s",$rackspace->getErrorMsg()); }
  • 12. Example: store object October 2011 … $container = $rackspace->createContainer('test'); if (!$rackspace->isSuccessful()) { die('ERROR: '.$rackspace->getErrorMsg()); } $name = 'example.jpg'; $file = file_get_contents($name); $metadata = array ( 'foo' => 'bar' ); $rackspace->storeObject('test',$name,$file,$metadata); if ($rackspace->isSuccessful()) { echo 'Object stored successfully'; } else { printf("ERROR: %s",$rackspace->getErrorMsg()); }
  • 13. Example: create a server October 2011 $user = 'username'; $key = 'secret key'; $rackspace = new ZendServiceRackspaceServers($user,$key); $data = array ( 'name' => 'test', 'imageId' => '49', 'flavorId' => '1', ); $server = $rackspace->createServer($data); if (!$rackspace->isSuccessful()) { die('ERROR: '.$rackspace->getErrorMsg()); } printf("Server name : %sn",$server->getName()); printf("Server Id : %sn",$server->getId()); printf("Admin password : %sn",$server->getAdminPass());
  • 15. Simple Cloud API October 2011 ● The Simple Cloud API is a common API for accessing cloud application services offered by multiple vendors ● Starting from November 2010 the Simple Cloud API is part of Zend Framework under the classname: ● Zend_Cloud (ZF1) ● ZendCloud (ZF2)
  • 16. simplecloud.org October 2011
  • 17. Why we need it? October 2011 ● Vendor lock-in ● In economics, vendor lock-in makes a customer dependent on a vendor for products and services, unable to use another vendor without substantial switching costs ● Portability ● reuse the existing code instead of creating new code when moving software from an environment to another
  • 18. The architecture October 2011 ZendCloud ZendService
  • 19. The architecture (2) October 2011 ZendCloud Document Queue Storage Infrastructure ZendService
  • 20. ZendCloud as abstraction October 2011 ● ZendCloud is an abstraction of the main features of some cloud vendors ● Vendor specific functions may not be included in ZendCloud (for portability reason) ● For instance, Amazon S3 has a cleanBucket operation that is not implemented in ZendCloud ● You can access the concrete adapters to use specific functions (getAdapter)
  • 21. ZendCloudDocumentService October 2011 ● Abstracts the interfaces to all major document databases - both in the cloud and locally deployed ● Adapters: ● Amazon SimpleDB ● Windows Azure
  • 22. ZendCloudQueueService October 2011 ● The QueueService implements access to message queues available as local or remote services. ● Adapters: ● Amazon Sqs ● Windows Azure ● ZendQueue
  • 23. ZendCloudStorageService October 2011 ● The storage service in the Simple Cloud API implements a basic interface for file storage on the cloud ● Adapters: ● Amazon S3 ● Windows Azure ● Nirvanix ● Filesystem ● Rackspace (under dev)
  • 25. ZendCloudInfrastructure October 2011 ● Manage instances (servers) of a cloud computing infrastructure ● Release ZF1: 1.11.12+, ZF2: dev3+ ● Adapters: ● Amazon Ec2 ● Rackspace Cloud Servers ● GoGrid (under dev) ● Windows Azure (under dev)
  • 26. Basic operations October 2011 ● Create a new instance ● Delete an instance ● Start/stop/reboot an instance ● List available instances ● Get the status of an instance (running, stop, etc) ● Monitor an instance (CPU, RAM, Network, etc) ● Deploy an instance ● Execute remote shell command (using SSH2)
  • 27. Image of an instance October 2011 ● An image of an instance is the collection of the following information: ● Operating system (OS) ● Memory available (RAM) ● CPU type
  • 28. Example: Amazon Ec2 adapter October 2011 use ZendCloudInfrastructureAdapterEc2 as Ec2Adapter, ZendCloudInfrastructureFactory; $key = 'key'; $secret = 'secret'; $region = 'region'; $infrastructure = Factory::getAdapter(array( Factory::INFRASTRUCTURE_ADAPTER_KEY => 'ZendCloudInfrastructureAdapterEc2', Ec2Adapter::AWS_ACCESS_KEY => $key, Ec2Adapter::AWS_SECRET_KEY => $secret, Ec2Adapter::AWS_REGION => $region, ));
  • 29. Example: create instance October 2011 $param= array ( 'imageId' => 'your-image-id', 'instanceType' => 'your-instance-type', ); $instance= $infrastructure->createInstance('name', $param); if ($instance===false) { die ('Error'); } printf ("Name of the instance: %sn", $instance->getName()); printf ("ID of the instance : %sn", $instance->getId());
  • 30. Example: reboot and wait for status change October 2011 if (!$infrastructure->rebootInstance('instance-id')) { die ('Error in the execution of the reboot command'); } echo 'Reboot command executed successfully'; if ($infrastructure->waitStatusInstance('instance-id', Instance::STATUS_RUNNING)) { echo 'The instance is ready'; } else { echo 'The instance is not ready yet'; }
  • 31. Wait for status change October 2011 waitStatusInstance (string $id, string $status,integer $timeout=30) ● Wait the status change of an instance for a maximum time of n seconds (30 by default). ● Return true if the status changes as expected, false otherwise.
  • 32. Example: monitor an instance October 2011 use ZendCloudInfrastructureInstance; $cpuUsage= $infrastructure->monitorInstance( 'instance-id',Instance::MONITOR_CPU); var_dump($cpuUsage); array(2) { [2] => array(2) { ["series"] => array(3) { ["timestamp"] => int(1318348920) [0]=> array(2) { ["value"] => int(60) ["timestamp"] => int(1318348800) } ["value"]=> int(80) } } ["average"] => string(3) "70" [1]=> array(2) { } ["timestamp"] => int(1318348860) ["value"] => int(70) }
  • 33. Example: deploy an instance October 2011 $nodeId= 'id-instance'; $param= array ( Instance::SSH_USERNAME => 'username', Instance::SSH_PASSWORD => 'password' ); $cmd= 'ls -la /var/www'; $output= $infrastructure->deployInstance($nodeId,$param,$cmd); echo "The files in the DocumentRoot of the $nodeId instance are:n"; print_r ($output); Note: require the SSH2 extension
  • 34. Thank you! October 2011 ● Vote this talk: ● http://joind.in/3764 ● Comments and feedbacks: ● enrico@zend.com simplecloud.org