Playing with PHP on Azure
A Zend experience
Cédric Derue – GWAB 2014
 Web Architect @ Altran
 Skills:
•  Zend Framework 2
•  ASP.NET MVC
•  JavaScript
•  NoSQL
 Twitter: @cderue
Cédric...
 You love PHP,
 You love scripting,
 You love pachyderms,
 You know Windows?
Who this session is for?
 Cloud Computing definition
 Windows Azure introduction
 Zend Framework 2 use case
 Azure Web Sites
 Azure Storage
Ag...
Cloud Computing origin
 Arpanet
 Amazon
 Google
 HP
 Microsoft
Windows Azure solution
Choose your ressources
App
A simple equation to summary Windows Azure
Blocs de
construction
applicatif
Compute Application blocks
Infra for building ...
 Evolutive and scalable
 Fault tolerance
 On demand
 Pay for what you use
Windows Azure benefits
Azure free trial
Windows Azure Portal
Windows Azure execution models
Cloud Services
Mobile Services
Virtual Machines
Web Sites
Virtual Machines
Highly
configurable
Windows Server
or Linux
IaaS
Scalable
Web Sites
.NET, PHP,
Python, Node.js,
Java
IIS
PaaS
Scalable
Mobile Services
Android
iOS
HTML
Hybrid
Storage
Authentication
Push
Monitoring
MBaaS
Scalable
Cloud Services
Highly
configurable
IIS
PaaS (Web &
Worker Roles)
Scalable
How to choose the right(s) model(s)?
 Create a new Azure Web Site
 Start a new ZF2 app on Azure
 Add ZF2 modules
 Work with relational data on Azure
 Work...
Create a new Web Site on Azure
Configuring source control
Explore Azure Web Site(s)
Managing configuration
Scaling
 Modular
 Extensible
 High performing
 Secure
 Enterprise ready
 Community
