Note: Please go to docs.rightscale.com to access the current RightScale documentation set. Also, feel free to Chat with us!
Home > ServerTemplates > v12.11 LTS > ST > LAMP All-In-One with MySQL 5.1 (v12.11 LTS) > LAMP All-In-One with MySQL 5.1 (v12.11 LTS) - Tutorial

LAMP All-In-One with MySQL 5.1 (v12.11 LTS) - Tutorial

 


Table of Contents    

Long Term Support

icon-lts-v1.png

Stable, tested ServerTemplate assets

     ►  Tutorials

Objective

To set up an example LAMP (Linux, Apache, MySQL, PHP) all-in-one server with your own application and database in a public/private cloud that can be used for production purposes because it supports continuous backups.

Prerequisites

  • 'actor', 'designer', and 'library' user role privileges
  • Access to a MySQL 5.1 or 5.5 dump file that is located in either an Amazon S3 bucket or Rackspace Cloud Files container.
  • PHP application code that is accessible via a Git or SVN repository, or as a tarball (.tgz) saved in either an Amazon S3 bucket or Rackspace Cloud Files container.
  • 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 and port 80 for client HTTP access.

Overview

This tutorial describes the steps for launching a production-ready LAMP server in the cloud.

Before starting the tutorial it's strongly recommended that you read the LAMP All-In-One with MySQL 5.1 (v12.11 LTS) - Overview or LAMP All-In-One with MySQL 5.5 (v12.11 LTS) - Overview page, which will provide a technical overview of the ServerTemplate's overall functionality. 

Steps

Upload your database dump file

The ServerTemplate is designed to retrieve your MySQL database dump file from a supported Remote Object Storage (ROS) service. Currently, the ServerTemplate only supports the retrieval of a MySQL dump file from either an Amazon S3 bucket or Rackspace Cloud Files container.

  1. Upload your MySQL database dump file (*.gz) to either an S3 bucket or Cloud Files container.
     

If you do not have your own dump file you can use the following sample MySQL dump file to complete the tutorial. The sample is a gzip (.gz) file.

app_test-201109010029.gz

 

Alternatively, our services team provides another sample PHP application and MySQL database dump file listed below.  The link below for the application code downloads a .tar.gz tarball file for you directly from Github. The database dump is the 'world' test database provided directly by MySQL.

Add a Server to a Deployment

  1. Create a new deployment. See Create a New Deployment.
  2. Go to Design > MultiCloud Marketplace > ServerTemplates and import the LAMP All-In-One with MySQL 5.1 or LAMP All-In-One with MySQL 5.5 ServerTemplate.
  3. You can use the published revision of the ServerTemplate to launch your LAMP server. However, if you plan to customize the ServerTemplate, clone the template to create an editable version that you can modify.
  4. Add a server to the new deployment using the imported (or cloned) ServerTemplate. See Add Server Assistant for details. 
  5. Click "Finish" when done configuring the server. Do not launch yet.

Create Credentials

Credentials are a way of passing sensitive information to a script (as an input) in a discrete manner without making the actual value visible in the Dashboard. As a best practice, many of the ServerTemplates published by RightScale are preconfigured to use certain credentials. The ServerTemplate assumes that you are following best practices and using credentials to store sensitive information. If the following credentials do not already exist in the RightScale account, you should create them now. Requires 'designer' or 'admin' user role privileges. See Create a New Credential.

If you do not want to create credentials for storing these values, you can enter them as text values later in this tutorial when you define the inputs.

  • DBADMIN_PASSWORD - Password of a database user with admin-level privileges.
  • DBADMIN_USER - Username of a database user with admin-level privileges
  • DBAPPLICATION_PASSWORD - Password of a database user with user-level privileges.
  • DBAPPLICATION_USER - Username of a database user with user-level privileges.
  • RACKSPACE_USERNAME - (Optional) Recommended if you are retrieving a database dump file from a Rackspace Cloud Files container.
  • RACKSPACE_AUTH_KEY - (Optional) Recommended if you are retrieving a database dump file from a Rackspace Cloud Files container.
  • GIT_SSH_KEY - (Optional) Recommended if you are retrieving your application code from a private GitHub repository.
  • SVN_PASSWORD - (Optional) Recommended if you are retrieving your application code from an SVN repository.
  • SVN_USERNAME - (Optional) Recommended if you are retrieving your application code from an SVN repository.

Define Inputs

The next step is to define any missing inputs. It's recommended that you define any missing inputs at the deployment level for inheritance and consistency reasons. 

This particular ServerTemplate contains scripts that retrieve a MySQL dump file and application code at boot time. In order for the scripts to successfully retrieve the files you will need to provide necessary information. 

Under the deployment's Inputs tab, click Edit.

Click the Show all Advanced text link to view the exhaustive list of inputs for all categories.

screen-ShowAdvancedInputs-v1.png

Retrieve Database Dump

You can retrieve your database dump from one of the following locations:

  • Amazon S3
  • Rackspace Cloud Files

 

Input Name Description Example Value
Database Schema Name The database name/schema of the MySQL dump file.

text:  my_schema

 

For the optional 'world' database mentioned above, use the value:

 

text: world

Dump Container

Enter the name of the Amazon S3 bucket or Rackspace Cloud Files container that contains the MySQL dump file to be installed on the instance.

text:  db-bucket

Database Schema Name

The database name/schema of the MySQL dump file.

text:  my_schema

 

For the optional 'world' database mentioned above, use the value:

 

text: world

Dump Prefix

The prefix name that will be used to create new database backups or locate a previous backup.

