In this short post weâ€™re going to learn how to deploy STW 4.0 (still in pre-release at the time of this writing) to Windows Azure.
Hosted Service and Storage Account Setup
Navigate to the Windows Azure Development Portal (windows.azure.com) and sign in with your Live ID. From the home page select Create a New Storage Account.
In the Create a New Storage Account form fill in the domain name; this domain name, which is always in the acme.cloudapp.net form, is global so you may need to fiddle with it a bit to get a name that is not already in use by another service.
Itâ€™s a good idea to create an affinity group to ensure that storage and hosted services that use it are located in the same datacenter, reducing bandwidth usage and increasing performance. Affinity groups can also specify a preference for a geographical region so that service and storage are as close to your users as possible to minimize network latency.
Click OK and youâ€™ll see a summary page for your new storage account.
After downloading the Windows Azure Table/Blob Storage package, you have to tell ScrewTurn Wiki to use your new storage account. To do that open the ServiceConfiguration.csfg file with your favourite text editor and modify the ConnectionString setting:
- choose your preferred Endpoint Protocol between http or https (the former is faster, while the latter is to be preferred for inter-datacenter communication)
- replace the Account Name with the one you created in the Create a New Storage Account form
- from the Storage Account summary page select View Access Keys for your newly created storage account, copy the Primary Access Key and paste it replacing the Account Key value in the connection string.
Now you have to create a new Hosted Service.
From the Hosted Services summary page select New Hosted Service.
In the Create a New Hosted Service form fill in a friendly name for your service and the domain name. Choose a geographical region or, if you have created it, select the affinity group.
You can then select the Deploy to Production Environment option and after creating a name for your deployment upload the Azure.cspkg and ServiceConfiguration.cscfg files.
Click Ok to start the deployment.
An alert pop-up will appear warning you that your deployment has one role with only one instance. You can just click Yes and continue the deployment or modify the ServiceConfiguration.cscfg file changing the value of the Instances setting from â€œ1â€ to â€œ2â€ or more:
<Role name="WebApplication"> Â Â Â <Instances count="1" /> Â Â Â <ConfigurationSettings> ...
Deployment for Multiple Wikis
ScrewTurn Wiki 4 natively supports multiple independent wikis within one application instances. Each wiki must be bound to an dedicated host address, for example:
- support.acme.com for a public customer support wiki
- hr.intranet.acme.com for a HR private portal
- dev.intranet.acme.com for company developers.
The fun here is that the wikis, while being completely independent, all live in the same application instance, saving server resource and significantly reducing the burden of keeping STW up-to-date.
If you want to deploy ScrewTurn Wiki on Windows Azure with support to multiple wikis you have to edit the Wikis setting in the ServiceConfiguration.cscfg file before publishing it.
The names of wikis must separated by a pipe and for each wiki you can specify one or more hosts separated by semicolon:
<Setting name="Wikis" value="root=|support=support.acme.com|hr-intranet=hr.intranet.acme.com|dev-intranet=dev.intranet.acme.com" />
The â€œrootâ€ wiki, which is mandatory, also acts as fallback for all unknown hosts.
There is a caveat: on Windows Azure, you can only specify one host for each service. In order to access your multiple wikis, youâ€™ll have to create multiple CNAME DNS records, all of them pointing to host of your Azure service (e.g. acme.cloudapp.net), quite easy, but that is required if you want multiple wikis.