Manage cloud infrastructures using Zend Framework

Similar documents
AgileZen and Zend Framework 2 Project management software and API integration

Cloud Computing. Adam Barker

Develop PHP mobile apps with Zend Framework

Cloud Tools Reference Guide. Version: GA

Taming the Cloud Database with Apache jclouds

AWS Service Catalog. User Guide

Amazon Web Services Primer. William Strickland COP 6938 Fall 2012 University of Central Florida

A programming model in Cloud: MapReduce

Open Cloud Computing with the Simple Cloud API and Apache libcloud

MANAGE YOUR AMAZON AWS ASSETS USING BOTO

Eucalyptus User Console Guide

Aneka Dynamic Provisioning

Zend Server Amazon AMI Quick Start Guide

OpenShift on you own cloud. Troy Dawson OpenShift Engineer, Red Hat November 1, 2013

2) Xen Hypervisor 3) UEC

Chapter 9 PUBLIC CLOUD LABORATORY. Sucha Smanchat, PhD. Faculty of Information Technology. King Mongkut s University of Technology North Bangkok

Tcl and Cloud Computing Automation

Last time. Today. IaaS Providers. Amazon Web Services, overview

Introduction to Cloud computing. Viet Tran

Cloud Computing Technology

Lets SAAS-ify that Desktop Application

AdWhirl Open Source Server Setup Instructions

Deltacloud. Michal Fojtik Cloud Computing. Software Engineer Red Hat, Inc

Integration in the cloud - IPaaS with Fuse technology. Charles Moulliard Apache Committer

Here is a quick diagram of the ULV SSO/Sync Application. Number 3 is what we deal with in this document.

IRF2000 IWL3000 SRC1000 Application Note - Apps with OSGi - Condition Monitoring with WWH push

This computer will be on independent from the computer you access it from (and also cost money as long as it s on )

Concentrate Observe Imagine Launch

GSM. Quectel Cellular Engine. HTTP Service AT Commands GSM_HTTP_ATC_V1.2

Cloud Computing and Amazon Web Services. CJUG March, 2009 Tom Malaher

Ø Teaching Evaluations. q Open March 3 through 16. Ø Final Exam. q Thursday, March 19, 4-7PM. Ø 2 flavors: q Public Cloud, available to public

Migration Scenario: Migrating Batch Processes to the AWS Cloud

MarkLogic Server. MarkLogic Server on Amazon EC2 Guide. MarkLogic 8 February, Copyright 2015 MarkLogic Corporation. All rights reserved.

Cloud Computing Deja Vu

OPERATING SYSTEM SERVICES

Assignment # 1 (Cloud Computing Security)

Computer Systems II. Unix system calls. fork( ) wait( ) exit( ) How To Create New Processes? Creating and Executing Processes

Beyond The Web Drupal Meets The Desktop (And Mobile) Justin Miller Code Sorcery Workshop, LLC

Ansible in Depth WHITEPAPER. ansible.com

Using Google Compute Engine

f...-. I enterprise Amazon SimpIeDB Developer Guide Scale your application's database on the cloud using Amazon SimpIeDB Prabhakar Chaganti Rich Helms

Introduction to Openstack, an Open Cloud Computing Platform. Libre Software Meeting

Taking Drupal development to the Cloud. Karel Bemelmans

Freshservice Discovery Probe User Guide

Automating Big Data Benchmarking for Different Architectures with ALOJA

Data Centers and Cloud Computing

CHEF IN THE CLOUD AND ON THE GROUND

4 SCS Deployment Infrastructure on Cloud Infrastructures

NCTA Cloud Architecture

AdRadionet to IBM Bluemix Connectivity Quickstart User Guide

Public Cloud Offerings and Private Cloud Options. Week 2 Lecture 4. M. Ali Babar

How to install and set up the WinSCP software for Secure File Transfer

Amazon Glacier. Developer Guide API Version

7750 SR OS System Management Guide

Geoff Raines Cloud Engineer

Virtuozzo Virtualization SDK

HDFS Cluster Installation Automation for TupleWare

SMB in the Cloud David Disseldorp

DISTRIBUTED SYSTEMS [COMP9243] Lecture 9a: Cloud Computing WHAT IS CLOUD COMPUTING? 2

Cloud Computing Security Issues

A Comparative Study Of Cloud Environments and the Development of a Framework for the Automatic Deployment of Scalable Cloud-Based Applications

ELEC 377. Operating Systems. Week 1 Class 3

Cloud Servers Developer Guide

Scaling in the Cloud with AWS. By: Eli White (CTO & mojolive) eliw.com - mojolive.com

2.2 Understanding the different classifications of cloud s

Graylog2 Lennart Koopmann, OSDC /

OpenShift on OpenStack

CSE543 Computer and Network Security Module: Cloud Computing

Java PaaS Enabling CI, CD, and DevOps

Monday, April 8, 13. Creating Successful Magento ERP Integrations

An Introduction to Cloud Computing Concepts

Open Cloud System. (Integration of Eucalyptus, Hadoop and AppScale into deployment of University Private Cloud)

Qualtrics Single Sign-On Specification

Scalable Application. Mikalai Alimenkou

How To Install An Aneka Cloud On A Windows 7 Computer (For Free)

User and Programmer Guide for the FI- STAR Monitoring Service SE

White Paper Server. SUSE Linux Enterprise Server 12 Modules

PIKA HMP 3.0 High Level API Programmer's Guide

AppStack Technology Overview Model-Driven Application Management for the Cloud

MATLAB on EC2 Instructions Guide

PHP on IBM i: What s New with Zend Server 5 for IBM i

