One of the great characteristics of Orchard is the ease at which you can get a site up and running, especially for development purposes. However, this process can be a bit of a headache with hosting providers that are not optimized for the type of environment Orchard demands – an IIS web server with a site running in full trust mode. Yes, you can technically run Orchard in medium trust, but you lose some optimizations. If you’re going to host Orchard on a third party provider, you want to make sure you’re getting the best environment possible. I have found Microsoft’s Azure to be a great choice for Orchard, partially due to its ability to install applications for you through its web application gallery.
To get started you’ll obviously need an Azure account, or at least sign up for a free trial. After you’re registered, head over to your dashboard and click on “Websites”. If you are just starting out with Azure, no websites will be listed, so click the “+ New” button in the bottom left corner. Choose “From Gallery” on the menu that pops up to open the Apps for Azure dialog.
Next you’ll want to choose Orchard from the list of applications (it was near the bottom for me) and click on the arrow at the bottom right to go to the next screen. Here, give your site a name and complete the other fields and click the checkmark to create your site. After this completes you should see it listed on the main Websites page on your dashboard.
We could click on our site to browse it and finish the Orchard install process, but first we’ll need a database. Orchard works with a number of options, including SQL Server Compact, but we are going to use a full SQL Database for this tutorial. Click on SQL Databases on the left hand navigation to go to a list of your databases. On the bottom left, click the “+ New” button again. This process is similar to creating a site. On the pop up menu choose “SQL Database -> Quick Create” and give your database a name. Click “Create SQL Database” to finish.
Once your database is created it will show up on your dashboard page. Click on it to go to the details page. The only thing we really need here is the server name listed in a grey box at the bottom of the page. Copy this to your clipboard and then navigate back to the “Websites” page of your dashboard. Click on the url of the site you create to browse to the actual website. Here you can start filling in the information for your Orchard install. Most of this is pretty self explanatory. For the database option, choose SQL Server Database. Paste the server name you copied earlier into notepad or somewhere handy, and then copy and paste the example connection string into the field above it. Plug in the server name you kept around and then fill in the other values – the name of your database and your username/password. I used the same username/password that I logged into Azure with and it worked – I believe you can also create seperate logins if you want.
After you complete the form you should have a successful Orchard installation running!
The only step we have left is to give our site a custom domain name so that .azurewebsites.com isn’t suffixed after the site name. In this example I’ll be using a domain from godaddy, but the principals should apply to other websites. First, inside Azure we need to make our site a shared website. To do this, navigate to your website’s page on the Azure dashboard and go to the “Scaled” tab. Change the website mode to “Shared” as seen below.
Next, head over to the “Configure” tab and scroll down to the “Domain Names” section. Click “manage domains” and add the domain you want into the field provided. Be sure to add an additional entry for the “www” version of the domain. Also copy the IP address provided into notepad or somewhere you will remember it. Save your changes.
Just one more step – go to your account page on godaddy and expand the domains category. Click “Launch” next to the domain you want to map to your Orchard site.
This should bring up the domain details page. Click Edit Zone File at the top to see more details information about your domain, and then click the “Edit” button to start making changes. Make the changes outlined below. Basically, you need to set the A records to the IP address provided by azure, and then add a few additional cname records. The Azure documentation explains that these entries are necessary (in a really convoluted way). In this example I am using the learnorchard.com domain, so just plugin that part of the entry with your own domain name.
After you save your changes it make take a bit of time for the DNS to propagate. With a little patience, your new site will be running and accessible in no time.