For example, if you are using an existing dump file called 'app_test-201109010029.gz' specify 'app_test' as the Dump Prefix. You can also enter the fullname of a dump file without the file extension. (e.g. app-test-201109010029)

text:  my_db_prefix

 

For the optional 'world' database mentioned above, use the value:

 

text: world_innodb.sql

Dump Storage Account ID

Used for authentication purposes when retrieving the database dump file from the specified Dump Container.

Required to retrieve a private object from the dump container.

cred:  AWS_ACCESS_KEY_ID

cred:  RACKSPACE_USERNAME

Dump Storage Account Provider

Select the Remote Object Store (ROS) provider where the database dump file is currently stored.

Select 'S3' for Amazon S3.
Select 'CloudFiles' for Rackspace Cloud Files.

text:  S3

text:  CloudFiles

Dump Storage Account Secret

Used for authentication purposes when retrieving the database dump file from the specified Dump Container.

Required to retrieve a private object from the dump container.

cred:  AWS_SECRET_ACCESS_KEY

cred:  RACKSPACE_AUTH_KEY

Retrieve Application Code

You can retrieve application code from one of the following locations:

  • Git - Git repository
  • SVN - SVN repository
  • ROS - Remote Object Storage. Either from an Amazon S3 bucket or a Rackspace Cloud Files container

 

Under the "REPO" input category, use the following input to specify where the application will be retrieved from.

Input Name Description Example Value

Repository Provider

Select which repository provider contains the application code.

  • Git (default)
  • SVN
  • Remote Object Store (ROS)

text:  repo_git
text:  repo_svn
text:  repo_ros

Git

Provide values for the following inputs if you are pulling application code from a Git repository.

Input Name Description Example Value
Repository URL

The url of the git repository that contains the application code. For a public repository, use the HTTP or Git Read-Only url. (e.g. git://github.com/username/repo_name.git)

Note: If you are retrieving code from a private repository, you must use the SSH url. (e.g. git@github.com:username/repo_name.git)

text:  git://github.com/username/repo_name.git

text:  git@github.com:username/repo_name.git

 

For the optional sample application mentioned above, use the value:

 

text: git://github.com/rs-services/rs_phpmysql_testapp.git

Repository Branch/Tag/Commit

The name of the repository branch, tag, or SHA.

text:  mybranch

 

For the optional sample application mentioned above, use the value:

 

text: master

SSH Key

Used for authentication purposes when retrieving the files from the specified repository. To retrieve code from a public repository, set to 'Ignore'.

Required to retrieve files from a private GitHub repository.

It's recommended that you create and use a credential for the key. (e.g. GIT_SSH_KEY)

cred:  GIT_SSH_KEY

 

For the optional sample application mentioned above, use the value:

 

No Value/Ignore

SVN

Provide values for the following inputs if you are pulling application code from a Git repository.

Input Name Description Example Value
Repository URL

The url of the svn repository that contains the application code. For a public repository, use the HTTP or Git Read-Only url. (e.g. http://mysvn.net/app/)

text:  http://mysvn.net/app/
SVN password

The password of a user with access an SVN repository.

Used for authentication purposes when retrieving the files from the specified repository.

cred:  SVN_PASSWORD
SVN username

The username of a user with access an SVN repository.

Used for authentication purposes when retrieving the files from the specified repository.

cred:  SVN_USERNAME
ROS

Provide values for the following inputs if you are pulling application code from ROS. (e.g. Amazon S3 or Rackspace Cloud Files)

Input Name Description Example Value
ROS Container

Enter the name of the Amazon S3 bucket or Rackspace Cloud Files container that contains the tarball of the application code that will be installed on the instance.

text:  my-app-bucket

ROS Prefix

The prefix name that will be used to locate the application tarball. Only zipped tarballs are supported. (*.tgz)

For example, if you are using an existing dump file called 'php_unified.tgz' specify 'php_unified' as the ROS Prefix. Do not include the file extension.

text:  my_app_prefix

ROS Storage Account ID

Used for authentication purposes when retrieving the application tarball from the specified ROS Container.

Required to retrieve a private object from the ROS Container.

cred:  AWS_ACCESS_KEY_ID

cred:  RACKSPACE_USERNAME

ROS Storage Account Provider

Select the Remote Object Store (ROS) provider where the application tarball is currently stored.

Select 'S3' for Amazon S3.
Select 'CloudFiles' for Rackspace Cloud Files.

text:  S3
text:  Cloud Files
ROS Storage Account Secret

Used for authentication purposes when retrieving the application tarball from the specified ROS Container.

Required to retrieve a private object from the ROS Container.

cred:  AWS_SECRET_ACCESS_KEY

cred:  RACKSPACE_AUTH_KEY

 

When you are finished defining the inputs, click Save.

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. Go back to the Servers tab and click the server's Launch button.

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

Post Tutorial Steps

Test the Server

After the server enters the operational state, you can test it to ensure that it was properly configured. To test your server, go to the server's Info tab. You can either copy and paste the server's public IP address into a web browser or click the public DNS name or IP address link (if available).

  • For an Amazon EC2 server, click the "Public DNS name" link (see below)
  • For servers launched in other clouds, use the "(Public) IP Address"

 

screen-ServerOperational-v1.png

When you navigate to your running LAMP server in a web browser, you will see your application's default page. 

Troubleshooting 
If the server is operaional but you cannot view the test page in a browser window, make sure your server's security group has port 80 open. 

 

You should also click on the server's Monitoring tab to view real-time monitoring graphs and check out the detailed server information under the Audit Entries tabs.

Terminate the Server

When you finish testing, click Terminate to terminate the server.

You must to post a comment.
Last modified
14:51, 4 Oct 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.