Before I start, just want to let you know that Pro nopCommerce is now hosted on Windows Azure Web Sites. The thing I like about Windows Azure Web Sites is its seemless deployment process. As I am a heavy user of BitBucket, I hosts all of my codes on it, including the codes for Pro nopCommerce. And the good thing about Windows Azure Web Sites is that it can link to various code hosting platform, including BitBucket.
By linking Azure Web Sites with my code repository on BitBucket, I can then setup automatic deployment on Azure. My codes get automatically pulled and compiled whenever I make changes and push it to BitBucket. There's very little FTP-ing (unless you need to upload some HGIGNORE-ed files). The process is effortless. I just change my code, push it to BitBucket, and Azure deploys the code for me.
If you are also using Azure Web Sites for your nopCommerce websites, this tutorial is going to teach you how to link up your code repository to Azure Web Sites to enjoy automatic deployment. No more FTP-ing! :)
To qualify for this tutorial, you must have all of the following setup:
- A Azure Web Sites (new or existing) to host your website
- Code hosted on popular code repository platform, such as BitBucket, GitHub, CodePlex, TFS, self-hosted SVN and etc.
- Download these files, and put it at the top directory of your source code (same folder as NopCommerce.sln)
NOTE: If you are using nopCommerce 3.20, you need to copy several files (shown below) from nopCommerce 3.10 source.
These files are essential for Azure to compile the sites for you.
You also need to modify the line shown below (found in ~/build/nop.proj file) from 3.10 to 3.20.
Setting Up Azure Web Sites
Now that you have everything required, it's time to get your hands dirty!
Navigate to the Azure Web Sites you want to configure. Under the dashboard tab, you'll find something similar to the following:
Click "Setup deployment from source control". You'll then see a list of supported source control platforms. We'll take BitBucket as example.
Proceeding to the next step, you'll be required to link your BitBucket account to your Azure account. After successful linking, you'll then see a list of code repository. Select the one you want to link to this website, optionally specifying the branch you want to use (if it's not default).
Finishing Deployment Setup
If everything is completed correctly, you'll see your deployment in the deployment tab in a short while. Sometimes it can take over 15 minutes for heavy deployments, so don't fret when this happens to you. A successful deployment looks like the following:
Once you see your first successful deployment, it's time to start checking-in new codes! Remember, everytime you push new codes to the repository, Azure Web Sites automatically grabs the new code for you and deploy the codes for you! Easy peasy!
The source control deployment feature supported by Windows Azure Web Sites is really handy for folks like us where we make really heavy customization on nopCommerce, every day! Gone are the days of FTP-ing DLLs to the servers. We can finally focus on coding and let Azure does the rest!
Kudos to Azure!