Getting Started

From $1

1250329335_starthere.png

This page will guide you through the steps required to start scaling your website using Scalr.

This page will guide you through the steps required to set up your website to run.

You may want to refer to the What is... section of this wiki if there are terms you do not understand. For help on specific tasks, refer to the How to... section.

Getting an AWS account

See here.

Installing Scalr

The first step is getting a working copy of Scalr. You may either download the source code and follow these installation instructions, or use the service at Scalr.net. Scalr is available as a pre-packaged image on EC2, too.

Creating infrastructure

Scalr diagram.png

Creating a Server Farm

1250329399_Startup Wizard.png

Lets start out by creating your infrastructure. We'll create a Server Farm by selecting components from a list of Roles (i.e. application or database). Each of these Roles is a machine image which will be used for creating virtual servers named Instances. When you launch a Server Farm, servers are created from the image components you chose.

Select 'Add New' from 'Server Farms' in the top menu to create a new Server Farm.

First, choose where you want to run your servers. Locations currently include Europe (Ireland), US East (N. Virginia) or US West (N. California), and Asia (Singapore). The closer to your users, the lower the latency and higher the responsiveness.

Then, choose the components you want in your architecture (apache, mysql, nginx, memcache, etc) as well as the services you want to consume (like Amazon RDS), then name your farm.

You can configure settings for each Role using the tabs found to the right. Use this to define which algorithms Scalr should use to scale the Role, which availability zone to use, and more. To change those settings later on, go to 'Server Farms' and click 'View all', then from the option drop-down, choose 'Edit'. You can find a more detailed overview at Farm Settings.

Now you can launch the farm, and the load balancer (nginx) will be auto-configured to forward traffic to instances of your application role (tomcat, apache, rails).

Setting DNS and Virtual Hosts

Once you have your Server Farm running, you can direct traffic to it by setting up DNS and virtual hosts (vhosts) found under 'Websites' in the top menu. You can have any number of Websites per Farm - simply create the required vhosts files and DNS entries, and point them to it. wiki.example.com and mail.example.com can both run on MyFarm if you create the subdomains in Scalr, and set the directories for each in the vhosts configuration.

Go to 'Websites' in the top menu, then 'DNS Zones' and click 'Add new'. If you don't have your domain's nameservers pointing to ns1.scalr.net through ns4.scalr.net, let Scalr generate a subdomain of scalr.ws for you. Then choose the Farm you want that domain to point to, and specify which Role (in most cases, choose the load balancer Role). Click 'Next', and you can then add individual DNS records to the DNS Zone to be created.

To host more than one website on your application Role, use the virtual host configuration interface found under 'Websites' and 'Apache Virtual Hosts', and clicking 'Add new'. There you can set the domain to use, the Farm to host it on, whether to use ssl for https or not, and other settings like the directory to serve and where to store logs.

Uploading your site and database

Now you have a Farm that scales out and in, is redundant, and brings you coffee1250329740_package.png, but doesn't yet do anything for your Website.

To load your software on a Farm, select the adequate Role (most likely an 'app' role like app-apache) and choose an Instance from the list. SSH into that Instance by clicking the little black terminal icon (you can also download the private key from Farm->Options, and use your own terminal). Make all the changes you would like and when you are done, choose 'Create server snapshot' in the dropdown menu corresponding to the Instance you just modified. You will get a prompt to rename the Role; think of this as the 'Save as' you would find in word editors.

If you need to upload files via FTP, execute the FTP Install script on a server to enable access.

To configure your database, or any other role, just do the same, or if you prefer a web-based tool, click 'MySQL Status' in your Farm's options drop-down, and click 'Launch PHPMyAdmin'.

Using Scripts

1250330772_quick_restart.png

Scripts are cool! You can execute commands via scripts on instances, or have them triggered on certain events, or even triggered periodically to replace cron jobs!

To have scripts triggered in certain events, go to your Farms View, click Edit in Options for the right Farm, then select the Role on which you would like Events to trigger Scripts. One of the tabs on the side shows 'Scripting' and allows you to select from a list of Events, and Scripts. You can find more details on Scripting here.

Keeping up to date

We recommend you sign up on the scalr-discuss discussion list. It is used to discuss features and enhancements, provide feedback, and report bugs.

Please follow the Scalr twitter account as well for important announcements and status updates.

And if you like Scalr, please consider becoming a fan :-)

Tags: