Playing with php_on_azure

  • 1,321 views
Uploaded on

 

More in: Software , Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,321
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
0
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Playing with PHP on Azure A Zend experience Cédric Derue – GWAB 2014
  • 2.  Web Architect @ Altran  Skills: •  Zend Framework 2 •  ASP.NET MVC •  JavaScript •  NoSQL  Twitter: @cderue Cédric Derue
  • 3.  You love PHP,  You love scripting,  You love pachyderms,  You know Windows? Who this session is for?
  • 4.  Cloud Computing definition  Windows Azure introduction  Zend Framework 2 use case  Azure Web Sites  Azure Storage Agenda
  • 5. Cloud Computing origin  Arpanet  Amazon  Google  HP  Microsoft
  • 6. Windows Azure solution
  • 7. Choose your ressources App
  • 8. A simple equation to summary Windows Azure Blocs de construction applicatif Compute Application blocks Infra for building and deploying apps
  • 9.  Evolutive and scalable  Fault tolerance  On demand  Pay for what you use Windows Azure benefits
  • 10. Azure free trial
  • 11. Windows Azure Portal
  • 12. Windows Azure execution models Cloud Services Mobile Services Virtual Machines Web Sites
  • 13. Virtual Machines Highly configurable Windows Server or Linux IaaS Scalable
  • 14. Web Sites .NET, PHP, Python, Node.js, Java IIS PaaS Scalable
  • 15. Mobile Services Android iOS HTML Hybrid Storage Authentication Push Monitoring MBaaS Scalable
  • 16. Cloud Services Highly configurable IIS PaaS (Web & Worker Roles) Scalable
  • 17. How to choose the right(s) model(s)?
  • 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. Create a new Web Site on Azure
  • 20. Configuring source control
  • 21. Explore Azure Web Site(s)
  • 22. Managing configuration
  • 23. Scaling
  • 24.  Modular  Extensible  High performing  Secure  Enterprise ready  Community Why Zend Framework 2?
  • 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. <?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. > git remote add origin https://cderue@zf2.scm.azurewebsites.net:443/zf2.git > git remote -v > git push origin master Publishing with Git
  • 28. First sign of life http://zf2.azurewebsites.net
  • 29. Understanding ZF2 app structure
  • 30. Discovering ZF2 modules http://modules.zendframework.com
  • 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.  ZfcUser  Authentication  MyFixIt  Task Management Which modules for our demo?
  • 33.  Authentication is to verify that a person or entity is what it claims to be.  Authentication is not authorization. Authentication
  • 34. ZendAuthentication principle Storage ZendAuthenticationAuthenticationService Adapter Db LDAP … Db Session …
  • 35. "require": { "zf-commons/zfc-user": "dev-master" } Install ZfcUser module <?php return array( 'modules' => array('ZfcBase','ZfcUser') );  Post installation  Installation
  • 36. The MyFixIt module
  • 37.  Domain Driven Design  Dependency injection  Table Storage  Blob storage  Environment specific configuration  Reversibility Exploring the FixIt module
  • 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.  Azure SQL Database  Azure Table Storage  Azure Blob Storage  Others… Working with data on Azure
  • 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. Store and access data with:  Blob (large binary or text data)  Table (non relational data)  Queue (messages) Azure Storage Services overview
  • 42.  Storage in the form of tables  Flexible schema  High performance  REST API Azure Table Storage
  • 43. Azure Blob Storage Account Container Blob cedric pictures movies Man of Steel.avi Beyonce.jpg Shakira.png
  • 44. Explore Azure Storage
  • 45.  Windows Azure SDK for PHP  Zend Framework 2 components  Symfony 2 bundles Working with PHP on Azure
  • 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. Install Windows Azure SDK "require": { "microsoft/windowsazure": "*" }, "repositories": [ { "type": "pear", "url": "http://pear.php.net" } ], "minimum-stability": "dev" }  Installation
  • 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. 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. "require": { "doctrine/doctrine-mongo-odm-module": "dev-master" } Install Doctrine ODM module <?php return array( 'modules' => array( 'DoctrineModule', 'DoctrineMongoODMModule' ) );  Installation  Post installation
  • 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. It’s time to demo
  • 53.  New Relic  Application Insights  Zend Server (PHP only) Monitoring your cloud applications
  • 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. Windows Azure makes all you want … …except French Kiss! Summary
  • 56. Thank you!