How to deploy a C#, MVC4 application on Azure using Git - c#

I am developing a C#, MVC4, EF5 Code First application on .NET in Visual Studio 2012 and have used the VS publish mechanism to deploy it to an Azure Website with an Azure SQL Database.
I now want to use Git and GitHub for version control and involve others in the project.
However, although I am familiar with using Git in a LAMP environment, I have no experience of using Git with Windows, Azure Websites and a compiled environment.
I would like to use the Azure Website as the production server, another Azure Website as a Staging server, developer Windows machines using Visual Studio for development and GitHub as the central repository.
There is a helpful article here: http://www.windowsazure.com/en-us/develop/net/common-tasks/publishing-with-git/ . I can get my head around what would be needed here for, say, a PHP application on Azure. But I am unsure of the best approach with a compiled application and what I can achieve using Azure Websites and Visual Studio.
A nudge or two in the right direction would be greatly appreciated!

don't publish from VS to azure, instead setup your azure website to pull from the github repo. the deployment process compiles your solution.
watch http://www.youtube.com/watch?v=5NGieL0tinw&feature=youtu.be&hd=1 or read http://vishaljoshi.blogspot.com/2012/09/continuous-deployment-from-github-to.html
Also SocttGu announced this on his blog # http://weblogs.asp.net/scottgu/archive/2012/09/17/announcing-great-improvements-to-windows-azure-web-sites.aspx he also talks about a cool feature of publishing branches, this will nail your requirement for a stage server and production server. Have a stage branch and a production branch and merge to them as desired. see the section "Support for multiple branches"
looks like they added support for private repos finally.
appharbor is a competitor to azure that does something similar.

You are basically introducing a new step with the requirement that the source code must be compiled before it can be deployed to the server. Where you implement this step is up to you. You could:
Ensure that your target server has the capabilities to compile the source code (some Continuous Integration tools could help with this, such as CruiseControl.NET). This has the caveat that the target server be able to compile source code (possibly even requiring Visual Studio to be installed), so that may not be an option.
Check the compiled binaries into source control. You could keep these compiled binaries separate from the main source branch, to keep things clean. Deploy the binaries to the target server.
Some hybrid of the previous two options is also possible; you could set up a Continuous Integration server with CruiseControl.NET, which can check out the current source, build it, and check the resulting binary back into a special branch, then deploy that branch to your target Server.

Related

Deploy ASP.net/React project with webpack directly from GIT on IIS

The goal is to automatically deploy a ASP.net project from GIT.
The solution (in the Visual Studio sense) consists of multiple projects, using C# and entity framework under the hood and React for the frontend. I know what to install (e.g. with npm) to get the UI transpiled (with webpack), but I am not sure what Visual Studio exactly does when you click on Publish to folder. I would like to do exactly that build step both for the C# backend and the React frontend using a Jenkins server.
I am also dreaming of GIT-tag-triggered builds, but that's a different question.
In summary, I have the following servers running on different (virtual) boxes:
GIT server
Jenkins server
Production server hosting the solution with Internet Information Services (IIS).
I know how to make (1) and (2) talk with each other, and I am able to deploy stuff from (2) to (3). The first part of my challenge is: What do I need to install on the Jenkins server (2) in order to build the complete solution?
Related questions
How can I compile and run c# program without using visual studio?
Sayed Ibrahim Hashimi and Rick Anderson: Visual Studio publish profiles for ASP.NET Core app deployment

Use specific VM only for TFS Builds

I am currently building a C# Web API and publishing it to Azure. I'm using Visual Studio Online to host my TFS source control. Of course, Azure has options to use their build servers, but those are not free after your first 60 minutes of build time, and this is an educational endeavor.
Is it possible to set up a VM (or use my local machine) as the TFS build server for continuous integration? How would I go about that? My initial guess is that this is possible, and I just am not googling using the correct terminology to find what I'm looking for.
I'm not terribly savvy on TFS in depth, so please feel free to correct any incorrect assumptions I have.
You can create a Windows Server VM in Azure, and simply install TFS 2013 and when you get to the configuration wizard just choose to configure Build Server only. When it asks you for the URL to your collection, give it the URL for your VSO collection (e.g. https://foo.visualstudio.com/DefaultCollection)
Pretty straightforward to do, I've done it many times.
PS - Of course you could use an on-premise VM also, but I like the option of using a VM in Azure.
You can download and install TFS on your local server/machine: VS & TFS Download page
But if you need only build server you can use any other CI server as well (e.g. TeamCity or Jenkins) and build your code from visualstudio.com there.

Docker in the big picture for complete DevOps

could someone point me to the right documents or describe how Docker would help (or what should be Dockerized) in the following scenario:
4 environments: Developer's laptop, DEV, TEST, PRO
C# web MVC application running under IIS8.
Databse running on Oracle dedicated Exadata server.
Source Control is TFS-TFS, with builds under TFS and a binary repository with rest apis. (Proprietary)
Deployment in TEST and PRO must follow a strict approval process.
with all that said, I know I am not in the most common environment for going to Docker, however I specifically selected this use case in order to get the most of the answers.
I can follow 2 path:
Either try to Dockerize the DEV environment itself, but I doubt Visual Studio can be Dockerized today? So that would leave my with running a smalle database engine in dock as well a maybe a mono instance for running the application, however I doubt developers will see an added value compared to the built-in VSS features.
I could also try to dockerize the 'run' environments, but again for IIS I am not sure Docker will do.
If the answer is "nothing will do on Microsoft stack", please switch to Java, SVN, Jenkins, RAD and WAS where appropriate, that would match some of my use cases too.
For dealing with DEV/TEST/PROD see Dockerfile and dev/test/prod environment
You may have a look at the (343) Oracle Database in container you can find in the registry hub https://registry.hub.docker.com/search?q=oracle&searchfield=
If you choose another webserver replacing IIS, it is easy to use a container with Nginx or Apache or...

Anyway to test the TFS Api without installing local TFS Server

I need to write a proof of concept with the TFS API (fetching data from tfs server regarding workitems and put this data in our tables).
Can Any body suggest a way to do this without setting up my own TFS Server.
You can just set up one on the MS Cloud TFS which is now on tfs.visualstudio.com (previously called TFSPreview.com.
With TFS, your code is accessible from anywhere. You can check in code
directly from Visual Studio and Eclipse, or you can use command-line
tools to check in your code from Xcode and other IDEs. Since it's all
in the cloud, your team can get started quickly with no infrastructure
to manage.

Best practice for moving C# .NET project files across servers

What is the best strategy for making changes to a specific file within a C# .NET project and a DEV server and then moving that file to a different environment, say server B? I noticed it always wants me to recompile on the destination server and I figured I was doing something wrong because I didn't think I would have to (plus the server isn't in-house so it is really slow and time consuming).
Any suggestions or strategies you or your company uses would be appreciated.
Make sure you are using a Web Application project where it compiles a DLL, not web site which uses loose code files.
You could use a source code versioning system like Subversion.
use a source control program for source files (like SubVersion) and Cruise Control for binaries built out of those files...
For web application development my experience has been:
Developers have a development environment on their local machines that is attached to source control
A DEV web server with shares to the projects created allows developers to COPY files to the web application folders manually.
A TEST web server where MSI installations ONLY are used to distribute the changes for UAT
A PROD web server where MSI installations ONLY are used to distribute the UAT approved MSI
The size of projects I am involved with usually makes build scripts overkill, most times a project is being worked on it is built many times for debugging etc.

Categories

Resources