Azure DevOps deploy Angular app to IIS with Octopus - azure-devops

I'm trying to deploy a Angular application to my IIS server using Octopus and Azure DevOps
My application has multiple environments, each environment with it's own settings (config.prod.json)
What I want to do
Basically Octopus should take the release from Azure DevOps, and copy the release to multiple folders, with different config.prod.json files.
Each folder corresponds to a specific IIS website.
Azure DevOps pipeline setup
Use Node 14.x
npm install
ng build --prod
Archive dis/angular-app ; Archive type: zip
Publish Artifact; Path $(Build.ArtifactStagingDirectory)
Triggers : Enable continuous integration
Azure DevOps Releases setup
1. Package Application for Octopus
2. Push Package(s) to Octopus
3. Create Octopus Release
Octopus setup
One step DEPLOY TO IIS
1. Package details
2. Custom Installation Directory
[![enter image description here][5]][5]
3. IIS Web Site and Application Pool
Errors
In IIS while I click Binding, Basic settings, I get this error: There was an error while performing this operation. The parameter is incorrect
Also, the folder mapped in iis for the website that I'm targeting. Contains a folder drop with the zip file 27.zip (27 is the release id)
How do I unzip the zip file?
How do I replicate the zip file to the other environments?
Is my configuration ok so far? What am I doing wrong?
Just a few of the links that I've checked:
https://octopus.com/docs/guides/deploy-aspnetcore-app/to-iis/using-octopus-onprem-azure-devops-builtin
https://www.youtube.com/watch?v=NFqrWsUPCAM&t=345s
https://www.youtube.com/watch?v=oeNYtYuhZQ4&t=2s

Related

How to generate deployment files Azure DevOps - TFVC

I have hosted ASP.NET Core and .NET Windows application to DevOps Services - TFVC (Cloud)
Now, I am stuck with how to generate deployment files, like debug folder of .NET Windows app or cloud hosting files of ASP.NET Core.
I have created a pipeline to generate deployment files, but how can I execute from the local machine so that developer can get the necessary files to host or install?
Thanks.
Since you have created a pipeline to generate deployment files, you could add a archive task and a Publish build artifacts task to publish the target files.
Archive files: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/archive-files?view=azure-devops
Publish build artifacts: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/publish-build-artifacts?view=azure-devops
So the developers could download the .zip files from the pipeline summary page to host and use.

ClickOnce deployment on Azure DevOps release pipeline

I am trying to create ClickOnce deployment on Azure DevOps release pipeline
I create signature, manifest, application, deploy files with certificate
But how can I create the exe and setup file (via Azure DevOps release pipeline)
But how can I create the exe and setup file (via Azure DevOps release
pipeline)
Check document Build ClickOnce applications from the command line: Msbuild has Publish target to build and publish the ClickOnce application. It will generate the setup.exe you want. See similar hint here.
And all above is about doing that in local machine, to do similar job in release pipeline you can use msbuild task or Visual Studio Task with Publish target(/t:Publish as argument).
Then you'll get one app.publish folder where the files you want exist there:
This folder can be used for your further deployment.
In addition:
If you meet error like Unable to find manifest signing certificate in the certificate store, please check the suggestions in this issue.

deploy app to on-prem environments with azure dev ops

