Note: Please go to to access the current RightScale documentation set. Also, feel free to Chat with us!
Home > ServerTemplates > Archive > 11H1 > Tutorials > E2E Gaming Deployment Setup

E2E Gaming Deployment Setup


  • Firefox browser (for when you actually run the macro)
  • Your RightScale account must have a Gaming Solution Pack to view this macro.  If you do not have access to such an account, see your account manager for an evaluation or for upgrade options. 
  • A DNS Made Easy (DME) account.  You will need to know the user name and password of this account.
  • Familiarity with cloud concepts, RightScale terms and the RightScale Dashboard is assumed.  For example, not every step is shown in detail.  It is assumed that you already know what Deployments are, how to view them, launch or terminate Servers, etc.  If any steps are not clear to you, please consult additional tutorials for more information.
    • Although it's not mandatory, it is strongly recommended that those fairly new to the RightScale Dashboard view the RightScale Video Tutorials before performing this lab.  It covers the basic process, mechanics and important terms with respect to setting up a Deployment in the Dashboard.
  • A working Security Group (ports 22, 80 and 443 should be opened up)
  • EC2 SSH Key (w/ key material)

Note:  Remember the name of your Security Group and SSH Key, as the macro will prompt you for which ones you want to use later. You will select from a list of existing Security Groups and SSH Keys when the Macro is executed.

Phase I - Deployment Setup

In this phase you build out a fairly typical yet robust Deployment and configure several mandatory Inputs.  However, it does not configure your specific application.  In the next phase you will see how to "layer on" an example application, including an existing database.

Sign up and/or configure DNS Made Easy