Why Zend Framework 2?
> composer create-project
--repository-url=
"https://packages.zendframework.com"
-s dev
zendframework/skeleton-application...
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="MyFixIt" stopProce...
> git remote add origin
https://cderue@zf2.scm.azurewebsites.net:443/zf2.git
> git remote -v
> git push origin master
Publ...
First sign of life
http://zf2.azurewebsites.net
Understanding ZF2 app structure
Discovering ZF2 modules
http://modules.zendframework.com
{
"name": "cderue/zf2-myfixit",
"description": "MyFixIt Application for ZF2",
"license": "Apache License, Version 2.0",
"k...
 ZfcUser  Authentication
 MyFixIt  Task Management
Which modules for our demo?
 Authentication is to verify that a person or
entity is what it claims to be.
 Authentication is not authorization.
Auth...
ZendAuthentication principle
Storage
ZendAuthenticationAuthenticationService
Adapter
Db LDAP … Db Session …
"require": {
"zf-commons/zfc-user": "dev-master"
}
Install ZfcUser module
<?php
return array(
'modules' => array('ZfcBase'...
The MyFixIt module
 Domain Driven Design
 Dependency injection
 Table Storage
 Blob storage
 Environment specific configuration
 Revers...
 With Azure, data can be stored in different
systems like SQL or/and NoSQL databases,
blobs, drives, etc.
 Azure provide...
 Azure SQL Database
 Azure Table Storage
 Azure Blob Storage
 Others…
Working with data on Azure
$adapter = new ZendDbAdapterAdapter(
array(
'driver' => 'pdo',
'dsn' => '<dsn>'
'database' => '<mysql_db>',
'username' => ...
Store and access data with:
 Blob (large binary or text data)
 Table (non relational data)
 Queue (messages)
Azure Stor...
 Storage in the form of tables
 Flexible schema
 High performance
 REST API
Azure Table Storage
Azure Blob Storage
Account Container Blob
cedric
pictures
movies Man of Steel.avi
Beyonce.jpg
Shakira.png
Explore Azure Storage
 Windows Azure SDK for PHP
 Zend Framework 2 components
 Symfony 2 bundles
Working with PHP on Azure
Windows Azure SDK for PHP
Windows Azure SDK for PHP
PHP Client
Librairies
Command
Line Tools
Azure
Emulators
Windows Azure...
Install Windows Azure SDK
"require": {
"microsoft/windowsazure": "*" },
"repositories": [
{
"type": "pear",
"url": "http:/...
When you deploy an application on the cloud,
the reversibility must be taken into account to
allow execution on premise if...
Switch beetween two configuration files:
 config/autoload/module.myfixit-
azure.local.php
 config/autoload/module.myfixi...
"require": {
"doctrine/doctrine-mongo-odm-module": "dev-master"
}
Install Doctrine ODM module
<?php
return array(
'modules...
return array(
'doctrine' => array(
'connection' => array(
'server' => 'localhost',
'port' => '27017',
'user' => '<user_nam...
It’s time to demo
 New Relic
 Application Insights
 Zend Server (PHP only)
Monitoring your cloud applications
http://windowsazure-trainingkit.github.io/
http://blogs.msdn.com/b/microsoft_press/archive/tags/
azure/
http://www.plurals...
Windows Azure makes all you want …
…except French Kiss!
Summary
Thank you!
Upcoming SlideShare
Loading in...5
×

Playing with php_on_azure

1,497

Published on

Published in: Software, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,497
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Playing with php_on_azure"

  1. 1. Playing with PHP on Azure A Zend experience Cédric Derue – GWAB 2014
  2. 2.  Web Architect @ Altran  Skills: •  Zend Framework 2 •  ASP.NET MVC •  JavaScript •  NoSQL  Twitter: @cderue Cédric Derue
  3. 3.  You love PHP,  You love scripting,  You love pachyderms,  You know Windows? Who this session is for?
  4. 4.  Cloud Computing definition  Windows Azure introduction  Zend Framework 2 use case  Azure Web Sites  Azure Storage Agenda
  5. 5. Cloud Computing origin  Arpanet  Amazon  Google  HP  Microsoft
  6. 6. Windows Azure solution
  7. 7. Choose your ressources App
  8. 8. A simple equation to summary Windows Azure Blocs de construction applicatif Compute Application blocks Infra for building and deploying apps
  9. 9.  Evolutive and scalable  Fault tolerance  On demand  Pay for what you use Windows Azure benefits
  10. 10. Azure free trial
  11. 11. Windows Azure Portal
  12. 12. Windows Azure execution models Cloud Services Mobile Services Virtual Machines Web Sites
  13. 13. Virtual Machines Highly configurable Windows Server or Linux IaaS Scalable
  14. 14. Web Sites .NET, PHP, Python, Node.js, Java IIS PaaS Scalable
  15. 15. Mobile Services Android iOS HTML Hybrid Storage Authentication Push Monitoring MBaaS Scalable
  16. 16. Cloud Services Highly configurable IIS PaaS (Web & Worker Roles) Scalable
  17. 17. How to choose the right(s) model(s)?
  18. 18.  Create a new Azure Web Site  Start a new ZF2 app on Azure  Add ZF2 modules  Work with relational data on Azure  Work with non relational data on Azure  Install Windows Azure SDK for PHP  Demonstrate reversibility PHP Azure Web Site demo
  19. 19. Create a new Web Site on Azure
  20. 20. Configuring source control
  21. 21. Explore Azure Web Site(s)
  22. 22. Managing configuration
  23. 23. Scaling
  24. 24.  Modular  Extensible  High performing  Secure  Enterprise ready  Community Why Zend Framework 2?
  25. 25. > composer create-project --repository-url= "https://packages.zendframework.com" -s dev zendframework/skeleton-application <path/to/install> > composer update > php -S localhost:8080 -t public/ public/index.php Initialize a new ZF2 app
  26. 26. <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="MyFixIt" stopProcessing="true"> <match url="^(.*)$" ignoreCase="false" /> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /> </conditions> <action type="Rewrite" url="index.php" /> </rule> </rules> </rewrite> </system.webServer> </configuration> Web.config
  27. 27. > git remote add origin https://cderue@zf2.scm.azurewebsites.net:443/zf2.git > git remote -v > git push origin master Publishing with Git
  28. 28. First sign of life http://zf2.azurewebsites.net
  29. 29. Understanding ZF2 app structure
  30. 30. Discovering ZF2 modules http://modules.zendframework.com
  31. 31. { "name": "cderue/zf2-myfixit", "description": "MyFixIt Application for ZF2", "license": "Apache License, Version 2.0", "keywords": [ "framework", "zf2", "azure" ], "homepage": "http://github.com/cderue", "minimum-stability": "alpha", "require": { "php": ">=5.3.3", "zendframework/zendframework": "2.2.*", } } Composer
  32. 32.  ZfcUser  Authentication  MyFixIt  Task Management Which modules for our demo?
  33. 33.  Authentication is to verify that a person or entity is what it claims to be.  Authentication is not authorization. Authentication
  34. 34. ZendAuthentication principle Storage ZendAuthenticationAuthenticationService Adapter Db LDAP … Db Session …
  35. 35. "require": { "zf-commons/zfc-user": "dev-master" } Install ZfcUser module <?php return array( 'modules' => array('ZfcBase','ZfcUser') );  Post installation  Installation
  36. 36. The MyFixIt module
  37. 37.  Domain Driven Design  Dependency injection  Table Storage  Blob storage  Environment specific configuration  Reversibility Exploring the FixIt module
  38. 38.  With Azure, data can be stored in different systems like SQL or/and NoSQL databases, blobs, drives, etc.  Azure provides data management services for reporting or Big Data computing. Working with data
  39. 39.  Azure SQL Database  Azure Table Storage  Azure Blob Storage  Others… Working with data on Azure
  40. 40. $adapter = new ZendDbAdapterAdapter( array( 'driver' => 'pdo', 'dsn' => '<dsn>' 'database' => '<mysql_db>', 'username' => '<db_user>', 'password' => '<db_user_password>', 'hostname' => '<hostname>', ) ); Access to MySQL Azure with ZendDb
  41. 41. Store and access data with:  Blob (large binary or text data)  Table (non relational data)  Queue (messages) Azure Storage Services overview
  42. 42.  Storage in the form of tables  Flexible schema  High performance  REST API Azure Table Storage
  43. 43. Azure Blob Storage Account Container Blob cedric pictures movies Man of Steel.avi Beyonce.jpg Shakira.png
  44. 44. Explore Azure Storage
  45. 45.  Windows Azure SDK for PHP  Zend Framework 2 components  Symfony 2 bundles Working with PHP on Azure
  46. 46. Windows Azure SDK for PHP Windows Azure SDK for PHP PHP Client Librairies Command Line Tools Azure Emulators Windows Azure REST API Compute Storage Manage My PHP application
  47. 47. Install Windows Azure SDK "require": { "microsoft/windowsazure": "*" }, "repositories": [ { "type": "pear", "url": "http://pear.php.net" } ], "minimum-stability": "dev" }  Installation
  48. 48. When you deploy an application on the cloud, the reversibility must be taken into account to allow execution on premise if you decide to leave the cloud. Think reversibility!
  49. 49. Switch beetween two configuration files:  config/autoload/module.myfixit- azure.local.php  config/autoload/module.myfixit- onpremise.local.php Switch with env specific config
  50. 50. "require": { "doctrine/doctrine-mongo-odm-module": "dev-master" } Install Doctrine ODM module <?php return array( 'modules' => array( 'DoctrineModule', 'DoctrineMongoODMModule' ) );  Installation  Post installation
  51. 51. return array( 'doctrine' => array( 'connection' => array( 'server' => 'localhost', 'port' => '27017', 'user' => '<user_name>', 'password' => '<password>', 'dbname' => '<db_name>', ), ), ); Connect to MongoDB with Doctrine
  52. 52. It’s time to demo
  53. 53.  New Relic  Application Insights  Zend Server (PHP only) Monitoring your cloud applications
  54. 54. http://windowsazure-trainingkit.github.io/ http://blogs.msdn.com/b/microsoft_press/archive/tags/ azure/ http://www.pluralsight.com/training/ https://github.com/WindowsAzure/azure-sdk-for-php https://www.windowsazure.com/fr-fr/support/legal/sla/ Resources
  55. 55. Windows Azure makes all you want … …except French Kiss! Summary
  56. 56. Thank you!

×