Home | Setup Guide | Deployment Guide | Advanced Features

Deployment Guide


INTRODUCTION

Windows Azure Command-Line Tools for PHP Developers creates a deployable package that can be used for both the local Development Fabric and Windows Azure Platform cloud.

The purpose of this tool is to provide a command-line utility to PHP developers to develop, package, and deploy a PHP web applications to the Windows Azure cloud.

This page describes how this command-line tool can quickly deploy a PHP web applications to the Windows Azure cloud.


QUICK-DEPLOY MODE

Command Prompt: Run as Administrator

It is important that the user opens command prompt by "Run as Administrator". The reason is that Windows Azure SDK tools, CSPack and CSRun, which used by this tool expects to be run with administrative privileges.

quick1_admincmd.png

Usage

Quick-Deploy prepares a PHP Web application into a WebRole package that can be deployed into the remote Windows Azure Cloud or a local Development Fabric.

By default, this tool runs in Quick-Deploy mode.

This command-line setup will create a project labeled MyProject, copies your local PHP runtime, and build within user's TEMP directory:

 C:\..\WindowsAzureCmdLineTools4PHP>php package.php 
    --project=MyProject 
    --phpRuntime="C:\Program Files\PHP\" 


This addendum will copy user provided PHP sources from "..\php_source\" directory:

 C:\..\WindowsAzureCmdLineTools4PHP>php package.php 
    --project=MyProject 
    --phpRuntime="C:\Program Files\PHP\" 
    --source=..\php_source\ 


This addendum will build within "..\workspace\" directory:

 C:\..\WindowsAzureCmdLineTools4PHP>php package.php 
    --project=MyProject 
    --source=..\php_source\ 
    --phpRuntime="C:\Program Files\PHP\" 
    --target="..\workspace\" 


This addendum to the command-line will run packaged WebRole in local Development Fabric:

 C:\..\WindowsAzureCmdLineTools4PHP>php package.php 
    --project=MyProject 
    --source=..\php_source\ 
    --phpRuntime="C:\Program Files\PHP\" 
    --target="..\workspace\" 
    --runDevFabric 


This addendum to the command-line will perform a completely clean rebuild:

 C:\..\WindowsAzureCmdLineTools4PHP>php package.php 
    --project=MyProject 
    --source=..\php_source\ 
    --phpRuntime="C:\Program Files\PHP\" 
    --runDevFabric 
    --cleanRebuild 


CAUTION: Using tool's parameter --cleanRebuild (-f) performs a complete cleanup of the tool and the project. It deletes both of the project's WebRole and Service directories


BASIC COMMAND-LINE PARAMETERS

Using Short Parameters

Short parameters are defined by a single dash followed by a single character:

 > php package.php 
    -vu 
    -n=MyProject 
    -r="C:\Program Files\PHP\" 
    [-s=..\php_source\] 
    [-t=..\workspace\] 


Using Long Parameters

Long parameters are defined by a double dash followed by multiple characters:

 > php package.php 
    --verbose 
    --runDevFabric 
    --project=MyProject 
    --phpRuntime="C:\Program Files\PHP\" 
    [--source=..\php_source\] 
    [--target=..\workspace\] 


Assigning Values

Assigning a value to a parameter requires an equals = operator between parameter and value without spaces. Values that contain spaces should be enclosed within double-quotes.

 > php package.php -n=MyProject -r="C:\Program Files\PHP\" -s=..\php_source\file.php

 > php package.php --project=MyProject --phpRuntime="C:\Program Files\PHP\" --source=..\php_source\file.php 



Base Parameters

Parameter Type Definition
--help, -h Switch Present basic tooling parameters and their descriptions
--advanced, -a Switch Present advanced tooling parameters
--verbose, -v Switch Enable complete verbose progression in packaging and deploying project.


Deploy Parameters - Basic

Parameter Type Definition Values Note Restrictions
--project, -n Required Project Name AlphaNumeric. No Spaces.
--phpRuntime, -r Required once This is the local path to your PHP installation. Directory path. Only required the first time you run it on a project, as it will simply used the copied version each time after that (if not provided).
--source, -s Optional User provided PHP Sources of a web application, which are copied into tool created WebRole directory. Valid path to a file or folder which contain PHP sources and Web.config. If not provided, this tool provides default PHP source, index.php, and Web.config. 1. Path to provided PHP sources cannot be within the current working directory of this tool. 2. PHP sources cannot contain a folder named \Microsoft because it is reserved by this tool.
--target, -t Optional User provided workspace for this tool to create the project's WebRole and Services directories. Directory path. If not provided, tool will create a workspace within user's TEMP directory. Path to provided Workspace directory cannot be within the current working directory of this tool.
--runDevFabric, -u Switch Deploy created package into Windows Azure Development Fabric.
--cleanRebuild, -f Switch Performs a complete cleanup of the tool and the project. It deletes all downloaded PHP resources, and deletes both of the project's WebRole and Service directories.


QUICK WEBROLE SOURCES DEPLOYMENT

Quick Default Deployment

The following command-line entry builds a deployment package MyProject within local host's TEMP directory and deploys to local Development Fabric:

Using short parameters:

 C:\...\WindowsAzureCmdLineTools4PHP>php package.php 
    -n=testSimple 
    -r="C:\Program Files\PHP\" 
    -uf 


Using long parameters:

 C:\...\WindowsAzureCmdLineTools4PHP>php package.php 
    --project=testSimple 
    --phpRuntime="C:\Program Files\PHP\" 
    --runDevFabric 
    --cleanRebuild 


The parameters provided for this run are:
  • --project (-n) - Create deployment package with this project name: testBoth
  • --phpRuntime (-r) - Include PHP runtime from .
  • --runDevFabric (-u) - Enable deployment of package into Dev Fabric.
  • --cleanRebuild (-f) - Perform complete rebuild of package and support directories.

The following link presents a verbose run of command-line with the aforementioned parameters:

C:\...\WindowsAzureCmdLineTools4PHP > php package.php -n=testSimple -r="C:\Program Files\PHP" -uf

===============================

  1.      Validating parameters.

  2.      Validating Tool's PHP Resource. .

  3.      Validating Workspace. . . . . .

  4.      Validating PHP Sources for WebRole directory.

  5.      Removing "testSimple" Service if deployed upon Dev Fabric. . . .

  6.      Creating workspace for "testSimple" Web Role and Service. . . . . . .

  7.      Adding resources to Web Role. . . . . . .

  8.      Adding resources to Service Directory.

  9.      Configuring "testSimple" Web Role. . .

  10.     Packaging "testSimple" Web Role. . .

  11.     Validating Service Directory.

  12.     Configuring "testSimple" Service. .

  13.     Packaging "testSimple" Service. . .

  14.     Successfully packaged "testSimple"

===============================
"testSimple" Web Role is ready for development.
WebRole Location:
         C:\Users\username\AppData\Local\Temp\WACmdLineTools\testSimple_Build\testSimple_WebRole
===============================

===============================
"testSimple" Deployment Package and Configuration is ready.
Package Location:
         C:\Users\username\AppData\Local\Temp\WACmdLineTools\testSimple_Build\testSimple
WebRole Package: testSimple.cspkg
Service Package: ServiceConfiguration.cscfg
===============================

  15.     Deploying "testSimple" Service upon Dev Fabric. . . . . . . . . . .

===============================
"testSimple" Web Role is running in Dev Fabric.
Deployment ID: 585
Endpoint URL: http://127.0.0.1:82/
===============================

Success: Normal Exit
===============================


When command-line tool runs, it performs the following:
  1. Validates that you have the necessary resources downloaded into the "<install location>\res\php\" directory.
  2. Since user did not provide a workspace using --target (-t), the tool will by default create a workspace within the user's TEMP directory:
    1. C:\Users\username\AppData\Local\Temp\WACmdLineTools\
  3. Tool creates two directories within this workspace:
    1. WebRole directory - Contains PHP sources to be packaged, which is located:
      1. C:\Users\username\AppData\Local\Temp\WindowsAzureCmdLineTools4PHP\testSimple_Build\testSimple_WebRole
    2. Service directory -Workspace for packaging WebRole contents, which is located:
      1. C:\Users\username\AppData\Local\Temp\WindowsAzureCmdLineTools4PHP\testSimple_Build\testSimple
  4. Since user did not provide sources using --source (-s), then tool will copy from its downloaded resources the following default contents into aforementioned tool created WebRole directory. The default provided contents includes the following files:
    1. index.php: Simple execution of PHP function phpinfo().
    2. Web.config: Defines index.php as the default web site document.
  5. Downloads from a Windows Azure account all necessary PHP resources to create deployment package.
  6. Tool creates from all PHP sources provided within WebRole directory into a Windows Azure deployment package within Service directory: The result of this packaging includes:
    1. testSimple.cspkg – Package of WebRole's PHP sources and required PHP resources to run web application upon Windows Azure Platform.
    2. ServiceConfiguration.cscfg – Configures how to service the deployed WebRole within Windows Azure Platform.
  7. With --runDevFabric (-u) parameter provided, then the tool deploys the packaged WebRole upon the local Development Fabric. The deployment will find the next available port of localhost's IP address http://127.0.0.1. For example, if port 81 is already taken, then Development Fabric will deploy WebRole to localhost's port 82:
    1. http://127.0.0.1:82/

Example Quick Deployment using Command-Line Tool

The following output is an example run using basic parameters of command-line tool:

C:\...\WindowsAzureCmdLineTools4PHP>php package.php -n=testSimple -uf


And the results of a successful run are:
  • Web Role Directory containing either user or tool provide PHP sources:
    • C:\Users\username\AppData\Local\Temp\WindowsAzureCmdLineTools4PHP\testSimple_Build\testSimple_WebRole
  • Service Directory containing packaging of WebRole ready for deployment to Windows Azure:
    • C:\Users\username\AppData\Local\Temp\WindowsAzureCmdLineTools4PHP\testSimple_Build\testSimple
  • Deployment URL of deployed WebRole package into Windows Azure's Development Fabric:
    • http://127.0.0.1:82/

quick2_phpinfo.png

Last edited May 13, 2010 at 4:34 PM by satish_nikam, version 18

Comments

No comments yet.