To create a new 3-tier Windows deployment using the RightScale Load Balancer with HAProxy, Microsoft IIS App Server and Database Manager for Microsoft SQL Server ServerTemplates on Microsoft Azure.
This deployment consists of the following three tiers:
Note: This tutorial works with the v13.1 infinity lineage of ServerTemplates. For more information about release terminology, see ServerTemplate Release and Lineage Methodology.
Table of Contents
Files are provided for both the database backup for SQL Server 2012 as well as the application file package that will be used in this document. Later in this tutorial you will need to provide the URLs to these files as input values – you can use the links below.
Create a new deployment that will contain all of the Windows servers.
Go to Manage > Deployments. Click New and provide the following information:
Now that you have a deployment, you can create your servers, starting with the load balancers.
Because you want to create two load balancer servers for redundancy purposes, clone the created server and rename it. (e.g. MyApp Load Balancer 2)
You now have two load balancer servers that have identical configurations.
Go to the deployment's Inputs tab and define values for the following missing inputs:
Input Name | Description | Example Value |
LB: Load Balance Pools | Enter the Fully Qualified Domain Name (FQDN) of the application that you will register in DNS for this web app. | text:myapp-www.domain.com |
Go to the deployment's Servers tab and launch both of the load balancer servers.
You must create three DNS A records: One for each load balancer and one for the SQL Server principal node. Log into your DNS account and follow the steps below.
Note: The following steps demonstrate this process using a DNS Made Easy account.
Important! The only difference between the two A Records created for the two load balancers is that each load balancer should be using a different IP address.
Now that you have a deployment, you can use the Database Manager for Microsoft SQL Server ServerTemplate to launch a SQL database server.
The next step is to provide values for any missing inputs at the deployment level. Some input parameters are inherited from the ServerTemplate, whereas some are left undefined because they are user-specific.
Go to the deployment's Inputs tab and click Edit. Although you technically only have to define inputs that are required to launch a database server, you might want to define values for some of the other missing inputs at the deployment level so that you can better manage and keep track of your settings. Also, if you define your inputs now, you will not need to provide any inputs later when you run any of the Operational Scripts.
You will need to create credentials for the following values:
Credential Name | Description |
---|---|
ADMIN_PASSWORD | Holds the password to be assigned to the local administrator account for Windows. The standard windows password complexity requirements apply. This password will be used when accessing the server via RDP. |
DNS_USER | User name for the DNS provider that you are using (DNS Made Easy, DYNDNS, Route 53, etc.) |
DNS_PASSWORD | Password for DNS_USER as defined above |
WAZ_STORAGE_ACCOUNT_ID | Corresponds to the ‘Storage Account Name’ as described below from the Microsoft Azure Portal |
WAZ_STORAGE_CONTAINER | Corresponds to the ‘Container Name’ as found in the Microsoft Azure portal per the information below |
WAZ_STORAGE_ACCOUNT_SECRET | Corresponds to either the primary or secondary access key as found in the Microsoft Azure portal per the information below |
SQL_SERVER_USER_NAME | SQL Authentication user name to be used to authenticate the web application to the SQL server |
SQL_SERVER_USER_PASSWORD | Password to be used when authenticating the SQL_SERVER_USER_NAME user to the SQL server (See suggestions for password strength) |
You will need to retrieve 3 pieces of information from your Microsoft Azure account to be able to access your storage account via RightScale: the storage account name associated with the storage account you’re using and either the primary or secondary access key associated with that storage account.
Within the preview portal, once you navigate to your storage containers, you’ll highlight one of the records and hit the ‘Manage Keys’ button at the bottom of the page—from this page you’ll create credentials for the Storage Account Name as well as one of the access keys (primary or secondary).
To get the storage container name, go into the detail view of the storage account and look at the ‘Containers’ tab – you’ll see a view that outlines the containers within your storage account. The value you want to use is the item that is not ‘vhds’—this is your default container and should be used for this tutorial.
NOTE: The Example Type/Value column can contain several types of values. 'Text' type entries can either have predefined values or manually entered input. Go to the Inputs tab of your Deployment, click Edit and define these missing inputs:
Input Name | Description | Example Type/Value |
---|---|---|
BACKUP_METHOD | Use this input to specify method of doing continuous database backups. 2 methods are currently supported--uploading backup files to remote storage such as S3/Cloud Files, or performing volume snapshots (on clouds supporting snapshots). Ex: Snapshots Note: Do not override the predefined values. | Text:Remote Storage |
Input Name | Description | Example Type/Value |
---|---|---|
AWS_ACCESS_KEY_ID | Not in use as Microsoft Azure Storage will be used for Mirroring and Backup, but this is a required input—put in any string to validate the input, a valid access key id is not necessary. | Text:any string |
AWS_SECRET_ACCESS_KEY | Not in use as Microsoft Azure Storage will be used for Mirroring and Backup, but this is a required input—put in any string to validate the input, a valid secret access key is not necessary. | Text:any string |
Input Name | Description | Example Type/Value |
---|---|---|
DATA_VOLUME_SIZE | Enter the size (in GB) for the volume that will be used to store the database file. By default, drive letter D:\ will be used for the data volume. To override this setting and use a different drive letter you can use the OPT_DATA_VOLUME_LETTER input. | Text: 30 |
DB_LINEAGE_NAME | The lineage of the database backups. A string that is used to track all backups in a certain 'set' usually deployment wide. | Text: mileagestats |
INIT_MIRRORING_METHOD | Method of data exchange between principal and mirror server to initialize mirroring session. 2 options are supported--via remote storage such as S3 or Cloud Files or via attaching/detaching volumes. Ex: Volumes | Text:Remote Storage |
LOGS_VOLUME_SIZE | Size of volume (in GB) for storing log files. Ex: 1 To optimize your Tempdb, this should be 1gb greater than your instance core count. | Text:10 |
Input Name | Description | Example Type/Value |
---|---|---|
DNS_DOMAIN_NAME | Enter the Fully Qualified Domain Name (FQDN) of the DNS record. | e.g. text: myapp-db.domain.com |
DNS_ID | Enter the DDNSID of the DNS record you created in a previous step. | 1234123 |
DNS_IP_ADDRESS | Choose whether to use 'public' or 'private' IP addresses for the DNS record. NOTE: Do not override the predefined values. | text:Private IP |
DNS_PASSWORD | Enter the password of your DNS account or select the appropriate credential. | Cred:DNS_PASSWORD |
DNS_SERVICE | Select one of the predefined DNS providers: DNS Made Easy or DynDNS. NOTE: Do not override the predefined values. | text: DNS Made Easy |
DNS_USER | Enter the user name of your DNS account or select the appropriate credential. | Cred:DNS_USER |
DNS_TTL | Enter the TTL of the DNS record. The default value is 60 seconds. | Text:60 |
Inpute Name | Description | Example Type/Value |
---|---|---|
REMOTE_STORAGE_ACCOUNT_ID | The Storage Account Name which is used to authenticate your requests to Remote Storage services. It's strongly recommended that you use a RightScale Credential (Design > Credentials) to hide the actual key value from non-admin users while still allowing them to pass the appropriate value as an input. | Cred:WAZ_STORAGE_ACCOUNT_ID |
REMOTE_STORAGE_ACCOUNT_PROVIDER | Name of Remote Storage provider. Amazon S3, Rackspace Cloud Files, Microsoft Azure Storage and Softlayer Object Storage are currently supported. Please select appropriate value from the dropdown. NOTE: Do not override the predefined values. | Text:Windows_Azure_Storage |
REMOTE_STORAGE_ACCOUNT_SECRET | The Account ID or Name of the Remote Storage account which is used to authenticate your requests to Remote Storage services. It's strongly recommended that you use a RightScale Credential (Design > Credentials) to hide the actual key value from non-admin users while still allowing them to pass the appropriate value as an input. | Cred:WAZ_STORAGE_ACCOUNT_SECRET |
REMOTE_STORAGE_CONTAINER | Name of Remote Storage container (S3 bucket name, Rackspace Cloud Files, Microsoft Azure Storage or SoftLayer Storage container to be used as storage for database initialization and backups, app server logs. | Cred:WAZ_STORAGE_CONTAINER |
Inpute Name | Description | Example Type/Value |
---|---|---|
ADMIN_PASSWORD | This holds the password to be assigned to the local administrator account for Windows. The standard windows password complexity requirements apply. This password will be used when accessing the server via RDP. You created a credential for this value earlier in the tutorial. | Cred: ADMIN_PASSWORD |
SYS_WINDOWS_TZINFO | Set the system time to a specific timezone. Some examples are provided in the dropdown, but can be overridden if the timezone is not listed. NOTE: Do not override the predefined values—select an existing time zone. If yours is unavailable, use ‘Pacific Standard Time’ for the purposes of this tutorial. | Text:Your Local Time Zone |
Click Save.
The next step is to import the database onto the instance by first downloading a backup (.bak) file to the server's local disk and then restoring it to the database from the downloaded file. You will need to select and run the appropriate operational script based on the chosen method.
Normally, you would download the .bak file using the PowerShell - Get File HTTP operational script but this script is not published yet. Use the PowerShell - Get File HTTP 'Any Script'—you will find it within the RightScale Open Source publishing account. This will save the .bak file locally, which can then be used to restore the database. The following table provides information for working with the backup file.
Name | Description | Input Values |
---|---|---|
DEST_FOLDER | The folder where to save the .bak file | text: c:\temp |
SRC_FILENAME | File name of the .bak file to be downloaded | text:mileagestatsdata_sql2012.bak |
SRC_FOLDER_URL | URL of the folder where the file is located |
Click continue.
Follow these instructions if you want to load the database by using a backup file (.bak).
Go to the server's Scripts tab and run the DB SQLS Restore database from local disk / Remote Storage (v13.1) operational script. You will need to provide values for the following inputs before running the script:
Input Name | Description | Example Value |
BACKUP_FILE_NAME | Enter the filename of the database backup file (.bak) that will be used to load the database. (e.g. mileagestatsdata_sql2012.bak) | text: mileagestatsdata_sql2012.bak |
BACKUP_LOCAL_DIR | This will be the folder where the .bak file was downloaded to. | text: c:\temp |
DB_NAME | The name of the default SQL Server database that will be created. (e.g. MileageStatsData) Note that this name should match the original database name the backup was taken from. | text: mileagestatsdata |
Input Name | Description | Example Value |
---|---|---|
REMOTE_STORAGE_ACCOUNT_ID | The Storage Account Name which is used to authenticate your requests to Remote Storage services. It's strongly recommended that you use a RightScale Credential (Design > Credentials) to hide the actual key value from non-admin users while still allowing them to pass the appropriate value as an input. | Cred:WAZ_STORAGE_ACCOUNT_ID |
REMOTE_STORAGE_ACCOUNT_PROVIDER | Name of Remote Storage provider. Amazon S3, Rackspace Cloud Files, Microsoft Azure Storage and Softlayer Object Storage are currently supported. Please select appropriate value from the dropdown. NOTE: Do not override the predefined values. | Text:Windows_Azure_Storage |
REMOTE_STORAGE_ACCOUNT_SECRET | The Account ID or Name of the Remote Storage account which is used to authenticate your requests to Remote Storage services. It's strongly recommended that you use a RightScale Credential (Design > Credentials) to hide the actual key value from non-admin users while still allowing them to pass the appropriate value as an input. | Cred:WAZ_STORAGE_ACCOUNT_SECRET |
REMOTE_STORAGE_BLOCK_SIZE_BYTES | Size of upload block in bytes (currently supported by Microsoft Azure Storage only). Default value is 33,554,432 bytes (32MB). Max value: 67,108,864 (64 Mb). | Text:33554432 |
REMOTE_STORAGE_CONTAINER | Name of Remote Storage container (S3 bucket name, Rackspace Cloud Files, Microsoft Azure Storage or SoftLayer Storage container to be used as storage for database initialization and backups, app server logs. | Cred:WAZ_STORAGE_CONTAINER |
REMOTE_STORAGE_THREAD_COUNT | Number of parallel threads to be used for file downloads and uploads (currently supported by Microsoft Azure Storage only). Default value is 2. Ex: 4 | Text:2 |
Click Continue.
Important! If you only want a standalone SQL database server your configuration is complete. However, if you want to set up a mirrored SQL configuration that contains a dedicated principal and mirror database server for high-availability purposes, please follow the remaining steps.
Input Name | Description | Example Value |
PRIVATE_KEY_PASSWORD | This is the password used to encrypt the certificate's private key. Although you can input this value as text, it's recommended that you create a credential for each certificate password. Although you can use the same password for each certificate, it's more secure if each certificate has its own unique password. Note: The password must meet the Microsoft SQL Server Strong Password requirements:
|
For the Principal Certificate cred: SQL_PRINCIPAL_PRIVATE_KEY_PASSWORD For the Mirror Certificate cred: SQL_MIRROR_PRIVATE_KEY_PASSWORD |
MASTER_KEY_PASSWORD | This password is used for the encryption of the master database key, which is used to protect other certificate keys in the database. This input allows you to set a master key password so that you are later able to decrypt and use the master key, if necessary. Note: It's strongly recommended that you use a credential to hide the actual key value from non-admin users while still allowing them to pass the appropriate value as an input. | cred: MY_MASTER_KEY_PASSWORD |
Note: Because your principal server is already operational, the inputs you modify at the deployment level will not affect the currently running principal server. The purpose of modifying these inputs is so your mirror will be able to interpret these inputs.
Note: If you want to create a witness server to monitor whether or not your principal and mirror servers stay connected, see the Database Manager for Microsoft SQL Server Witness - Beta ST - Tutorial.
Go to your deployment > Inputs. Click Edit and modify the following inputs:
Input Name | Description | Example Value |
PRINCIPAL_CERTIFICATE | This is the certificate to be used for authentication on the mirroring endpoint of the principal server. This input is required when launching a principal, mirror, or witness but not needed if you're launching a standalone SQL server. | Cred: SQL_PRINCIPAL_CERTIFICATE |
PRINCIPAL_PRIVATE_KEY_PASSWORD | Password to decrypt private key contained in PRINCIPAL_CERTIFICATE input. This input is required when launching principal, mirror or witness but not needed for Standalone SQL Server. This should be the same password which was used to generate and encode certificate and private key by 'DB SQLS Generate and Save a Certificate' RightScript. | Cred: SQL_PRINCIPAL_PRIVATE_KEY_PASSWORD |
MIRROR_CERTIFICATE | This is the certificate to be used for authentication on the mirroring endpoint of the mirror server. This input is required when launching a principal, mirror, or witness but not needed if you're launching a standalone SQL server. | Cred: SQL_MIRROR_CERTIFICATE |
MIRROR_PRIVATE_KEY_PASSWORD | Password to decrypt private key contained in MIRROR_CERTIFICATE input. This input is required when launching principal, mirror or witness but not needed for Standalone SQL Server. This sshould be the same password which was used to generate and encode certificate and private key by 'DB SQLS Generate and Save a Certificate' RightScript. | Cred: SQL_MIRROR_PRIVATE_KEY_PASSWORD |
The first step is to change the existing database server from "standalone" to "principal" mode.
Note: You will need to re-enter the information for the MIRROR_CERTIFICATE, MIRROR_PRIVATE_KEY_PASSWORD, PRINCIPAL_CERTIFICATE, and PRINCIPAL_PRIVATE_KEY_PASSWORD (see Modify Deployment Inputs). This is because the Deployment Level inputs that were modified in the previous step do not have an influence on operational servers.
Note: You will not see a 'completed: DNS SQLS Init Principal' audit entry on the principal server until there is a "mirror" server connected to it.
Next, launch a new server that will become a mirror of the principal server.
If you are setting up a synchronous mirrored SQL Server environment, you will need to launch another SQL database server that will act as a "mirror" of the "principal" server. Ignore this step if you are only setting up a stand-alone SQL Server environment.
Input Name | Description | Example Value |
SERVER_MODE | Since you already have a 'Principal' server running, set this input to 'Mirror'. | text: Mirror |
Go to the "primary" server's Scripts tab and run the DNS Register IP Operational Script.
Note: The inputs required to run this script have already been defined at the deployment level.
Create the SQL Server login username/password that will be used by the application servers to connect to the "primary" SQL database server. Run the DB SQLS Create login (v13.1) script and specify the following inputs:
Input Name | Description | Example Value |
DB_NAME | Enter the name of the database. | text: mileagestatsdata |
DB_REMOTE_SQL_LOGIN | (Optional) Enter the SQL Server login username with administrative rights to the remote SQL Server database server. | No value/Ignore |
DB_REMOTE_SQL_PASSWORD | (Optional) Enter SQL Server login password. You can enter a text:'password', but for best practices it would be best to create a credential with your password value and name it something like DB_LOGIN_PASSWORD. | No value/Ignore |
DB_NEW_LOGIN_NAME | Enter the login name for the new SQL Server user. You can enter a text:'password', but for best practices it would be best to create a credential with your password value and name it something like SQL_SERVER_USER_NAME. Important: This value needs to match the OPT_CONNECTION_STRING_DB_USER_ID defined later in this tutorial. To be properly configured, this DB value needs to match the IIS Server value (OPT). | cred:SQL_SERVER_USER_NAME |
DB_NEW_LOGIN_PASSWORD | Enter the login password for the new SQL Server user. You can enter a text:'password', but for best practices it would be best to create a credential with your password value and name it something like SQL_SERVER_USER_PASSWORD. Important: This value needs to match the OPT_CONNECTION_STRING_DB_USER_ID defined later in this tutorial. To be properly configured, this DB value needs to match the IIS Server value (OPT). Note: The password must meet the standard Windows server password requirements. The password should be at least 7 characters long with at least one upper case letter, one lower case letter, and one digit. | cred:SQL_SERVER_USER_PASSWORD |
The next step is to create and launch a server array consisting of Microsoft IIS Application Servers.
Go to the Deployment and click Add Array button.
Note: You may receive a warning that "Some of the Input parameters for boot scripts are missing. Please update them to launch instances successfully." This is OK, you will take care of the remaining inputs soon.
Now that you have created the server array, you need to configure it.
Under the server array's Next Alerts tab you will be able to add to the existing alert specifications that are being inherited by the array's application ServerTemplate. The next step is to add two new alert specifications that will be used for triggering auto-scaling. When you set up your own custom deployment, you will want to pick appropriate metrics and thresholds that make sense for auto-scaling your own application. But for this tutorial, you can use the suggested parameters below:
Condition: if "cpu-0/cpu-idle.value < '30' for 5 min then vote to grow array by setting the tag to be the name of your server array. We used '3tier'.
Go to the deployment's Inputs tab and edit values for the following missing inputs.
The required inputs will be different depending on whether you are downloading the application code from an URL or SVN repository or Remote Storage. In this tutorial, we are using a ZIP file attached to the tutorial itself (MileageStats.zip).
Input Name | Description | Example Type/Value |
---|---|---|
ZIP_URL | In this tutorial, you are using the sample app downloaded above. | MileageStats.zip |
(ADVANCED) OPT_APP_POOL_NAME | Name of the application pool to be used when hosting the IIS/ASP.net application | Text:ASP.NET v4.0 |
Input Name | Description | Example Type/Value |
---|---|---|
OPT_CONNECTION_STRING_DB_NAME | Name of the database for the application server to connect to. This is the database served by pair of SQL Server instances you configured earlier in this tutorial. | text: mileagestatsdata |
OPT_CONNECTION_STRING_DB_SERVER_ NAME | Fully qualified domain name of the database server you created earlier in this tutorial. | Example text: myapp-db.domain.com |
OPT_CONNECTION_STRING_DB_USER_ID | Login name to be used for database connections created earlier in this tutorial. Important: This value needs to match the DB_NEW_LOGIN_NAME defined earlier in this tutorial. To be properly configured, this IIS Server value needs to match the DB value. | cred: SQL_SERVER_USER_NAME |
OPT_CONNECTION_STRING_DB_USER_ PASSWORD | Login name to be used for database connections created earlier in this tutorial. Important: This value needs to match the DB_NEW_LOGIN_NAME defined earlier in this tutorial. To be properly configured, this IIS Server value needs to match the DB value. Note: The password must meet the standard Windows server password requirements. The password should be at least 7 characters long with at least one upper case letter, one lower case letter, and one digit. | cred: SQL_SERVER_USER_PASSWORD |
OPT_CONNECTION_STRING_NAME | Application-specific name of the connection string. For the Mileage Stats application the name is ‘MileageStatsDbContext’. | text: MileageStatsDbContext |
Input Name | Description | Example Type/Value |
---|---|---|
ADMIN_PASSWORD | Set the password for the local Administrator account. This should be at least 7 characters long with at least one uppercase letter, one lowercase letter, and one digit. | Cred: ADMIN_PASSWORD |
SYS_WINDOWS_TZINFO | Set the system time to a specific timezone. Some examples are provided in the dropdown, but can be overridden if the timezone is not listed. Note: Do not override the predefined values—select an existing time zone. If yours is unavailable, use ‘Pacific Standard Time’ for the purposes of this tutorial. | Text:Your Local Time Zone |
Note: SVN_APP_PATH, SVN_PASSWORD, SVN_USERNAME are not required for this tutorial. Set these values to ignore.
You need to set one advanced input (OPT_APP_POOL_NAME). To see the advanced inputs click on the Show advanced inputs link below the Application category. Next, go to the Inputs tab of the array and set values for this input if you haven't done so already:
Other inputs can be left set to default values.
Click Save.
Now that you have operational load balancers ready to accept requests, and primary/mirror database servers on the backend, you are ready to start up the server array to run your application.
Go to your server array page.
Here you have two alternatives:
Enable the server array - if you are using this tutorial for learning purposes, just enable the server array by going to the server array's Info tab and clicking the enable link in the Status row.
Note: After being enabled, the array will launch application servers as specified in the Default Min Count auto scaling policy parameters (configured earlier in this tutorial).
To test if your deployment is operational just enter your LB_HOSTNAME in browser address fields. (http://my-www.example.com)
You may find the need to perform some clean up, either to minimize costs, or to perform the tutorial again from a clean slate. Follow these high level steps to do so:
© 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.