Deploy ASP.NET Application to AWS from Visual Studio Team Service - asp.net

i need some advice about continuous deployment within Visual Studio Team Service. To be honest, i am quite new in this area, so forgive this silly question because i can't find any reference for AWS but only Azure.
My idea is i can deploy asp.net application to AWS EC2 which is built from VSTS source control.
My current scenario is:
I had source control which contain asp.net application code inside VSTS.
I created build definition which build the source code and produce artifact.
I created release definition, which copy artifact to remote AWS EC2 instance.
....
I don't have any idea to continue the next step, could you give advice what i should do next ? Or any better scenario ?
Thank You.

Currently I don't see any tasks which can directly deploy to AWS, so the only way this seems possible if you create your own task or use powershell or bash along with AWS cli to deploy your artifact. The process would be something like this
Download the artifact in a release. This is default if you link the artifact.
Make sure the agent machine that you are using has AWS CLI for Powershell or AWS Shell if you are using bash.
You can then write a powershell or bash script which will utilize aws cli to deploy your artifact to AWS.

For anyone else wondering about this in the future, AWS just released the AWS Tools for VSTS to the Visual Studio Marketplace. These tools contain a number of tasks you can use to work with AWS services such as S3, CodeDeploy, Elastic Beanstalk, Lambda and CloudFormation from within a VSTS or TFS environmemt.
We also just published a blog post about using the tools to publish ASP.NET and ASP.NET Core applications to AWS from within VSTS.

There are couple of options for you. A tutorial to explain how to get this running is given below.
How to Build a CI/CD Pipeline Using AWS CodeDeploy and Microsoft Team Foundation Server (TFS)
(For hybrid/complex deployments, you can use this. You can deploy IIS websites, MSI packages, services, exe). The beauty of this is that with a single deployment you can deploy to both on premises and cloud environment.
https://www.youtube.com/watch?v=MIE0P3m9eEY
How to Integrate AWS Elastic Beanstalk with Microsoft Team Foundation Server (TFS) or (VSTS)
(for IIS websites/batch jobs you can use this)
https://www.youtube.com/watch?v=nRLZZefLDqU
How to Integrate AWS Cloudformation with Microsoft Team Foundation Server (TFS)
(fully infrastructure automation and manage infrastructure as code)
https://www.youtube.com/watch?v=WU93NJT0_3s

Related

TeamCity and Deploying .net app on IIS server

I am completely new to CI/CD and need some assistance.
Where I work we used to have a setup with Azure pipelining that created the builds and send to Octopus Deploy to deploy to the Developer Server then Staging and Live (that would be manual from Octopus).
Now our company in order to cut back on costs they are looking to use Teamcity instead of Octopus Deploy as it is free for up to 100 builds and 3 agents.
Can someone recommend me a tutorial on how to publish and deploy on an on premises server that uses IIS. The developers write on C# using .net
I have found one but they use TeamCity for the build and then Octopus for the deployment which defeats the purpose.
I played a bit with Teamcity and got to build on a local server but cannot find how to deploy in an autonomous way.
Does Teamcity have the functionality or do you need Octopus Deploy for the CD part?
Also do we need to use Teamcity for the CI part or can we still keep the Azure pipelines and triger the CD part on Teamcity?
I appreciate your help.

How to deploy an ASP.NET project to Azure with WebDeploy

A little background (before I get downvoted to oblivion!)
I'm working on an intranet-hosted ASP.NET web application in a highly secure environment. At the moment it's deployed by building a package in Visual Studio, the zip file is copied onto the server and installed in IIS using WebDeploy (right-click -> Deploy -> Import Application).
What I'd like to do is deploy a sanitised version of this application to an Azure Web Site for demonstration purposes, however most of the standard Azure deployment methods do not apply to me because:
I work on a secure network so Visual Studio is blocked from connecting to Azure (rendering 95% of documentation irrelevant!)
installable software is strictly controlled on this network so I cannot install the Azure SDK needed to create Service Definitions, Configurations and Packages
The only machine I have access to which can connect to Azure is woefully underpowered and can only run puTTY, PowerShell and basic text editors.
At the moment, I have a Windows VM in Azure just running IIS and WebDeploy - this works but seems like overkill (and a good way to burn through my credit) when Web Apps in theory do everything I need.
What can I do?
Another option may be to checkin the WebDeploy package to a free subscription of Visual Studio Team Services (VSTS = TFS in the cloud) and then create a deployment pipeline in VSTS using the new Release Management features.
https://www.visualstudio.com/features/release-management-vs.aspx
in that case:
1) FTP from your machine using your own FTP client or i would recommend to use PSFTP from Putty package.
2) Still WebDeploy, but use that to generate the needed files, then you can use PowerShell like that.
You can also use https://www.microsoft.com/web/webmatrix/ to connect to azure websites. It works with HTTP, only problem could be a corporate proxy.

