How do you update live web sites with code changes?
Posted
by
Aaron Anodide
on Programmers
See other posts from Programmers
or by Aaron Anodide
Published on 2011-08-02T18:55:04Z
Indexed on
2012/12/13
23:19 UTC
Read the original article
Hit count: 285
web-development
|deployment
|websites
|release-management
|configuration-management
I know this is a very basic question. If someone could humor me and tell me how they would handle this, I'd be greatful.
I decided to post this because I am about to install SynchToy to remedy the issue below, and I feel a bit unprofessional using a "Toy" but I can't think of a better way.
Many times I find when I am in this situation, I am missing some painfully obvious way to do things - this comes from being the only developer in the company.
- ASP.NET web application developed on my computer at work
- Solution has 2 projects:
- Website (files)
- WebsiteLib (C#/dll)
- Using a Git repository
- Deployed on a GoGrid 2008R2 web server
Deployment:
- Make code changes.
- Push to Git.
- Remote desktop to server.
- Pull from Git.
- Overwrite the live files by dragging/dropping with windows explorer.
In Step 5 I delete all the files from the website root.. this can't be a good thing to do. That's why I am about to install SynchToy...
UPDATE: THANKS for all the useful responses. I can't pick which one to mark answer - between using a web deployment - it looks like I have several useful suggesitons:
- Web Project = whole site packaged into a single DLL - downside for me I can't push simple updates - being a lone developer in a company of 50, this remains something that is simpler at times.
- Pulling straight from SCM into web root of site - i originally didn't do this out of fear that my SCM hidden directory might end up being exposed, but the answers here helped me get over that (although i still don't like having one more thing to worry about forgetting to make sure is still true over time)
- Using a web farm, and systematically deploying to nodes - this is the ideal solution for zero downtime, which is actually something I care about since the site is essentially a real time revenue source for my company - i might have a hard time convincing them to double the cost of the servers though.
--> finally, the re-enforcement of the basic principal that there needs to be a single click deployment for the site OR ELSE THERE SOMETHING WRONG is probably the most useful thing I got out of the answers.
UPDATE 2: I thought I come back to this and update with the actual solution that's been in place for many months now and is working perfectly (for my single web server solution).
The process I use is:
- Make code changes
- Push to Git
- Remote desktop to server
- Pull from Git
Run the following batch script:
cd C:\Users\Administrator
%systemroot%\system32\inetsrv\appcmd.exe stop site "/site.name:Default Web Site"
robocopy Documents\code\da\1\work\Tree\LendingTreeWebSite1 c:\inetpub\wwwroot /E /XF connectionsconfig Web.config
%systemroot%\system32\inetsrv\appcmd.exe start site "/site.name:Default Web Site"
As you can see this brings the site down, uses robocopy to intelligently copy the files that have changed then brings the site back up. It typically runs in less than 2 seconds. Since peak traffic on this site is about 2 requests per second, missing 4 requests per site update is acceptable.
Sine I've gotten more proficient with Git I've found that the first four steps above being a "manual process" is also acceptable, although I'm sure I could roll the whole thing into a single click if I wanted to.
The documentation for AppCmd.exe is here. The documentation for Robocopy is here.
© Programmers or respective owner