Automatic Deployment of a New Discoverize Portal

by Oliver 11. March 2013 15:02

This is a technical post about how we automatically deploy new portals that will be run by our own portal software discoverize.

After filling in and submitting our portal creation form we do the following:

  1. Save the entered information into /App_Data/<PortalName>/portal.xml
  2. Trigger the TeamCity build through a web request to a specific URL
  3. Send an email with the request status or any errors that occurred
  4. Display a Thank You page.

Now, the TeamCity build configuration that was triggered under 2. does the following:

  1. Execute the Powershell script create-portal.ps1 in c:\projects\discoverize
    • create the AppPool Discoverize-Portals if it doesn't exist yet (all our portals run within it)
    • iterate over all folders inside wwwroot\discoverize.com\App_Data
    • if a folder with the same name exists under wwwroot\discoverize-portals, skip it
    • else move the current folder from wwwroot\discoverize.com\App_Data to wwwroot\discoverize-portals
    • add a line with the full path to the new portal folder to newportals.txt (e.g. C:\inetpub\wwwroot\discoverize-portals\<PortalName>)
    • add a new site to IIS and set its AppPool to Discoverize-Portals
    • start the new site in IIS (needs Admin privileges, that's why we use a parameterized task scheduler task for that)
  2. Build the source code from the repository
  3. Execute the Deploy-NewPortals target from deploy.proj using MSBuild in c:\projects\discoverize
    • Iterate over the entries in newportals.txt, for each entry do:
    • Copy the build output from step 2. to wwwroot\discoverize-portals\<PortalName>
    • Run the site setup (this uses Orchard's setup method) with our own recipe (using Orchard.exe)
    • Call an action (SetupComplete) on the new site to mark deployment as done
    • Create a default entry so there's something to look at (using Orchard.exe)
  4. The SetupComplete action then finishes doing this:
    • save the information of the portal.xml into an application specific configuration file
    • create new user "portal-owner" for content management
    • send an email about the successful installation of the new portal

Quite complex, if I look at it now, but it works!

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

About Oliver

shades-of-orange.com code blog logo I build web applications using ASP.NET and have a passion for javascript. Enjoy MVC and Orchard CMS, and I do TDD whenever I can. I like clean code. Love to spend time with my wife and our three children. My profile on Stack Exchange, a network of free, community-driven Q&A sites

About Anton

shades-of-orange.com code blog logo I'm a software developer at teamaton. I code in C# and work with MVC, Orchard, SpecFlow, Coypu and NHibernate. I enjoy beach volleyball, board games and Coke.