Cloud Computing: Making the right choices

About This Document 3. Integration and Automation Capabilities 4. Command-Line Interface (CLI) 8. API RPC Protocol 9.

ZingMe Practice For Building Scalable PHP Website. By Chau Nguyen Nhat Thanh ZingMe Technical Manager Web Technical - VNG

Role Based Access Control. Using PHP Sessions

Automated CPanel Backup Script. for home directory backup, remote FTP backup and Amazon S3 backup

Transcription:

Manage cloud infrastructures using Zend Framework by Enrico Zimuel (enrico@zend.com) Senior Software Engineer Zend Framework Core Team Zend Technologies Ltd

About me Email: enrico@zend.com Twitter: @ezimuel 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 B.Sc. Computer Science and Economics from University of Pescara (Italy)

Summary Cloud computing in PHP Zend\Service\Rackspace Simple Cloud API Zend\Cloud\Infrastructure for ZF2 and ZF1 Adapters: Amazon Ec2, Rackspace Examples

Cloud computing

Cloud for developers Needs for developers: Standard API (Open Stack, Open Cloud Computing Interface,?) Development infrastructures Libraries/Frameworks cloud ready

API for the cloud 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 Amazon Web Services AWS SDK for PHP, http://aws.amazon.com/sdkforphp/ Windows Azure Rackspace GoGrid PHPAzure, http://phpazure.codeplex.com/ php-cloudfiles, http://bit.ly/ptja1y GoGridClient, http://bit.ly/o7mela

ZF components for the cloud Zend\Service\Amazon Zend\Service\GoGrid (under dev) Zend\Service\Nirvanix Zend\Service\Rackspace Zend\Service\WindowsAzure

Zend\Service\Rackspace

Zend\Service\Rackspace 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.12 (in trunk now), ZF2 beta1

Example: authentication $user = 'username'; $key = 'secret key'; $rackspace = new Zend\Service\Rackspace\Files($user,$key); if ($rackspace->authenticate()) { echo "Authentication successfully"; } else { printf("error: %s",$rackspace->geterrormsg()); }

Example: store object $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 $user = 'username'; $key = 'secret key'; $rackspace = new Zend\Service\Rackspace\Servers($user,$key); $data = array ( 'name' => 'test', 'imageid' => '49', 'flavorid' => '1', ); $server = $rackspace->createserver($data); if (!$rackspace->issuccessful()) { die('error: '.$rackspace->geterrormsg()); } printf("server name : %s\n",$server->getname()); printf("server Id : %s\n",$server->getid()); printf("admin password : %s\n",$server->getadminpass());

Simple Cloud API

Simple Cloud API 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) Zend\Cloud (ZF2)

simplecloud.org

Why we need it? 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 Zend\Cloud Zend\Service

The architecture (2) Zend\Cloud Document Queue Storage Infrastructure Zend\Service

Zend\Cloud as abstraction Zend\Cloud is an abstraction of the main features of some cloud vendors Vendor specific functions may not be included in Zend\Cloud (for portability reason) For instance, Amazon S3 has a cleanbucket operation that is not implemented in Zend\Cloud You can access the concrete adapters to use specific functions (getadapter)

Zend\Cloud\DocumentService Abstracts the interfaces to all major document databases - both in the cloud and locally deployed Adapters: Amazon SimpleDB Windows Azure

Zend\Cloud\QueueService The QueueService implements access to message queues available as local or remote services. Adapters: Amazon Sqs Windows Azure Zend\Queue

Zend\Cloud\StorageService 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)

Zend\Cloud\Infrastructure

Zend\Cloud\Infrastructure Manage instances (servers) of a cloud computing infrastructure Release ZF1: 1.12 (in trunk now), ZF2 beta1 Adapters: Amazon Ec2 Rackspace Cloud Servers GoGrid (under dev) Windows Azure (under dev)

Basic operations 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 An image of an instance is the collection of the following information: Operating system (OS) Memory available (RAM) CPU type

Example: Amazon Ec2 adapter use Zend\Cloud\Infrastructure\Adapter\Ec2 as Ec2Adapter, Zend\Cloud\Infrastructure\Factory; $key = 'key'; $secret = 'secret'; $region = 'region'; $infrastructure = Factory::getAdapter(array( Factory::INFRASTRUCTURE_ADAPTER_KEY => 'Zend\Cloud\Infrastructure\Adapter\Ec2', Ec2Adapter::AWS_ACCESS_KEY => $key, Ec2Adapter::AWS_SECRET_KEY => $secret, Ec2Adapter::AWS_REGION => $region, ));

Example: create instance $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: %s\n", $instance->getname()); printf ("ID of the instance : %s\n", $instance->getid());

Example: reboot and wait for status change 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 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). returns true if the status changes as expected, false otherwise.

Example: monitor an instance use Zend\Cloud\Infrastructure\Instance; $cpuusage= $infrastructure->monitorinstance( 'instance-id',instance::monitor_cpu); var_dump($cpuusage); array(2) { ["series"] => array(3) { [0]=> array(2) { ["timestamp"] => int(1318348800) ["value"]=> int(80) } [1]=> array(2) { ["timestamp"] => int(1318348860) ["value"] => int(70) } [2] => array(2) { ["timestamp"] => int(1318348920) ["value"] => int(60) } } ["average"] => string(3) "70" }

Example: deploy an instance $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

New mailing list! zf-cloud@lists.zend.com to subscribe send an empty email to: zf-cloud-subscribe@lists.zend.com

Questions?

Thank you! More info: http://www.zend.com http://framework.zend.com/ http://devzone.zend.com