Tuesday, October 25, 2011

Pull Down an Application Created on phpCloud

One of the most promising features in Zend Developer Cloud will be to deploy today's most-famous Web applications directly into your container, without being required to supply the application package. The list of pre-packed applications includes projects like Drupal, Joomla, Magento, Wordpress and a customized Zend Framework. Probably Zend will add more applications in the future (want to suggest one?)

The obvious question is, what will be the best practice for working with an already deployed application and how to pull it down to your development environment?

As a background there are two ways for managing an already deployed project, you can select either of the following options depending on your high level development workflows and your tools (ahch, ahch, Zend Studio supports both of them). One important note that is applied for both solutions - you don't need to deploy the project once again. Just modify the content and make sure it's updated properly in the cloud.

Clone Application via Git Repository

One of the Easter Eggs hidden in this already-packed deployment feature is that once an application is deployed, a git repository is created so developers can clone it and later on push their content. Use a command line tool or any development  environment to clone the application. Then use push to upstream git action to update the actual remote application.

To retrieve the application Git Repository, go to you container overview page:
https://my.phpcloud.com/container/<container-name>/overview and push the "git access" button. Use your container name and password as username and password when you make any operation with this repository.

This Git repository authentication is based on secured HTTP with the following details:

  • URI: the path provided by Zend Developer cloud (see above)
  • User: container name
  • Password: container password

Using Zend SDK:

You can use the latest Zend SDK to clone the code to your machine by running the git clone command with your git repository parameters:

zend clone project -r <git-repository-url> -u <user> -p <password>

Using Zend Studio 9.0:
We are about to use a new feature added to Zend Studio in its latest release that enables you to clone a Git repository, start by File | New | PHP Project from Git. A wizard will show up and you will need to enter the information required for this clone operation to happen.

Follow the wizard and hit "Finish". Once your project is cloned, you can start a debug session right-clicking on the index.php file and selecting "Debug as...", supply the full URL of the application and press OK.

Don't forget to open the SSH Tunnel by right-clicking on its node that available in the Targets view and selecting "Open SSH Tunnel"

Download Application via SFTP Client

The trivial way is to use an integrated SFTP client that supports download and upload actions to the SFTP server installed on your container. Remember the following:

  1. Authentication to the SFTP is made using the private key given the time you created the container or user. So you will need to add it to the private keys manager (in Zend Studio / Eclipse it's under Preferences > General >  Network Connections > SSH2. In the General Tab, add the private key file to the text field named: "Private Keys". You don't have to specify a username and password as you use the private key.
  2. The application content is located under the directory named  .apps/http/__default__/0/<user-name>/1.0.0

Hope this tutorial helps you to configure your development environment and you take advantage of it, but if you think there is a different (better) way don't hesitate to comment below.

No comments: