The easiest way to do an overnight deployment of an ASP.NET MVC 3 website?

I have an ASP.NET MVC 3 website in C # c

  • ASP.NET MVC 3 Internet Project
  • Domain Project (Class Library)
  • Unit Testing Project
  • SQL Server 2008 R2 Database
  • Source Control on Mercurial

What is the easiest way to automatically create and deploy a site at 12:00 AM so that I can go to dev.mycompany.com every day and see a live updated version of my version of Dev?

I was thinking about using Jenkins to make the whole building.

+6
source share
1 answer

I support a system like in Jenkins. Obviously, the details will depend on your project structure, but here is roughly what our Jenkins work does:

  • Pull code (we use Git, but there is also a Mercurial plugin for Jenkins)
  • Make any changes to the SQL schema in our test databases from an idempotent script (we use an Ant script that precedes our use of Hudson / Jenkins)
  • Run msbuild (another Jenkins plugin)
    • The build file is our .sln (or you can use web.csproj - the arguments are slightly different)
    • Command line arguments:
      • / p: Configuration = Dev / p: Platform = "Any processor" / p: DeployOnBuild = true / p: DeployTarget = Package / p: DeployIisAppPath = "dev.mycompany.com/" / v: m
    • This creates a .zip file, a .cmd file, and some .xml files containing everything you need to deploy updates to your site.
  • Delete the other two Jenkins msdeploy jobs, one on each .NET web server
    • Each .NET web server is also a subordinate of Jenkins.
    • We have two servers in testing, balanced through NLB
    • Each msdeploy job copies the .zip / .cmd / .xml files from the build server to a temporary location on the web server and then runs the .cmd file.
    • The .cmd file executes msdeploy, which pushes everything you need to the dev web server.

We have a separate task that runs our NUnit tests, but you can just as easily include your tests in your main work. One of the reasons we create all .sln instead of web.csproj is because we can run our unit tests from the same inline code.

If you have not already done so, you will need to install ASP.NET MVC3, .NET 4 and msdeploy on the build server, and I believe that you will need most of the files on your web servers.

For planning, you can select build periodically or poll SCM as a build trigger, and then use the cron-like syntax (0 0 * * * *) to run daily at midnight.

+12
source

Source: https://habr.com/ru/post/903214/


All Articles