Deploy Visual Studio Team Services (aka VS Online) build to an on-premises IIS?

What are the options for deploying a web-application that is built daily using Visual Studio Online (and hosted controller) and its new build definitions to an on-premises IIS behind a firewall?
If opening up the firewall, would it be possible to add some kind of WebDeploy-build step to the Visual Studio Online build? Haven't seen any WebDeploy build steps for now though...
...or could we write a PowerShell script running daily on the IIS-server that fetches the output of the daily build from Visual Studio Online? If that's possible, how can those files be accessed?
...or could something like OctopusDeploy help out here?
would like to refrain from having to set up an on-premises build controller.
VSO Agents are lightweight and easy to setup if you have a server available. Octopus Deploy integrates nicely most on premise scenarios.
That said, if you still want to keep hosted builds, Octopus would still work.
Create a VSO build definition and include OctoPack.
Pick a hosted Nuget Server, presumably with a private repo subscription. A couple of options are MyGet and Artifactory.
In "MSBuild Arguements" include the parameters.
/p:RunOctoPack=true
/p:OctoPackPublishPackageToHttp=http://nugetrepoofyourchoice.com/nuget/packages
/p:OctoPackPublishApiKey=$(NugetAPI)
/p:OctoPackPackageVersion=$(Build.BuildNumber)
"NugetAPI" is actually a user defined variable (name of your choice) that references a Secret build variable. You will get this API Key from your Nuget Repo vendor.
On premise, in your Octopus installation, you would define your hosted Nuget feed as an external feed.
In your deployment project, it would pull the Nuget package from your hosted repo.
VSO pushes to hosted Nuget feed and Octopus pulls from the hosted Nuget feed.
Octopus deploy would work for this in a couple of ways.
1) Install a tentacle on the IIS server (either polling or listening will work depending on where you install octopus manager)
or
2) Install the main octopus deploy on a machine that has WebDeploy access to your IIS server, and use the custom library MS Deploy script
Getting the package to the main octopus deploy machine could be a bit tricky. Easiest way would be setting up a MyGet server and have the octopus server check it periodically, that way you don't need to open up firewalls to the public.
These feature are coming for VSO and were announced at Build. You will be able to deploy on-premises without needing to open a firewall port using agents.
While this is still in the works you can use Release Management for Visual Studio 2015 to pull the bits from VSO and deploy locally.

How is Jenkins helpful to automate deployment process

Can anyone provide insights of using Jenkins for automating deployment under controlled and uncontrolled enviroments. We have different environments - dev/qa/uat/prod and currently we are using batch files that call msbuild/nant scripts to deploy on web and DB servers (web farm). Developers only have access to dev/qa and production support will deploy on uat/prod. Prod. support will get the source code from SVN tag folder and run the batch file to deploy the application.
By using Jenkins, is it possible to eliminate the step of prod. support team getting the script from SVN by running the jobs using their credentials via url. And what is the general practice using source control and CI tool for deploying applications.
My recommendation is to reserve Jenkins for just building the software. That way the user of Jenkins only have access to development and perhaps QA systems.
To decouple the build system from the process that deploys the software I recommend the use of a binary repository manager like:
Nexus
Artifactory
Archiva
In that way deployment scripts could retrieve any version of a previous build. The use of a repository manager would enable your QA team to certify a release prior to it's deployment onto production.
Finally, consider one of the emerging deployment automation tools. Tools like Chef, Puppet, Rundeck can be used to further version control the configuration of your infrastructure.

ASP.NET Automated deployment to remote ftp server

Does anyone know any good solutions for automated deployment to a remote server using SFTP? I am specifically trying to deploy an asp.net mvc website to mosso. I can do it manually every time using an SFTP client, but would much rather have an automated (and consistent) way to do this.
I have written a pretty detailed blog post using TeamCity, and Web Deployment projects to automate build and deployment as a starter here:
http://www.diaryofaninja.com/blog/2010/05/09/automated-site-deployments-with-teamcity-deployment-projects-amp-svn
I have then added to this to show FTP addition
http://www.diaryofaninja.com/blog/2010/09/21/continuous-integration-tip-1-ndash-ftp-deployment
A basic process flow is pretty simple:
Using a teamcity build server i download from my SVN repo
I build and deploy the site to a local folder on the build server
I fire a command line FTP client that supports scripting called
WinSCP using the MSBUILD Task EXEC (http://winscp.net/)
Upload all my sites content
Have [insert beverage] of choice
I then make sure that i only deploy the Trunk of my SVN repo, and develop and test everything in an branch before merging - this way only tested stuff gets deployed. Add Automated testing to your build cycle and you've got a match made in heaven.
Some great free tools to get going are:
Visual Studio Web Deployment Project
TeamCity (free for under 20 build configs)
Bamboo
deployment tools under .NET solutions
Automatic Deployment Resources

Resources