I'm building an Azure DevOps pipeline to deploy a custom-build powershell application to several on-prem environments that we support. I configured the required agent pools and installed them as a service on the on-prem environment.
Next, I have set up my pipeline in Azure DevOps, selecting a GitRepo:
Build (with the steps: Use Nuget, Nuget Restore, Build solution, Update version, Copy Files, and Publish build Artifact)
Release (with step: Publish Build Artifact)
Some things are unclear for me:
Do I need the Publish Build Artifacts twice? Can the Build pipeline
end with Copy Files step, and that the Release pipeline picks up this
artifact?
It is my understanding that the release publishes the app to the
on-prem environment (in my case). Where can I set a custom path (ie:
C:\deployed_apps) where the app needs to be deployed? When I tested
this pipeline, I got errors that the path I created using an variable
was not found.
What am I missing in my setup to get this pipeline working?
As #Shayki Abramczyk
pointed out this task is not for deployment, it just upload your Build Artifacts to azure devops server where your release pipeline can download directly.
In your case, if you want deploy your application to several on-prem environments, You need to create a deployment group first, A deployment group is a logical set of deployment target machines that have agents installed on each one. You application will be deployed to those machines in a deployment group in release pipeline. Check here for more details about deployment group.
After the deployment group is created, you can add a deployment group job by click the 3 dots, and then specify your deployment group as below pic shows, You can then simply add a copy file task or other deployment tasks to deploy your application to your on-prem machine.
In the release pipeline you shouldn't use the Publish Build Artifact. in the end of the build you put this step, what this step does? upload your artifacts to the Azure DevOps or to a file share. now in the release pipeline you choose the build artifact (in the left pane). the first thing that the agent does when the release pipeline started is to download the build artifacts to the agent. now you need to take them and deploy it to your environments. how? it depends which kind of application is (it can be just copy files, it can be deploy to IIS, etc.).
You can put the path in the variables tab and use this variable when you deploy the app (with copy files task, for example).

VSTS performs web deploy successful, but website does not work

I am trying to get Visual Studio Team Services (VSTS) to perform a web deploy of my app. According to the VSTS UI the web deploy is successful, but when I browse the deployed web site it shows the default IIS screen ("Welcome - IIS").
This is my publish step in the build pipeline:
This is my release definition:
This is the resulting deploy folder:
Build.log (with replaced values) - https://drive.google.com/file/d/1y6q2Cjr1gxBVMcHeh6n_r7qu-JpJFSyC/view
Do I need to add an additional step to the release pipeline to get the .zip files extracted?
You do not need to add an additional step to extract your zip, but you need to tell the IIS Web App Deploy task to deploy your zip file and not a folder. You have specified a folder for the Package or Folder input, so the task is doing exactly as you told it to do, deploy the specified folder.
If you only have one zip file in your build artifacts, the default value for this field, $(System.DefaultWorkingDirectory)\**\*.zip, will pickup your zip file and correctly deploy it. If you have multiple zip files in your build artifacts, you will need to specify the full path to the zip file in order for it to deploy.

VSTS: Release Management Deploying Artifacts to IIS on Premise

I am using VSTS Release management to deploy artifacts to IIS websites. I have several Web applications and web services to be deployed. So, i am trying to figure out what sort of tasks that best fits my situation.
I have created a build definition with Visual Studio Build Task for projects as this one:
which works fine but i need to add a task for copying the artifacts Under IIS Website Directory.
The other approach is to use IIS web deployment as a task in Release definition, so I created the build definition as:
However, it expects a Publish Profile (the build fails because it can't find it). I don't need to create a publish profile for each project in the application because this would be too much work.
Is there is a workaround for that or what is preferred approach for this?
You can update your build definition to generate a web deployment package and upload it to artifacts. And then in Release Management, add a task to run "projectname.deploy.cmd" in the deployment package to deploy it to your IIS server. Refer to this link for details: How to: Install a Deployment Package Using the deploy.cmd File Created by Visual Studio.
And you can also enable FTP Publishing on your IIS server and add a task in your release to publish the artifacts via FTP. You may need this task:
FTP Uploader.
My Continuous Delivery with TFS / VSTS – Server Configuration and Application Deployment with Release Management blog post (with reference to some previous posts) has all the details you need for deploying your artefacts to target nodes using Windows Machine File Copy tasks then use PowerShell on Target Machines tasks to get them in to correct locations and to do token replacement and anything else that's required.
I would recommend using PowerShell DSC so that IIS is properly configured before deployment but that's not required. Where possible for web apps I favour keeping things very simple by creating artefacts that contain all the web files that are needed for a particular folder and then just using plain xcopy for the deployment.
If you need more control you can also use my MSDeploy VSTS extension to deploy a MSDeploy package
https://marketplace.visualstudio.com/items?itemName=rschiefer.MSDeployAllTheThings
https://dotnetcatch.com/2016/04/20/msdeployallthethings-vststfs-extension-is-public/