Objective

To set up a PHP application server in a public or private cloud environment.

Prerequisites

The following are prerequisites for completing this tutorial:

  • Required user roles: 'actor', 'designer', and 'library'
  • For Amazon EC2, CloudStack, and other clouds that support security groups, you must have a security group defined with TCP port 22 open for SSH access, the default application port (8000) open to applicable load balancer servers/service, and any other port and protocol access required by your application. Also, remember that iptables is installed and enabled by default on all servers.
  • We strongly recommend that you set up credentials for password values and any other sensitive data included as Chef recipe inputs. See the Create Credentials section below.
  • This tutorial assumes that you are setting up application servers that will function as part of a three-tier architecture that includes both back-end MySQL database servers and front-end load balancer servers (e.g. HAProxy or aiCache) or services (e.g. Amazon Elastic Load Balancing (ELB) or RackSpace Cloud Load Balancers (CLB)). For information on setting up your database servers, see Database Manager for MySQL 5.5 (v14 Infinity) - Tutorial.
  • A deployment into which you are going to add the server. See Create a New Deployment.

Overview

This tutorial describes the steps for launching one or more application servers in the cloud.

For a technical overview of this ServerTemplate, see PHP Application Server.

Create Credentials

In order to use the default input values in the ServerTemplate, you must set up credentials with the following names. For more information on setting up credentials, see Create a New Credential.

  • DBAPPLICATION_PASSWORD - Password of a database user with user-level privileges.
  • DBAPPLICATION_USER - Username of a database user with user-level privileges.
  • SSH_KNOWN_HOST_KEY (Optional) - Create a credential with a valid SSH key which will be appended to the /root/.ssh/known_hosts file. Creating and using this credential is optional but highly recommended to prevent MiTM attacks.

Set up the appropriate set of authentication credentials based upon where the application code will be retrieved.

Steps

Add a Server

Follow these steps to add a load balancer server to the deployment.

  1. Go to the MultiCloud Marketplace (Design > MultiCloud Marketplace > ServerTemplates) and import the most recently published revision of the PHP Application Server ServerTemplate into the RightScale account.
  2. From the imported ServerTemplate's show page, click the Add Server button.
  3. Select the cloud for which you will configure a server.
  4. Select the deployment into which the new server will be placed.
  5. Next, the Add Server Assistant wizard will walk you through the remaining steps that are required to create a server based on the selected cloud.
    • Server Name - Provide a nickname for your new load balancer server (e.g., lb1).
    • Select the appropriate cloud-specific resources that are required in order to launch a server into the chosen cloud. The required cloud resources may differ depending on the type of cloud infrastructure. If the cloud supports multiple datacenters / zones, select a specific zone. Later, when you create the other load balancer server you will use a different datacenter / zone to ensure high-availability. For more information, see Add Server Assistant.
    • If you are using Elastic IPs (AWS EC2 only), select an Elastic IP.
  6. Click Confirm , review the server's configuration and click Finish to create the server.

Configure Inputs

The next step is to define the properties of your application balancer server or servers by entering values for inputs. As a best practice, you should define required inputs for the servers at the deployment level. For a detailed explanation of how inputs are defined and used in Chef recipes and RightScripts, see Inheritance of Inputs.

To enter inputs for the Chef recipes that will run on your load balancers, open the deployment's Inputs tab, click Edit , and use the following settings to configure input values. We recommend that you set up credentials for password values and any other sensitive data as shown in the examples.

RS-APPLICATION_PHP

Input Name Description Example
Application Name The name of the application. This name is used to generate the path of the application code and to determine the backend pool in a load balancer server that the application server will be attached to. Application names can have only alphanumeric characters and underscores. text: example
Application Repository URL The repository location to download application code. text: git://github.com/rightscale/examples.git
Application Repository Revision The revision of application code to download from the repository. text: unified_php
Virtual Host Name/Path The virtual host served by the application server. The virtual host name can be a valid domain/path name supported by the access control lists (ACLs) in a load balancer. Ensure that no two application servers in the same deployment having the same application name have different vhost paths. Example: http:://www.example.com, /index text: http://www.example.com, /index

Launch the Server

Now that you have finished defining server details, you are ready to launch a server in the cloud with the new settings. Click the server's Launch button.

Review the inputs that you set at the Inputs confirmation page and click Launch.