Have you built a DotNetNuke site and now want to move DNN to production? Or, are you simply moving a DotNetNuke website from one server to some other server? Over the last month I have seen several searches in the logs from people trying to find instructions on moving a DotNetNuke website from development to production, or simply from one server to another. After looking around for similar detailed instructions, I really did not see anything out there that really explained how to setup a IIS box for DotNetNuke, optimized and ready for production. So, I decided to provide instructions on how we do it…
The following instructions are provided to minimize any downtime of the production domain/website, assuming there is an existing website running. However, the same instructions can be applied for a brand new domain/website that does not have a critical execution plan. These instructions will have a basic assumption that you understand how to manage IIS, DNS, and DNN. While we do not provide any guarantees to your particular setup, the following has worked well for us, managing the release of many DotNetNuke websites from our development environment to our production environment, while allowing continued development during the process.
The following instructions are provided to minimize any downtime of the production domain/website, assuming there is an existing website running. However, the same instructions can be applied for a brand new domain/website that does not have a critical execution plan. These instructions will have a basic assumption that you understand how to manage IIS, DNS, and DNN. While we do not provide any guarantees to your particular setup, the following has worked well for us, managing the release of many DotNetNuke websites from our development environment to our production environment, while allowing continued development during the process.
DNS and Subdomains
First, we need to create subdomains. For this example, we will use dev.domain.com and prod.domain.com. Assuming the development environment you are currently working on is using just localhost, adding a subdomain for dev.domain.com may not be neccessary, but provides an easy way to work with multiple domains and projects. Point DNS for dev subdomain to the IP address of your development box and point the prod subdomain to your production box IP. Leave, www.domain.com pointing to where ever you have it pointing currently, but turn your TTLs down to 5 seconds. If this is a new website, you may already be pointing www.domain.com to your dev box, you can leave it there for now. For those who do not know what DNS is, see How Stuff Works.
We use the service of DNS Made Easy. Hands down, this is the best business decision we have made concerning management of DNS. While their site is unfortunately not a DNN site, it provides the interface to get the job done quickly and easily. We use their Business Membership plan that allows us to turn down our domain TTLs to 5 seconds. They offer 100% uptime and have servers globally to handle DNS request. They also provide services for MX backup (your domain will still receive emails, even if your email server is down) and site monitoring (pings your site to ensure it is up, sends notification if down). We have never had a problem, they have excellent support, and great prices for their services.
Once you have the new subdomains created, make sure they are working by pinging from the server(s) or use something like DNS Stuff. If you cannot ping, make sure your firewall is setup correctly to accept and route HTTP traffic to the correct server.
If it’s working, then you are ready for the next step…
The Development DNN Installation
Login as Host and go to Host > Portals > Edit Portal > Portal Aliases > Add New HTTP Alias
Add the following aliases, assuming localhost is the only one created:
1. domain.com
2. www.domain.com
3. dev.domain.com
4. prod.domain.com
Copy the entire DNN folder on development box to the location on your production box where DNN will reside.
SQL Server Database on Development and Production
Go into Enterprise Manager or SQL Server Management Studio, development database server, and find your DotNetNuke database. Right click and go to Tasks > Detach. Clear the connections if you have to. Once the database has been successfully detached, go to the folder where the database files live (.mdf and .ldf files) and make a copy of your DotNetNuke database and transaction log. If you simply made a copy of the file in the same folder, you can now reattach the database (Tasks > Attach) so development can continue if other developers are working on your project, minimizing development downtime, plus have a backup of development database in case of unexpected issues. If you have a very small database, it may not be an issue just to copy and paste the files to the production server, assuming you are on the same network. However, our “development DNN database” is almost 3 Gb and takes a minute to move over to our production box. So, however you decide to do it, copy the .mdf and .ldf file to production database server. Rename them if necessary and Attach the database similar to the way you detached. Refresh database view if necessary and ensure the database is accessible. If you want to create a custom SQL Server login on production for security reasons, now is the time to do it.
IIS on Production Box
Create a new website in IIS. Map the website to the DNN folder you created on Prod. For the initial host header, use prod.domain.com.
**Note** DNN Documentation show creating Virtual Directories. We have had great success with configuring and managing DNN websites as actual websites, instead of virtual directories and would recommend this route for anyone who is planning on running this in a production environment to reap the benefits of IIS, especially IIS 6 and performance as discussed further down…
If this site is NOT replacing an existing and running domain/website, go ahead and add domain.com and www.domain.com host headers from Website Properties > Web Site Tab > Web site identification > Advanced Button. If you use internal IP addresses (Firewall routes the HTTP traffic), make sure you have the right IP addresses and port specified. By default HTTP traffic runs on port 80.
If this is a DNN 4 install, make sure you change ASP.Net version to 2.0 from the ASP.NET tab in Web site propoerties.
For performance enhancements, and as a necessity if you are running both ASP.NET 1.1 AND ASP.NET 2.0 websites, create a new application pool for the website and a web garden as described in the following entry on IIS 6 Horticulture.
Production DNN folder
Within Windows Explorer, go to your production DNN folder, right-click and select Properties > Security and make sure Network Service has the proper permissions. Now, modify the web.config’s database connection string(s) (2 of them for DNN 4) to the production database server and production database. If you created new SQL Server accounts for access, you will want to update the id and pass as well.
Testing it out…
First, open up a command prompt and make sure you can ping prod.domain.com and dev.domain.com. You should get the production IP address for prod.domain.com and the development server IP address for dev.domain.com. Now try to navigate to prod.domain.com in a web browser. If you get a successful page load, you now can do your testing to ensure everything is there and working. Since you created a subdomain for dev.domain.com, you can do your development as needed, test, and when ready, move to production. Periodic replication of the database from Production to Development allows you to keep a development environment that closely resembles your production environment. If you have tested everything and are sure the prod.domain.com is working correctly, you are ready to go live…
Going Live with DotNetNuke 4
Okay, so you have tested and are confident that the site is ready for primetime. First, go ahead and change your DNS settings to point domain.com traffic to the production server IP address. With IIS Manager open, stop the old website if one was running and add www.domain.com and domain.com to the host headers to the new website if necessary. Try www.domain.com and it should work. You now have a live DNN site. Assuming all went well, you can turn your TTLs back up in DNS for better caching.
Updates to this post
I hope you have found this useful. If you have any suggestions, please write a comment and share your experiences. I will try to keep this entry updated if I come across any other tips or updates and eventually may even get around to adding some pictures for futher help. Stay tuned!
Comments
Post a Comment
Thanks for the Comments , Your review will display soon