Consult the Domain Setup with DNSMadeEasy tutorial to establish a master and slave database server with correct DDNS ID.  Make sure the following are established:

  • Advanced Settings (radio buttons)
  • A domain (e.g.
  • A Records for the master and slave servers (e.g. e2emaster and e2eslave)
  • DDNS ID's for the master and slave (Tip:  Select the DDNS ID link and write down the number for the master and slave. You will need it later.)
  • Note:  Although you could set up your front end Servers with Elastic IPs right now, you don't have to.  You must configure your Database Servers at this time however.  There is a procedure for Adding another Front End Server tutorial within the What Next section of this Tutorial.  It is also referenced on the Tutorial landing page in the Support Portal.  (Support Portal -> Tutorials -> E2E Gaming section)

Set up RightScale Credentials

You will need to create two Credentials in the Credential Store.  They are required in order for your application to reach (DNS) the master and slave database servers.  Further, because the Macro actually creates several Credentials on your behalf, you will need to make sure several Credentials do not already exist.

  • Log into the RightScale Dashboard
  • Navigate to Design -> Credentials.  Create the following Credentials (in accord with your DME user and password):
  • If any of the following Credentials already exist you will need to delete them.  If you neglect to delete them the macro will fail.

Run the Macro

Subscribe to the Macro

Reminder:  It is best to run this macro from a Firefox browser.  Other browsers have been known to have issues.  (This is being looked into.)

Before you can run the macro, you will need to get a copy from the RightScale MultiCloud Marketplace.

  • Navigate to Design -> MultiCloud Marketplace -> Macros
  • Search on "Gaming Macro"
  • Select the Gaming Macro link to drill down on additional details
  • Select the Subscribe action button.  The macro will be imported to your "local" view.  That is, you will be able to view, delete, run or clone the macro from Design -> Macro -> View Local.


Note:  Before the RightScale Component MultiCloud Marketplace changes in the April 2010 release, you use to import the macro.  (As shown in the diagram below.)  Now you will subscribe to the macro.  When subscribing to the macro, any changes that get pushed out by the publisher (RightScale in this case) will be immediately reflected in your local copy as well.  Subscribing provides a mechanism for immediate updates when newer versions are published.  You do however have the option to clone the macro and use that copy.

The Macro used to build out your Deployment with all Servers, Credentials, Inputs, etc. should now be in your local MultiCloud Marketplace and ready for use.  The following diagram shows the basic sequence of events along with a logical view of what can be built in your Deployment when you import and run the E2E Gaming Macro.  


Run the Macro
  • Navigate to Design -> Macro -> View Local
  • Select the Run action button for the Gaming Macro
    • Select the appropriate Security Group and SSH Key from the drop down list
      • Optionally, you can save these settings so on future runs of the macro you do not need to specify them.
    • You will be prompted if you want to create Database Credentials or not.  Answer OK (yes) if this is your first run of the macro.
    • You will be prompted for the type of application you will run.  Answer php, tomcat or rails.
      • Note:  Later in this tutorial you are given the option of configuring your own application, or a sample Bulletin Board application.  If you are going to use the Bulletin Board application, you should answer "php" here.
    • You will be prompted for a nickname for the new Deployment.  Enter something descriptive.
  • A dialog box will show you the progress as the macro executes
    • Credentials are created
    • Various prompts such as a Nickname for your new Deployment (e.g. E2E Gaming, or phpBB, MacroDeployment, ...)
    • Deployment is created
    • Servers are created
    • Server Arrays are created...
    • Success!  All courtesy of the Gaming Macro which uses our RightScale API.  Click the OK button to continue.


To verify, navigate to Manage -> Deployments -> View Dashboard -> GamingDeployment  You should see:

  • 6 Front End (FE) Servers (Two for each Cloud region)
    • 2 FEs in AWS EU-West
    • 2 FEs in AWS US-East
    • 2 FEs in AWS US-West
  • 1 Master Database Server (in AWS US-East)
  • 2 Slave Database Servers (in AWS US-East)
  • 1 Memcached Server
  • 3 Server Arays
    • 1 in US-East
    • 1 in US-West
    • 1 in EU-West


Troubleshooting tip:  The most common error is getting the DME user and/or password incorrect.  Make sure your RightScale credentials are correct as well.

Configure Inputs and Launch Servers

You will need to configure several mandatory Inputs before launching the Servers. You will set these at the Deployment level.

  • Navigate to Manage -> Deployments -> GamingDeployment -> Inputs Tab
  • Select the Edit action button beneath the Inputs tab and set the following Input values:
    • MASTER_DB_DNSNAME - Master database DNS name.  Fully qualified hostname in accord with what you set up in your DNS Made Easy account (FQHN such as
    • MASTER_DB_DNSID - DDNS ID from DME master A Record (For example, change from the macro default of 11111 to 5071234)
    • SLAVE_DB_DNSID - DDNSID from DME slave A Record (For example, change from the macro default 11112 to 5071235)
    • PRIVATE_SSH_KEY - Select your EC2 SSH Key from drop down menu
    • LB_HOSTNAME - Set this to the fully qualified hostname of your front end servers.  For example:
    • Click the Save action button beneath the Inputs tab when ready
  • Before you can do anything "custom" in nature with your front end Server (such as add RightScripts or configure Alerts) you will have to clone it.  Although you won't have to customize things right away, now is a good time to get this out of the way, because you have not launched them yet.
    • Clone the ServerTemplate that your front end Servers use.  (Remember to name it descriptively, perhaps using the word "clone" in it.)
    • Select/edit the front end Server to be used in your Deployment.  Change the ServerTemplate to the new cloned copy.  Be sure to do this for both of your FEs (e.g. FE1 and FE2)
  • Assign an EIP to the Front End Servers
    • Note:  If you don't have your FE EIPs yet, create them now.  Use the Create Elastic IPs tutorial as a guideline if needed.  Be sure to update the A Records for your front ends in your DNS Made Easy account.  For example, both "www" A records should reference your two EIPs.
    • Navigate to the Front End Server, Info Tab, and select the Edit action button.
      • Scroll down to the 'Elastic IP' and select the correct EIP (you assigned this in the DNS Made Easy tutorial earlier). 
      • Check the box labeled 'Associate IP at Launch?"
    • Save the new configuration.  Repeat this process for the other FE Server.
  • You may want to launch Servers just to make sure they can become operational.  As typical with multi Server Deployments, launch the Servers in the following order:
    • Master Database Server (make sure INIT_SLAVE_AT_BOOT = false)
    • Application Server (FE Server)
    • Memcached Server (if used by your application)
    • Do not launch the Slave Database Server (it does not have a snapshot to load yet and hence will strand)
  • Note:  The Macro creates a front end servers and Server Arrays for different AWS clouds:  US-East, US-West and EU-West.  If you are going to setup your Deployment in one region, you are free to delete the FEs and Server Arrays in the other regions.  Basically, you can remove what you will never use... resulting in less clutter in your Deployment.  The same goes for memcached.  If your application does not use memcached, you are free to remove the memcached Server.  (Our sample blog application does not use memcached.)
View Macro (optional)

Those interested in seeing what the macro looks like and the type of tasks the Gaming Macro is executing can:

  • Navigate to Design -> Macros -> View Local
  • Select the Gaming Macro link
  • View the Commands tab

Even those who are not well versed in JavaScript will be able to recognize the majority of what is taking place, and how the macro uses our RightScale API to accomplish its tasks.  For example, the necessary Credentials get created, along with the Deployment and its Servers (based on specified ServerTemplates).  Finally, the Server Arrays are created.  This is all in accord with what you view in the Dashboard, and is displayed in the dialog window when you execute the Macro.  One of the convenient and powerful things with RightScale Macros is you are free to create your own from scratch, create them from within the Dashboard, or subscribe, clone and modify existing macros.

Phase II - Customizing for your Application

In this phase you configure your Deployment for your specific application or a sample bulletin board application.  Because all applications are different and we don't possess the expertise with your application, there is no way we can provide specific steps to accomplish every task.  Therefore, we provide two options within this phase.  You should select one or the other to get your Deployment up and running with a functioning application.

  1. Configure your own application - General instructions that help guide you through what you would have to do to get your application running on the E2E Deployment
  2. Sample bulletin board application - A sample PHP bulletin board application (open source phpBB)


Important Installation/Configuration Note:  In the sample blog application instructions, you will complete some initial setup followed by a series of steps to automate the installation at boot time.  This is an important step for automating the server launch, and is required before you can move on to Phase III – Server Array Setup.  If you choose to install your own application, you must script out the required manual steps and attach the RightScript to your ServerTemplate.

Configure your own application (option #1)

Reminder:  If you are going to install the sample phpBB application, you should skip this section.  (Proceed to Sample Bulletin Board application.)

  1. Begin by removing the application Servers and Arrays that are not needed for your environment.  For example, if you have a PHP application, you would remove the Rails and Tomcat Front-end Servers, as well as their respective Server Arrays.
  2. Start the “Master DB” Server.  When it becomes operational run the “DB EBS restore and become master v1" Operational RightScript.  This will restore an empty database.
  3. Import your database
  4. Run “DB EBS backup“ on the “Master DB” server
  5. Start the “Slave DB” Server
  6. Set the SVN_APP_REPOSITORY Input appropriately (or APPLICATION_CODE_BUCKET and APPLICATION_CODE_PACKAGE depending on the location of your code)
  7. Start up your Front-end Server

Sample Bulletin Board application (option #2)

Reminder:  If you already installed your own application (previous section), then you should skip this section.

There are two primary tasks when configuring your Deployment to support an application. The first is the initial setup.  This is where you install the application, configure it, and either create or restore the database.  The initial setup is performed just one time.  From there, the goal is to automate the procedure so that each time an application Server is booted the application is ready to use.  Automation via RightScale ServerTemplates and built in best practices is a huge value-add with respect to deploying in the Cloud.

Initial setup
  • Change the Input so that we know where to find the phpBB application
  • Once the FE is operational , you will need to set permissions and ownership on the appropriate files and directories.  SSH into it and run the following commands:
# cd /home/webapps/gaming/current
# chown -R apache:root cache files store config.php images/avatars/upload/

Tip:  If the chown command fails, it is likely due to the SVN Repository.  It was either unaccessible or the Input value was entered incorrectly. 

  • Restore the Master database

    • On the Master database, run the "DB EBS restore and become master v1" Operational RightScript

    • Follow progress from the Events and/or Audit Entries.  (This operation will take ~1-2 minutes)

  • Create a new RightScript called "Set Application Permissions" (or similar) that will set the application permissions for your database.  Use the following for the body of your RightScript:

#!/bin/bash -e
# Copyright (c) 2007 by RightScale Inc., all rights reserved

#You will be prompted for the DBAPPLICATION_USER and DBAPPLICATION_PASSWORD when you launch.
# Enable remote administration
echo 'GRANT ALL PRIVILEGES on *.* TO '\'$DBAPPLICATION_USER\''@'\''localhost'\'' IDENTIFIED BY '\'$DBAPPLICATION_PASSWORD\'' ;' | mysql -u root
echo 'REVOKE SUPER on *.* FROM '\'$DBAPPLICATION_USER\''@'\''localhost'\'' IDENTIFIED BY '\'$DBAPPLICATION_PASSWORD\'' ;' | mysql -u root
echo "FLUSH PRIVILEGES;" | mysql -u root
  • Run the "Set Application Permissions" RightScript on your Master Database Server.
    • Use the Run "Any Script" drop down menu to select your new RightScript.
    • You will be prompted for the DBAPPLICATION_USER and DBAPPLICATION_PASSWORD.  Change the Input type to  "cred" and select them from your Credentials drop down menu.  (Recall that they were created for you when running the Gaming macro.)
  • Now you are ready to install and configure the phpBB application.  Go to the public facing URL of your Front-end in your browser.
    • Select the Install tab.
      • Install - Select the Proceed to next step action button
      • Requirements - Leave default settings.  Select the Start install action button.
      • Database settings - This is the most important of all forms. See fields (and screen shot below).
        • DSN  - Your database hostname with your FQHN  (e.g.
        • Db Server Port - Leave blank
        • Database name - The name of our example database is "gaming_example"
        • Database username - app_user (Note:  This is case sensitive)
        • Database password - If you don't recall what this is, you will have to get it from the Dashboard.
          • Design -> Credentials -> View all
          • Select the DBAPPLICATION_PASSWORD link
            • Show value -> enter your password
            • Copy and paste into the correct field in the phpBB installation form
            • Hide value
        • Db prefix - Leave at default (phpbb_)
          • Select the Proceed to the next step action button
          • Tip: If you don't connect to the database correctly, you will receive an error.  Check your settings again closely.  If it continues to fail to connect, you may have permuted your DBAPPLICATION_USER and DBAPPLICATION_PASSWORD credentials.  Try re-running the "Set Application Permissions" RightScript again, then retrying your database connection.

      • Administrator Details - Fill out the user (e.g. administrator), password (e.g. administrator) and email address.  When the installation of phpBB is successful, you will receive a congratulations email at this address.  Select the Proceed to next step action button when ready.
      • Configuration file through Final Stage - Simply select the Proceed to next step action button for each of the remaining screens.

 screen-phpBB Install DB Settings.png

  • If all went correctly, phpBB should be running.  In your browser, selecting the Login action button should show you an operational phpBB bulletin board application running on your Deployment.  Congratulations!
  • Once completed with all install forms, you will need to take the phpBB application out of "install mode".  Remove the install directory.  From an SSH window on your Front-end, from the /home/webapps/gaming/current directory:
rm -fr install/

Now that you have the initial setup completed, you are ready to automate the process.  In this step you will place all the manual steps in a new RightScript.  The new RightScript will be attached to the boot phase of your cloned ServerTemplate.  That way, each time an application Server is booted it will be ready for use.  (Its important to note this applies to all application Servers, whether they are front ends, or part of an autoscaling Server Array.)

Create RightScript
  • Navigate to Design -> RightScripts  and select the New action button
  • Name your RightScript.  Use something descriptive, for example:  "Configure phpBB"
  • Either create your RightScript or if using the phpBB example, copy and paste in the following code snippet:
#!/bin/bash -ex

# Create PHP configuration file, set permissions, then take phpBB out of "install mode".

cat <<EOF> $app_dir/config.php 
\$dbms = 'mysql';
\$dbhost = "$MASTER_DB_DNSNAME";
\$dbname = "$DB_SCHEMA_NAME";
\$table_prefix = 'phpbb_';
define('PHPBB_INSTALLED', true);
\$acm_type = 'file';

cd $app_dir
chown -R apache:root cache files store config.php images/avatars/upload/

rm -fr $app_dir/install
  • Click Identify to have the dashboard identify the required Inputs
  • Select the Save action button when ready
Add your new RightScript to the ServerTemplates
  • Browse to your Deployment and select the FrontEnd ServerTemplate
  • Click the Scripts tab and then click "Add Script" in the "Boot Scripts" section.
    • Choose "Private" and then scroll or search for your script and choose "Select"
    • Drag the RightScript to the appropriate location.  Generally speaking, for an application/FE Server you will locate custom install/configuration scripts towards the bottom.  After the bulk of the basics are installed, and before you start Apache.  In our example, place "Configure phpBB" immediately before WEB Apache (re)start.
  • Although  you don't configure your Server Array for use until Phase III of this end-to-end tutorial, you should repeat these steps on your application ServerTemplate now.  (That way, later on when you scale your Server Array the application is also ready for use.)


The final step is to launch the Servers.  With the new RightScript attached as a boot script, the server will configure your application and is now ready to be run on an individual Server or in a Server Array.

Important!  Once you have finished any troubleshooting and you are FE Servers are operational, you will need to run the "LB app to HA proxy connect v3" operational RightScript on each of your FE Servers.  This will add them to the HAProxy load balancing pool.

Of course, there are more things you could do with your Deployment.  Phase III has additional pointers for setting up a Server Array (if needed).  The What Next section also refers to common operational tasks you should become familiar with.

Boot the Slave Server

With two Front-end Servers running your application (or our example phpBB app) and the Master database Server, you are ready to boot the Slave Server. 

  • Select your Slave DB Server's launch action icon
    • The Inputs should already be setup, but it's always worth making sure that a Slave Server has INIT_SLAVE_AT_BOOT = TRUE, which tells the Server that it should initialize as a "slave" during the boot up sequence. 
    • Another healthy exercise at this time is once your Slave becomes operational, take a few minutes to look over the Audit Entries logged during the boot sequence.  It will give you a good understanding of all that steps that are involved.  (Of course, you are free to do this anytime, with any Server.)
    • Once operational, you can verity that snapshots are being taken.
      • Manage -> Deployments -> GamingDeployment
      • Select your Slave DB Server -> Volumes tab
      • Over time you will see both Master and Slave database backups

Phase III - Server Array Setup

You should be ready to setup your Server Array.  Depending on the exact operational status of your Deployment, you may need to perform a few basic steps prior to setting up your Array.  Most notably, if the ServerTemplate used for your front end Servers was never cloned, you will not be able to create a new Alert for that ServerTemplate.  A summary of the steps you will need to follow in order to set the right context for the Autoscaling tutorial links below are:

  1. IFF you have not yet cloned your ServerTemplate (as instructed prior to launching your FE Server in Phase I of this lab), you will need to do so now.  This is because creating Alerts is custom in nature, hence cannot be performed on the original ServerTemplate.  You need a cloned copy.
    1. Terminate your front end Servers (if they are running)
    2. Clone the ServerTemplate that your front end Servers use.  (Remember to name it descriptively, perhaps using the word "clone" in it.)
    3. Select/edit both front end Servers in your Deployment.  Change their ServerTemplate to the new cloned copy.
  2. Setup Alerts*
    1. Create Alert Escalations
    2. Connect Alerts to your FE ServerTemplate
    3. Connect Alerts to your Server Array's ServerTemplate
  3. Launch your front end Servers (if they were terminated as part of step #1)
    1. Wait for them to go operational
    2. Once operational, manually run the "LB app to HA Proxy connect" RightScript on both FEs


*Note that the three Setup Alert steps are part of the larger How do I setup Autoscaling? tutorial.  The first part of that tutorial manually creates a Server Array.  If you ran the E2E Gaming macro that is an unnecessary step, in that the Server Array is created automatically for you.



The E2E Gaming Macro automatically creates a dedicated memcached Server.  Memcached ( is free open source caching application that speeds up dynamic websites.  It is basic in principle, and easy to setup/configure.  If your application already has hooks to use memcached, then you are ready to make use of it in your Deployment.  The phpBB application is not configured to use memcached so there is no need to boot this Server if you've setup the sample bulletin board application.  (Reminder:  You don't pay for non-operational Servers.)  To learn more about memcached, please consult their websiteand wiki.



If you want to rerun the Macro from scratch, you will need to perform a few clean up operations:

  • Terminate running Servers
  • Delete the following USER and PASSWORD Credentials:
    • DBREPL*
    • DBADMIN*
  • Delete the Server Arrays
  • Delete all Servers in your Deployment
  • Delete your E2E Gaming Deployment


What Next?

There are several things you could do with the Deployment in its current format.  You could work towards getting your own gaming application going for a staging or even production environment, or continue to use the E2E Gaming Deployment as a learning tool.  Either way, here are a few more ideas of what you could do next. 

Perform common operational tasks

You must to post a comment.
Last modified
21:20, 16 May 2013



This page has no classifications.



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