Note: Please go to docs.rightscale.com to access the current RightScale documentation set. Also, feel free to Chat with us!
Home > Clouds > Rackspace Open Cloud > Tutorials > Launch an All-In-One LAMP Server in Rackspace Open Cloud

Launch an All-In-One LAMP Server in Rackspace Open Cloud

Table of Contents

Objective

This tutorial introduces how to set up, configure, and launch a fully functioning LAMP (Linux Apache MySQL and PHP/Perl/Python or other Programming language) server running on Rackspace Open Cloud using a RightScale ServerTemplate. This tutorial is useful for a developer who wants to host a LAMP server on Rackspace Open Cloud.

Prerequisites

  • A RightScale account that is enabled with valid Rackspace Open Cloud credentials. See Add Rackspace Open Cloud Credentials to a RightScale Account to learn how to add your credentials to the RightScale Dashboard.
  • library, designer and actor user role privileges
  • One of the following ServerTemplates:
    • LAMP All-In-One Trial with MySQL 5.5 (v13.x)
    • LAMP All-In-One with MySQL 5.1 (v13.x)
    • LAMP All-In-One with MySQL 5.5 (v13.x)

Overview

ServerTemplates consist of a base image that contain a lightweight Linux installation (in our example shown below, CentOS ). In this tutorial you will use one of our LAMP all-in-one ServerTemplates to launch a fully functioning LAMP server. With this configuration, the entire LAMP stack runs on a single cloud server.

File:09-Clouds/Rackspace_Open_Cloud/Tutorials/Launch_an_All-In-One_LAMP_Server_in_Rackspace_Open_Cloud/diag-Rackspace_LAMP-v1.png

Steps

Prepare your Application

First, you must create a tarball of your PHP application code and a properly formatted gzipped dump of your MySQL database.

NOTE: The MySQL dump filename must follow the specified format: 'prefix-timestamp.gz' Ex: myapp_prod_dump-20080416234.gz, where 'myapp_prod_dump' is the prefix. The PHP application code must have the .tgz extension, for example 'myapp.tgz'

Sample applications

If you would like to use sample files to complete this tutorial, listed are a sample PHP file and MySQL dump file.

 

Alternatively, our services team provides the source files for another test application (further known as the 'world' application). The database dump file comes directly from the 'world' test database provided by MySQL as well. The link below for the application code will download a .tgz tarball file for you, so there is no need to create one in a separate step.

Create a MySQL database dump

Fill in your username, password, and schema name and execute these commands. A dump will be created in your /tmp directory. In the code below, you may replace 'myapp_prod_dump' with your own prefix.

USER=
PASSWD=
SCHEMA=
suffix=`date "+%Y%m%d%H%M"`
mysqldump --single-transaction -u $USER -p$PASSWD $SCHEMA | gzip -c > /tmp/myapp_prod_dump-$suffix.gz
Create a tarball of your PHP application

Change to the root directory of your application and execute the following command:

tar czf /tmp/myapp.tgz .

Upload your files to Cloud Files

Now that you have a dump of your database and a tarball of your application, you can upload those files to a Rackspace Cloud Files container. Use two different containers: one for your application and one for your database backups to isolate your application from the many database backups that will occur. (This ServerTemplate is designed to take regular backups of your database and save them to your designated Cloud Files container.)

  • Log into the Rackspace Cloud Console: https://mycloud.rackspace.com/
  • Go to Files > Create Container
  • Create one container for the application code (e.g., app) and one for the database dump file and backups (e.g., db).
  • Upload the application code and dump files into the proper containers.

Your application and database files are now stored in Rackspace's cloud storage for retrieval when the server launches.

Import the ServerTemplate

  • Navigate to Design > MultiCloud Marketplace > ServerTemplates.
  • Search for one of the following ServerTemplates:
    • LAMP All-In-One Trial with MySQL 5.5 (v13.4)
    • LAMP All-In-One with MySQL 5.1 (v13.4)
    • LAMP All-In-One with MySQL 5.5 (v13.4)
  • View the selected ServerTemplate and click Import.

Create a New Deployment

Go to Manage > Deployments and click the New button. Give the deployment a nickname (e.g., Rackspace), then click Save.

Add a Server to the Deployment

The next step is to use the imported ServerTemplate to add a server to the new deployment.

View your newly imported ServerTemplate by navigating to Design > ServerTemplates > Your ServerTemplate.

While viewing the ServerTemplate, click Add Server.

File:09-Clouds/Rackspace_Open_Cloud/Tutorials/Launch_an_All-In-One_LAMP_Server_in_Rackspace_Open_Cloud/screen-RackspaceAddServer.png

Select 'Rackspace Open Cloud' as your cloud and the deployment you created earlier, then click Continue.

File:09-Clouds/Rackspace_Open_Cloud/Tutorials/Launch_an_All-In-One_LAMP_Server_in_Rackspace_Open_Cloud/screen-AddServerDeploymentCloudRackspace.png

 

Next, provide some basic configuration settings about your server in the Add Server assistant:

  • Keep the default settings for the "MultiCloud Image" and "Instance Type."
  • Enter a "nickname" for the server. (e.g., My LAMP)
  • Click Confirm, then click Finish.

 For more information on adding a server, see Add Server Assistant.

 

File:09-Clouds/Rackspace_Open_Cloud/Tutorials/Launch_an_All-In-One_LAMP_Server_in_Rackspace_Open_Cloud/screen-RackspaceDeploymentView.png

The MultiCloud Image will automatically select the appropriate base machine image for you based on the selected cloud infrastructure.

Create Credentials

The ServerTemplate is pre-defined to use some commonly used credentials. Create the following credentials by going to Design > Credentials and selecting the New button:

  • DBAPPLICATION_PASSWORD - specify a value as your Database Application Password.
  • DBAPPLICATION_USER - specify a value as your Database Application User.
  • RACKSPACE_OPEN_CLOUD_USERNAME - Specify the value by using your Rackspace Open Cloud Username used to login here: https://mycloud.rackspace.com
  • RACKSPACE_OPEN_CLOUD_AUTH_KEY - Specify the value by using your API Key found in the Rackspace Open Cloud console. To locate your API key:
    • Navigate to your account name dropdown in the upper right corner of the Rackspace Open Cloud console
    • Select "Settings and Contacts" and click "Show" next to your API Key.

Modify Inputs

The next step is to customize the server by providing values for any missing inputs. Define any missing inputs at the deployment level to take advantage of the input hierarchy rules that apply (see Inheritance of Inputs for more details.) A server will inherit its input configurations first from the ServerTemplate and then from the deployment.

  • Go to your deployment's Inputs tab and click Edit. Modify the inputs as specified below:

APP

Input Name Description Input Type Example Value
 Database Schema Name Enter the name of the database schema to which applications will connect to. The database schema should have been created when the initial database was first set up. This input will be used to set the application server's database configuration file so that applications can connect to the correct schema within the database. This input is also used for database dump backups in order to determine which schema will be backed up.  Text

text: mydbschema

 

For the example "world" database listed above, use:

 

text: world

DB

Input Name Description Input Type Example Value
 Dump Container The cloud storage location where the dump file will be saved to or restored from. For Rackspace Cloud Files, use the container name.  Text text: <your cloud files DB container>
 Database Schema Name Enter the name of the database name/schema to create/restore a dump from/for.  Text

text: mydbschema

 

For the sample "world" database provided above, use:

 

text: world

 Dump Prefix The prefix that will be used to name/locate the backup of a particular database dump. Defines the prefix of the dump file name that will be used to name the backup database dump file, along with a timestamp. If you are using our sample myapp_prod_dump-200804161345.gz dump file, specify 'myapp_prod_dump' as the prefix value.  Text

text: myapp_prod_dump

 

For the sample "world" database listed above, use:

 

text: world

 Dump Storage Account ID In order to write the dump file to the specified cloud storage location, you need to provide cloud authentication credentials. For Rackspace Cloud Files, use your Rackspace login username (e.g., cred:RACKSPACE_OPEN_CLOUD_USERNAME).  Cred cred: RACKSPACE_OPEN_CLOUD_USERNAME
 Dump Storage Account Provider Location where the dump file will be saved. Used by dump recipes to back up to remote object storage (Cloud Files).  Text cloudfiles
 Dump Storage Account Secret In order to write the dump file to the specified cloud storage location, you will need to provide cloud authentication credentials. For Rackspace Cloud Files, use your Rackspace account API key (e.g., cred:RACKSPACE_OPEN_CLOUD_AUTH_KEY). Cred cred: RACKSPACE_OPEN_CLOUD_AUTH_KEY

REPO

Input Name Description Input Type Example Value
 Account Name The account name (i.e. username, ID) that is required to access files in the specified location. This input is optional and may not be required.  Cred cred: RACKSPACE_OPEN_CLOUD_USERNAME
 Account Credential A valid credential (i.e. password, SSH key, account secret) to access files in the specified location. This input is always required for Git and Rsync but may be optional for other providers.  Cred cred: RACKSPACE_OPEN_CLOUD_AUTH_KEY
 Repository Provider Specify where the application code should be checked out from.  Text repo_ros
 Repository URL/ROS Container The URL that points to the location of the repository that contains the application code. Or the name of the ROS container where a tarball of the application code will be retrieved from if you use 'repo_ros' provider.  Text text: <your app cloud files container>
 ROS Prefix The prefix that will be used to locate the correct tarball of the application. For example, if you're using the sample 'myapp2.tgz' specify 'myapp2' as the ROS Prefix.  Text

text: myapp2

 

For the sample "world" application listed above, use:

 

text: world

 ROS Storage Account Provider The Remote Object Storage (ROS) service where the tarball of the application code will be retrieved from.  Text cloudfiles

Launch the Server

Click the server's Launch button.

File:09-Clouds/Rackspace_Open_Cloud/Tutorials/Launch_an_All-In-One_LAMP_Server_in_Rackspace_Open_Cloud/screen-RackspaceDeploymentView.png

Next, you may see an Input Confirmation screen before the server is launched. Since you earlier defined values for any missing inputs, none of the inputs are highlighted in red. Click the Launch button again.

Soon you will have a fully operational cloud instance running your own PHP application.

Preview your PHP Application

Once operational, you can view your PHP application in a browser window.

  • Click on the server's Nickname link.
  • Click the Server's Public IP Address link under the server's Info tab.

You should see a PHP information screen in your browser window.

 

screen-PHPLAMP.png

 

You can also click on the server's Monitoring tab to view real-time monitoring graphs.

Terminate the ServerEdit section

Do not forget to terminate your server to avoid unwanted usage fees. Click the server's Terminate button to terminate the server if desired.

You must to post a comment.
Last modified
13:57, 17 Jul 2013

Tags

Classifications

This page has no classifications.

Announcements

None


© 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.