PHP FrontEnd Server

Objective

To create a basic PHP deployment using the PHP FrontEnd server template.  The tutorial will show you how to configure a 4-instance setup with two loadbalanced frontends and a redundant MySQL database backend. After you have completed this intial setup, we will show you how to customize your deployment to fit your particular needs.

NOTE: This tutorial only applies to Premium accounts.  If you have a Developer account and would like to upgrade, please contact sales@rightscale.com.

Overview

php_diagram_1.gifIn order to create a high-availbility loadbalanced webserver solution on EC2 we have created front-end server templates that run HAProxy. This is a high-reliability, software load balancer that automatically checks the health of your application and decides whether to forward traffic to a particular server based on these health checks. To provide extra functionality, we also run Apache in front of HAProxy, which allows you to serve static pages locally and establish ssl connections with only a slight increase in latency. To the right is a concepetual overview of the flow of user traffic. 

As you can see, user traffic comes into your application through Apache on port 80. Apache decides which pages to serve directly and which pages to forward to HAProxy (on port 85 by default). Since HAProxy has a list of application servers and is constantly performing health checks, it knows which servers are avilable to handle requests. It then proxies these requests to an appropriate server. Once an application server receives the request, it generally communicates with the backend database.

 

 

 

This tutorial will show you how to setup the minium deployment requirements for a high availability site. The setup consists of a redundant Master/Slave MySQL setup and a pair of loadbalanced frontends that also serve as application servers.  See the diagram below for details.

php_diagram_2.gif

This tutorial is divided into 3 Steps:

Step 1: Add FrontEnd PHP server template to the Production deployment
Step 2: Define Input parameters
Step 3: Launch the server

 

Step 1: Add FrontEnd PHP server template to the Production deployment

Before you begin this tutorial, you should have already completed the Deployment Setup and Create a Redundant MySQL Setup tutorials. 

Go to Manage -> Servers - > Deployments.  Click on the Production deployment.

03-deployment_list.gif

Next, we will add two frontend application servers using the same server template. 

Click the Add Server button.

05-php_add_server_button.gif

If you are a premium account user, you have access to the premium server templates.  Select the latest PHP FrontEnd server template from the premium list.  Nickname the first server, FrontEnd-1. Select the production SSH key and Security Group that you already created. Select the Elastic IPs from the previous Create Elastic IPs (EIP) for each front end. Click Add

08-php_launch_eip.gif

 

Repeat this process and add another server using the same template, but call it FrontEnd-2 and select the other Elastic IP.

You should now have two PHP FrontEnd servers and two database servers in your Production deployment.

11-php_server_list2_eip.gif

 

Step 2: Define Input parameters

Now you need to define the input parameters for your PHP production deployment. 

Click on the Inputs tab.

Although the list of inputs are listed alphabetically, it will be easier to understand how to properly set each input if we describe them together in their various groups.  In the next step we will describe each input and how to properly set the parameters.

Click Edit.  Use the links to the Inputs reference page to complete each section of input parameters.  The suggested values will be highlighted in yellow.

Input Parameters

    1. Apache
    2. Application
    3. AWS Credentials
    4. Database
    5. DNS
    6. HAProxy
    7. Monitoring
    8. PHP
    9. Misc

Once you've configured all of the input parameters, click Save.

Below is a screenshot of the completed list of inputs:


10-php_complete_inputs.gif

Step 3: Launch the server

Now that you've defined all of the required input parameters, you are now ready to launch the server.


 ----------------------

Did you find this document helpful?  Please feel free to leave us a comment below.  We're always looking for ways  to improve our documentation.  Thanks!

 

Tag page
Viewing 2 of 2 comments: view all


Also:
"DNS_ID - leave this value empty in the deployment. Values that are defined at the deployment level overwrite any child components. Therefore we need to define separate DNS IDs for each frontend."

You can't really leave this value blank and launch the server. edited 22:49, 24 Jun 2008
Posted 22:48, 24 Jun 2008
You need to create the Bucket for the Data Base Backups first, then launch these servers. This template does not create Buckets. The scripts will create the files inside the bucket when the backup is performed by CRON. Some Bucket names are in use, so pick a name before you fill in this parameter. Each database needs a unique prefix. If two Master Servers use the same prefix they will share data. This can happen if you Clone a Deployment later. Take care to update the prefix for new and cloned deployments. I like "production_", "qa_", "development_".

Feel free to use "wordpress_" or "wiki_" or any name that helps you know the content of the backups.


Ed@RightScale.com
edited 06:31, 29 Jul 2008
Posted 06:30, 29 Jul 2008
Viewing 2 of 2 comments: view all
You must login to post a comment.