To execute a shared (partner) Macro that builds out the foundation for an end-to-end (E2E) Deployment for a gaming (or similar) application. Once running, perform several practical operational tasks against the Deployment.
Table of Contents
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.
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.
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:
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.
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.
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.
To verify, navigate to Manage -> Deployments -> View Dashboard -> GamingDeployment You should see:
Troubleshooting tip: The most common error is getting the DME user and/or password incorrect. Make sure your RightScale credentials are correct as well.
You will need to configure several mandatory Inputs before launching the Servers. You will set these at the Deployment level.
Those interested in seeing what the macro looks like and the type of tasks the Gaming Macro is executing can:
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.
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.
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.
Reminder: If you are going to install the sample phpBB application, you should skip this section. (Proceed to Sample Bulletin Board application.)
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.
# 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\''@'\''%'\'' IDENTIFIED BY '\'$DBAPPLICATION_PASSWORD\'' ;' | mysql -u root echo 'GRANT ALL PRIVILEGES on *.* TO '\'$DBAPPLICATION_USER\''@'\''localhost'\'' IDENTIFIED BY '\'$DBAPPLICATION_PASSWORD\'' ;' | mysql -u root echo 'REVOKE SUPER on *.* FROM '\'$DBAPPLICATION_USER\''@'\''%'\'' 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
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.
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.)
#!/bin/bash -ex app_dir=/home/webapps/$APPLICATION/current # Create PHP configuration file, set permissions, then take phpBB out of "install mode". cat <<EOF> $app_dir/config.php <?php \$dbms = 'mysql'; \$dbhost = "$MASTER_DB_DNSNAME"; \$dbname = "$DB_SCHEMA_NAME"; \$dbuser = "$DBAPPLICATION_USER"; \$dbpasswd = "$DBAPPLICATION_PASSWORD"; \$table_prefix = 'phpbb_'; define('PHPBB_INSTALLED', true); \$acm_type = 'file'; ?> EOF cd $app_dir chown -R apache:root cache files store config.php images/avatars/upload/ rm -fr $app_dir/install
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.
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.
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:
*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 (http://memcached.org/) 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:
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.
© 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.