Developing Joomla on AWS with Z-Ray

      No Comments on Developing Joomla on AWS with Z-Ray

Development in the cloud is all the rage these days and the PHP world is no exception to this rule as more and more developers are opting to move their development work to the cloud and other virtual environments (did I hear someone say Docker?)

The workflow detailed below showcases only one of the many options currently available for PHP developers, but demonstrates just how simple and productive the move to the cloud can be.

Specifically, the article describes the deployment of the newly available Zend Server 8.5 instance on AWS, the installation of a Joomla application on top of Zend Server, and then development of the app using Z-Ray.

Prerequisites

To follow the steps in this tutorial, you’ll need the following:

  • An active Amazon account
  • A running and pre-configured AWS RDS 

Step 1: Launching your Zend Server Instance

Our first step is to launch a Zend Server 8.5 instance on AWS.

To launch Zend Server on AWS, go to the AWS marketplace and search for Zend Server.

You’ll get a list of all the available Zend Server AMIs.

ami_list

Various Zend Server editions and versions are available, going back to Zend Server 6.3 with PHP 5.3 LTS support, but in this tutorial let’s opt for the latest and greatest – Zend Server 8.5 Developer edition with PHP 5.6 on Ubuntu.

The next page gives you details on the selected AMI, and we can just press Continue.

launch_options

Next, we’re going to select the type of launch method to use for the deployment.

The simplest way is the Launch with 1-Click option which is also selected by default. Another option is the manual launch – definitely an interesting option for those wanting to use more advanced launching features such as using the EC2 console, APIs or CLI.

The Launch with 1-Click option will suit us just fine in this case, but first we need to tweak the launch configurations a bit.

You can select the EC2 instance type, the security group settings, and an SSH keypair to use for accessing the machine.

Once you’re done, simply click Launch with 1-Click.

Great. You’ve launched your first Zend Server instance on AWS. On the Summary page that’s displayed, click the link to the AWS Management Console, and then in the console itself, click Instances from the menu on the left.

You’ll see your instance listed.

aws_management_console

Step 2: Launching Zend Server

Once launched, the instance takes a while until it is fully initialized. As an indicator, check the instance status checks column in the Instances list.

Your next step, once the instance is ready, is to launch the Zend Server user interface.

public_ip

Select your instance from the list, and from the Description tab at the bottom of the page, copy the public IP of  the instance, together with the port the Zend Server UI uses – 10081, and paste them in your browser (e.g. http://<IP>:10081).

Since this is the first time you’re accessing the instance, you will need to enter the instance ID when asked in the security dialog that pops up (you can retrieve the ID from the instances list as well).

Advancing on, you will see the Zend Server launching wizard. Complete the wizard as described here.

Note: The Profile and Cluster Configuration steps are not displayed.

Once you hit that Finish button on the last dialog of the wizard – you’re done with launching Zend Server and you will see the Zend Server Get Started page.

getting_started_page

Step 3 : Deploying Joomla

Now it starts to get interesting. Your next step is to deploy a Joomla sample application on Zend Server. Of course, this is a shortcut. If you have your own Joomla app that you want to install, you can upload the code to AWS using SSH. But this is a slightly more complicated workflow, and a topic for another tutorial.

So, on the Get Started page, take a look at the Sample Apps section. There are a number of sample applications that can be deployed, but as said – we’re  going for Joomla.

After you select the Joomla app, the Deploy Application wizard is displayed, and Zend Server begins to download the Joomla application package.

Once uploaded, you can start advancing through the various deployment steps. These are predefined stages that are all part of the application package. Special attention needs to be given to the User Parameters step, since in this step you’re going to need to enter the details of the AWS RDS you’re using. 

After you click Deploy on the last step of the wizard, Zend Server commences the deployment process.

Open your app in a browser!

joomla_app1

Step 4: Debugging with Z-Ray

Cool! You’ve managed to deploy a Joomla application on Zend Server running on AWS. Now, let’s see how Z-Ray helps us get a deep hard look under the hood of our app.

At the bottom of the browser, Z-Ray is displaying info on all the PHP elements constructing your page, such as request info, functions, errors and warnings and SQL queries (see this article for a list of the top 10 Z-Ray features), but it can also show app and framework specific information depending on the application you’re working on.

This info is displayed by installing plugins which are available in the new Zend Gallery – an online marketplace for plugins developed by and for the Zend Server community. The Joomla plugin is one such plugin, developed and shared by Jisse Reitsma from Yireo (@jissereitsma). 

gallery

So access the Gallery in the Zend Server UI, locate the Joomla plugin, and install it (just click the Install button and complete the short wizard).

Once installed, refresh your app in the browser – you’ll notice that a tab was added on the far right.

Selecting it opens the Z-Ray plugin for Joomla, with additional Joomla-specific info.

joomla_app2

Request and Config

The Request panel provides general info on  the request – the layout, view and component used, while the adjacent Config panel complete the overview picture with details on your Joomla configuration, such as the Joomla version, template, etc.

Modules

Joomla Modules are listed in this Modules panel which helps you quickly see which module is loaded by Joomla core regardless of the output. You can see the module title, its position, ID and the content.

Events

The Events panel shows us all the triggered Joomla events on the page. You can see how many times they occurred, and any arguments they entailed.  

Plugins

And the Plugins panel gives you a list of all the triggered Joomla plugins on the page. So used together with the Events panel, Z-Ray will help you see which plugin does what at which event.

Files

And last but not least – the Files panel helps you understand which files are used and from which directory.

Note: For a live demo, click here.

Summary

So in just a few clicks, you can get up and running with a reliable, stable and auto-scaling PHP environment based on Zend Server and AWS, and start using Z-Ray to identify issues and optimize your Joomla apps. 

For more information on available features supported by Zend Server and  Z-Ray on AWS, check out this blog post by one of the project’s developers.

Hope you enjoyed the read!