This tutorial will introduce you to some of the key concepts behind the RightScale platform and also show you how easy it is to deploy your Rails application on EC2. Use the RightScale Dashboard to set up, customize, and monitor all of your AWS activities.
This tutorial can be completed with any type of account (Free Trial, Developer, Premium).
If you are using a free trial account, you must activate it by clicking on the link that was emailed to you from notifier@my.rightscale.com. (It might be hiding in your bulk/spam folder.)
You will notice that some of our Help screens automatically appear by default. If you wish to hide the help screens, simply click the Hide Help button.
.gif?size=webview)
Go to Design -> ServerTemplates.
ServerTemplates consist of a base image that contain a light-weight Linux installation (in this case, CentOS ) and some scripts that help customize the image's configuration. In this tutorial you will use one of our Rails all-in-one ServerTemplates to launch a server on EC2 for hosting both your Rails application and MySQL database.
RightScale provides two types of Rails all-in-one ServerTemplates. (Design -> ServerTemplates -> RightScale tab)
Remember how difficult it was to launch a server the traditional way?
Sound familiar? Now, with cloud computing, you can dynamically launch virtual servers with the click of a button!
RightScale created ServerTemplates to help automate this whole process. It provides a very flexible way of configuring servers without ever touching a piece of hardware. It also guarantees a consistent configuration across all servers, including new servers that are added your deployment.
Each ServerTemplate can also be cloned and modified for all types of custom configurations.
First, let's see how easy it is to launch a server using a ServerTemplate. Then we'll show you how easy it is to customize a ServerTemplate for your own purposes.
Believe it or not, you can literally launch a new instance on EC2 with RightScale in a just a few minutes.
Go to Design -> ServerTemplates. Click on the RightScale tab.
You will see a list of publicly available ServerTemplates from RightScale. Use the "Filter by Nickname" tool to find the most recent version of the "Rails all-in-one-trial" ServerTemplate. Click the Launch button to launch a server using the "Rails all-in-one-trial" ServerTemplate.

Provide a nickname for your server and select the appropriate SSH key and Security Group and click the Launch button.

Next you will see a list of the predefined input parameters for the server.
Whenever you launch an instance, you'll have the option to change any of the input parameters that are being inherited from the ServerTemplate itself (or from the deployment level) before the server is launched. If one of the required input parameters is missing, it will be highlighted in pink.
Fortunately, the "trial" template has already been preconfigured with all the required inputs. Simply click the Launch button.
Congratulations! You just configured and launched a server on Amazon's EC2 using one of RightScale's ServerTemplates. Of course, you will have to wait a couple of minutes for the server to boot and become fully operational, but it's really that easy!
Troubleshooting
If you receive an error message saying that "Your account has insufficient funding to perform this action," you first need to activate your account. Check your email for a message from notifier@my.rightscale.com and click on the link to validate your email and start your trial account.
Sounds too good to be true? Let's preview the Rails server in a browser window. Click on the nickname link (ex: Dean's Rails Server) to view more detailed information about the new server.
Click the Public DNS name link to preview your Rails application.

Next, a browser window will open of your new Rails server.

Don't forget to terminate your instance! (Manage -> Servers)
First, you must create a gzipped dump of your MySQL database. The MySQL dump filename must follow the specified format: 'prefix-timestamp.gz' where 'prefix' = DB_MYSQLDUMP_PREFIX input (which you will define later in this tutorial). Ex: myapp_prod_dump-20080416234.gz
If you do not have an application or database, you can use the following sample files.
If you are creating a dump of your own database, it's important that the dump file is created correctly. We suggest using the following commands to ensure that it is created in the proper format and has a proper name. Simply fill in your username, password, and schema name and execute these commands. A dump will be created in your /tmp directory.
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
Now that you've seen how easy it is to launch a server using a ServerTemplate, the next step is to show you how easy it is to modify a ServerTemplate for your own custom configuration.
Go back to Design -> ServerTemplates -> RightScale tab and select the latest version of the Rails all-in-one-developer template.

Since it's easier to clone and modify an existing ServerTemplate than creating one from scratch, the Dashboard allows you to clone ServerTemplates and RightScripts. The ability to clone templates and scripts is very powerful tool for modifying and reusing components to save time and effort when deploying your application.
Click the template's Clone button to create an editable copy of the template, which will appear under your Private tab.
You can now edit the template's scripts, input parameters, etc. Let's define some common input parameters for your ServerTemplate. Click the Inputs tab and click the Edit link.
NOTE: If you do not have a Rails application, you can use our sample files attached below.
The following input parameters are required to launch a server with this ServerTemplate. Modify them accordingly:
| APPLICATION | Text | Provide the name of your Rails application. (ex: rails_photo_site) |
| DB_BINLOG_PREFIX | Text | Provide the a prefix that will be used for the bin log file. (ex: /mnt/mysql-binlogs) |
| DB_MYSQLDUMP_BUCKET | Provide the name of your S3 bucket that will store backups of the database. (ex: http://s3.amazonaws.com/my_bucket/rails/) | |
| DB_MYSQLDUMP_PREFIX | Text | Provide the prefix that will be used to name your backup MySQL dump files to your S3 bucket. It's important that the prefix matches the name of the backup of your dump. For example, if you're using the sample dump file, 'dean_backup-200804161345.gz,' the correct prefix would be 'dean_backup.' |
| DB_SCHEMA_NAME | Text | Provide the schema name of your database. (ex: photo_demo_production) |
| DB_SERVER_USAGE | Select | "text: shared" - Since this is an "all-in-one" server you must set this value to "shared" otherwise it will become a dedicated DB server. |
| OPT_SVN_CHECKOUT_MODE | Select | "text: checkout" - Ideal for development purposes where you can edit the files on the server and check them back in to your repository. |
| SVN_APP_REPOSITORY | Text | You must provide the URL to the SVN repository that contains your application code. (ex: http://svn.mysite.com/projects/rails/rel-0.7.3) |
Click Save.
As a best practice, you should always create a static revision of a ServerTemplate by committing the template whenever you make changes to a template's scripts or inputs. If you launch servers with the [HEAD] version of a ServerTemplate, its scripts and inputs could change over time and possibly result in a stranded server the next time a new server is launched with the template.
Click the Commit button. When you commit a template or script, you can provide a brief description of your changes.

You are now ready to launch the server. Select the [rev1] version of the template and click the Launch button.

Confirm that you want to launch a new server and verify your input parameters. If you change an input at this point, it will only take effect on this particular server. Keep the settings and click the Launch button.
Provide a nickname for your server and select the appropriate SSH key and Security Group and click the Launch button.

Next you will see a list of the input parameters that you just defined in the template.
Remember, whenever you launch an instance, you'll have the option to change any of the input parameters that are being inherited from the ServerTemplate itself (or from the deployment level) before the server is launched. If one of the required input parameters is missing, it will be highlighted in pink.
Congratulations! You just customized a ServerTemplate and launched a new Rails server on Amazon's EC2. In a couple of minutes you will have a fully operational server on EC2 running your own Rails application!

To view your Rails application in a browser window, click on the server's nickname link and then click the server's Public DNS name link under the Info tab.

----------------------
Did you find this document helpful? Please feel free to leave us a comment below. We're always looking for ways to improve our documentation. Thanks!
| File | Size | Date | Attached by | |||
|---|---|---|---|---|---|---|
| dean_backup-200804161345.gz No description | 781 bytes | 22:17, 31 Dec 2008 | deano | Actions | ||