Table of Contents | |||
Long Term Support Stable, tested ServerTemplate assets |
|
To set up a PHP application server in a public or private cloud environment.
This tutorial describes the steps for launching one or more application servers in the cloud.
For a technical overview of this ServerTemplate, see PHP App Server - Overview.
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.
The ServerTemplate supports the ability to download your application code either as a tarball (.tgz) from a Remote Object Storage location or checkout the codebase from a software repository.
If you have a tarball of your application, upload it to a Remote Object Storage location as either a 'public-read' or 'private' object. If you are using a 'private' object you must provide valid cloud credentials (as inputs) for authentication purposes in order to properly retrieve the object. For more information see the following tutorials.
If you want to checkout your application code from a software repository (e.g. GitHub), you will need to provide your access credentials as inputs later in this tutorial so that a script can be executed to automatically retrieve your application code. If the code is in a private repository, you may need to generate an SSK key (e.g. GitHub SSH Key) for authentication purposes and create a credential (Design -> Credentials) to store the sensitive value.
If you need an example application for testing purposes, you can use the application code from the following git repository.
If you prefer to use a tarball instead, download the file below and upload it into your own remote storage container. (e.g. S3 bucket)
You can either add application servers directly into a deployment or create an server array of application servers for autoscaling.
When you create a server or server array, you will first need to select a deployment and the cloud where the server will eventually be launched into (e.g. AWS us-east). Based on the chosen cloud provider, you will need to complete the configuration process that's specific for that cloud. For example, some cloud providers support features that are unique to their specific cloud.
The next step is to define the properties of your application server by entering values for inputs. It is best to do this at the deployment level. For a detailed explanation of how inputs are defined and used in Chef recipes and RightScripts, see Inputs and their Hierarchy.
To enter inputs for the Chef recipes that will run on your application servers, open the deployment's Inputs tab, click Edit, and use the following instructios to configure the input values. We recommend that you set up credentials for password values and any other sensitive data as shown in the examples.
Note: The following examples and sample values assume that you will connect the application server with RightScale's "Load Balancer" ServerTemplate, which uses HAProxy. If you are using a cloud's load balancing service such as Rackspace Cloud Load Balancing (CLB) or Amazon's Elastic Load Balancing (ELB), please refer to the PHP Application Server Runbook for proper setup instructions.
Input Name | Description | Example Value |
Application Listen Port | The port that the application service listens on to accept requests from the load balancer. If you specify another port than the 8000 (default), be sure to add the port to the "Firewall Rule Port" input and make sure that the security group's settings also allow access (if applicable). | text: 8000 |
Input Name | Description | Example Value |
MySQL Version | Specify the version of the MySQL database that the application servers will connect to. (e.g. 5.1, 5.5) | text: 5.1 |
Input Name | Description | Example Value |
Database Application Password Database Application Username | Database username and password to add to the MySQL database server for application access. | cred: DBAPPLICATION_PASSWORD cred: DBAPPLICATION_USER
|
Database Master FQDN | Fully qualified domain name for the master MySQL database server. Application servers use this input to locate the "master" database server. | text: master-db.example.com |
Input Name | Description | Example Value |
Load Balance Provider | Select the type of load balancer (or service) that the application server(s) will connect to.
| text: lb_haproxy For the provided sample application: |
Virtual Host Names | If you are using an HAProxy load balancer ('lb_haproxy'), specify the virtual host name that will be used by the application server to connect to the correct load balancer server. Note: A load balancer can have multiple virtual host names. If a load balancer is serving requests to multiple virtual host names, the virtual host name that the application server will use must be included in the list otherwise it will connect to the "default" virtual host name, which is the first one in the list. | text: default For the provided sample application: |
Load Balance Service ID Load Balance Service Secret | For CLB, specify the Rackspace username and API key to use for authentication purposes. For ELB, specify the Amazon access key ID and secret access key for authentication purposes. | cred: RACKSPACE_USERNAME cred: AWS_ACCESS_KEY_ID |
Load Balance Service Name | The name of the Amazon Elastic Load Balancer (ELB) or Rackspace Cloud Load Balancer (CLB). | text: my-lb-name |
Load Balance Service Region | Note: Input only applies to a Rackspace Cloud Load Balancer (CLB). For a CLB, select the Rackspace region of the Cloud Load Balancer. It's recommended that you create your CLB in a region as close to your application servers as possible.
| text: ORD |
Input Name | Description | Example Value |
Database Schema Name | Name of the MySQL database to which applications on the server will connect. It is also used to set up the application server's database configuration file. | text: my_db_schema For the provided sample application: |
PHP module packages | To optionally install additional PHP modules besides the default PHP 5.3 packages installed by the ServerTemplate recipes, specify package names here in a comma-separated list. Package naming conventions will differ depending on your Linux distribution; for example, they include a php53u prefix for CentOS and php5 prefix for Ubuntu. | text: php53u-mysql,php53u-pecl-memcache |
The values that you use for the repository inputs will depend on where the application code will be retrieved from. The selection for the Repository Provider input will determine which inputs will be used to retrieve the application. Unrelated inputs are ignored.
The following inputs are used to retrieve the application from either a Git/SVN software repository or an ROS location (Amazon S3 bucket or Rackspace Cloud Files container). Specify the appropriate inputs based upon the selection for the 'Repository Provider' input.
Input Name | Description | Example Value |
Project App root | The destination location where the application code will be placed on the local instance. If you want the application code to be placed in the root directory, use a forward slash (/) otherwise you will need to specify the full path (e.g. /path/to/code). If set to 'ignore' the default location (/home/webapps) will be used. The 'Application Name' input is used to name the destination folder into which the application code will be placed. Apache and PHP will look for the application in the specified path. | text: / For the provided sample application: |
Repository Provider | Specify where the application code should be checked out from.
| For the provided sample application from ROS: For the provided sample application from GitHub: |
Action | Specify how the application code will be pulled from the specified repository.
| text: pull For the provided sample application: |
Important!
If you are checking out code from a Git repository, specify values for the following inputs.
Input Name | Description | Example Value |
Git SSH Key | In order to check out application code from a private (not public) Git repository, you must provide the repository's private SSH key for authentication purposes. Set to 'ignore' if you are using an application in a repository that allows 'public-read' access. | cred: GIT_SSH_KEY For the provided sample application from GitHub: |
Repository URL | The URL that points to the location of the repository that contains the application code. Specify a "read-only" URL. (e.g. git://github.com/username/myapp.git) | text: git://github.com/username/myapp.git For the provided sample application from GitHub: |
Branch/Tag | The specific branch/tag/SHA of the specified Git repository that the application code should be checked out from. (e.g. mybranch) Use "master" to retrieve the master branch from the repository. | text: mybranch For the provided sample application from GitHub: |
Important!
If you are checking out code from an SVN repository, specify values for the following inputs.
Input Name | Description | Example Value |
Repository URL | The URL that points to the location of the repository that contains the application code. Specify a "read-only" URL. (e.g. https://mysvn.net/app) | text: https://mysvn.net/app |
SVN Password SVN Username | The username and password required to access and retrieve the application code from the specified SVN repository. | cred: SVN_USER cred: SVN_PASSWORD |
Branch/Tag | The specific branch or tag of the specified SVN repository that the application code should be checked out from. (e.g. mybranch) Use "trunk" to retrieve the main branch from the repository. | text: mybranch |
Important!
If you are checking out code from a Remote Object Storage (ROS) location, specify values for the following inputs.
Input Name | Description | Example Value |
ROS Container | The name of the Remote Object Storage (ROS) container where a tarball (.tgz) of the application code will be retrieved from.
| text: my-container |
ROS Prefix | The prefix that will be used to locate the correct tarball of the application. For example, if you're using 'myapp.tgz' specify 'myapp' as the ROS Prefix. | For the provided sample application from ROS: |
ROS Storage Account ID | In order to retrieve a tarball of the application code that's a "private" object within the specified Remote Object Storage (ROS) location, you must provide proper cloud authentication credentials. For security reasons, it's recommended that you create and use credentials for these values instead of entering the text value.
| text: AWS_ACCESS_KEY_ID |
ROS Storage Account Provider | The Remote Object Storage (ROS) service where the tarball of the application code will be retrieved from.
| text: s3 |
ROS Storage Account Secret | In order to retrieve a tarball of the application code that's a "private" object within the specified Remote Object Storage (ROS) location, you must provide proper cloud authentication credentials. For security reasons, it's recommended that you create and use credentials for these values instead of entering the text value.
| cred: AWS_SECRET_ACCESS_KEY |
Input Name | Description | Example Value |
Application Name | On your application servers, the server subdirectory where your application code files are stored. If you are using dedicated load balancer servers launched with RightScale's "Load Balancer with HAProxy" ServerTemplate, this value must match the Application Name input for your load balancer servers. | text: myapp |
Multi-Processing Module | Leave this input set to the default, "prefork": the valid value for a PHP server. | text: prefork |
After configuring your inputs, launch all of the PHP application servers. Refer to the instructions in Launch a Server if you are not already familiar with this process.
© 2006-2014 RightScale, Inc. All rights reserved.
RightScale is a registered trademark of RightScale, Inc. All other products and services may be trademarks or servicemarks of their respective owners.