Files have been deleted after deploy - azure-devops

I'm using Azure DevOps to deploy my source in a WebApp.
I have two pipelines for two projects, the first project have been deployed like a charm, but the second not!
When I deploy the second project for a moment I saw the files in wwwroot folder from Kudo Editor, but after some seconds the files disappear and return the old files (webapps folder and hostingstart.html)
I noticed an AppSetting that not appear in first WebApp after deploy:
WEBSITE_ENABLE_SYNC_UPDATE_SITE
But in documentation I didn't find something that impact it.
Ps: Perhaps wrong, I'm using the same AppService Plan in both WebApp. I think this not impact because the first project works well.
Some help?
Edit:
In /data/SitePackages/ has all zip's from my tries of release,
so the deploying is working, but for some reason instead of unzip in wwwroot folder, only appear after release a webapps folder inside wwwroot.

In you web app deploy task, under additional deployment options, make sure that you have the same deployment method for both of the deployments.
Ideally, Web Deploy.

Related

Missing files from bin folder after azure zip deploy

I am using azure build pipelines to deploy my custom solution into an existing one, but after deployment some dlls from the existing solution get removed, I am using zip deploy method and after some research I found this method will delete files that were part of a previous deployment and are not in The deployment artifact.
based on Microsoft article here for zip deploy, it says : Deletion of files that were left over from earlier deployments.
It is a module that needs to be deployed on top of existing solution that has other modules as well, so i don't need other dlls to be removed, I just want to deploy my solution dlls on top of an existing one. any idea how this can be done ?
From the Zip deployment doc: https://learn.microsoft.com/en-us/azure/azure-functions/deployment-zip-push. When you use .zip deployment, any files from an existing deployment that aren't found in the .zip file are deleted from your function app.
You could try using "Web Deploy" method and disable "Remove additional files at destination" option.
Also, you could use "Exclude files from the App_Data folder" with additional arguments to prevent files in the App_Data folder from being deployed to or deleted from the Azure App Service. Refer to this ticket for details: Azure Pipelines: Exclude folders using Azure App Service Deploy

Deploying web app from Visual Studio Code to Azure but leave out a data folder

I am building a very small Node/Express API app in Azure using Twilio to route communication for a small group. I initially built out a data structure for users in CosmosDB but found out it's minimum $24 per month, which is way over budget for something that will likely hold 20 or so records. Because of this, is seems much more reasonable to just build this into a json file that sits in a ./json subfolder. However, it has occurred to me that whenever I deploy, I would be overwriting this file with the default file I have locally. I have been working via the Azure App Service tool in Visual Studio Code and can't figure out a way to make it ignore the file.
I can go into Kudu and copy the file down each time before I deploy, but I will eventually forget and this sounds like a very brittle process.
I added a json/ line to .gitignore, but that has no effect on the deployment (as expected).
I also added "appService.zipIgnorePattern": ["json{,/**}"] to the settings.json file, but instead of just ignoring that folder on the server, it erases it on deploy (the zip ignores it and then it wipes/replaces the whole wwwsite folder). Looking for the file gives me {"Message":"'D:\\home\\site\\wwwroot\\json\\users.json' not found."}
I was hoping there is a setting that would deploy, replacing all folders in the package, and ignoring all content in the ./json folder. Does this exist?
Alternative solution, 2021:
Instead of excluding folders, select the folder that you do want to deploy. Data in other folders will not be affected.
Deploy from: edit .vscode/settings.json in your local project and add "appService.deploySubpath": "./folderToDeploy"
Deploy to: In the Azure Portal go to your app service. Under Configuration / Application Settings add a new Application Setting with name SCM_TARGET_PATH and value ./folderToDeployTo
Using VS Code right+click deploy will deploy the contents of the folder. I was able to work around this by adding Azure as a remote branch and using .gitignore. I placed my json file inside a random folder (content/json) then placed /content/json in my .gitignore file.

Setting up build and deployment for a solution which have three web projects that needs to be deployed with Azure DevOps

I have a solution in VS where I have multiple projects but three of them need to be deployed in different azure web applications.
I have read tutorials where all of them show you these simple steps:
Setting up a build (pointing a .sln file)
Getting an artifact in a .zip file
Setting up a release pipeline where you select the artifacts (.zip file) and select the azure web application you want to deploy the artifact.
All that is fairly simple and works well when you have one web application in your solution. In my case it doesn't work because I think the artifacts have multiple application and I'm not giving any information to the deployment pipeline how it will select only one application from the zip file for each Azure Web Application.
How is the better way to approach it?
You have to change your way of build. Instead of building the solution (.sln) you can use (.csproj) (assuming you have a common .sln file which is having multiple .csporj)
Steps:
Setting up the build - pointing projectA.csproj
Setting up the build - pointing projectB.csproj
Setting up the build - pointing projectC.csproj
Getting all the artifact in a separate zip ( 3 zip)
During the release you can deploy the corresponding artifact (zip) to your azure web apps
Lets say if you have a common .sln which is having a 3 separate .sln solutions. you can follow my answer here

Copying files and deploying to Azure without building using Visual Studio Team Services

I'm attempting to deploy a web site to Azure using VSTS. Basically, I commit code to the GIT repo and have it setup to run CI, so it begins building as soon as I commit. However, once it hits the release section, it never copies the code to the Azure web app, rather, it gives me this line:
Info: Updating file ({projectname}\error.txt).
It doesn't copy the files I changed, but rather always just copies this file. I checked and there is indeed an error.txt file in my website directory in Azure, but it is always blank.
This build/deploy process isn't "standard" because the build step only downloads from source code, it doesn't build, because the website isn't a "web application", but rather just a "web site", meaning it doesn't need to be built.
So my build step is as follows:
Get Sources
Run on Agent - this step is empty
so the idea is that it just downloads everything from source control, that's it.
Then, my release step is as follows:
Artefacts are from build step above
deploy to environment 1 (dev)
Azure app service deploy, using "package or folder" as $(System.DefaultWorkingDirectory)/
Any idea what I might be doing wrong here?
So I actually figured this out and will leave this here in case anyone else needs it.
I admit I'm pretty new to the Azure/VSTS world, so maybe someone else is making my mistake as well.
If you don't need to "build" your project, then don't. I resolved it by simply skipping the build step altogether. What I was really after was to just download the files from source control and deploy them as-is.
In your release editor, you can specify which "artifact" you want to use to release, and one of the options is source control, which is what I did.
This would be useful for websites like mine where you don't need to build them (mine is DNN/DotNetNuke, so you don't build it before deploying).

Deploy build files from continuous integration

I am working on a project with multiple people, a website application which requires webpack to be built, uglified, concatenated into a few files e.g. app.min.js, style.min.css etc. - As a result of this, in an effort to prevent merge conflicts we recently added the build folder to .gitignore, under the assumption that we would be able to build during deployment.
When pushing to the Master branch, we automatically "deploy" through Semaphore CI (similar to Travis) which runs composer install, npm install, and finally "npm run build" which triggers the webpack build. This is all built and then tested on the CI side of things, and then Semaphore automatically deploys to Amazon's Elastic Beanstalk where our application is hosted.
The problem with this is, it seems Semaphore doesn't upload the build it's just tested, but rather the Master branch itself which has no built JS or CSS. I'm wondering if there's a way to push these built files to deployment as well, or if running the entire build process AGAIN on Elastic Beanstalk is the only route. It seems unnecessary to have to do that process essentially 3 times, locally, CI, and then deployment. Every time a step like this is needed on EB the actual re-instantiation time gets longer, which I'd like to keep as short as possible.
Obviously if building it a 3rd time on EB is the only way to go about this then I'll have to, just wondering if there are better solutions for this whole workflow.
I haven't worked with Semaphore CI, but you might be able to use an .ebignore file.
If you create one, the cli will use that instead of your .gitignore file.
I find in some deployment situations you want the inverse of your .gitignore (all compiled, no src). It essentially lets you pick the files from your project directory that you want to deploy, in the same way as the .gitignore file.
Edit: I just noticed the documentation on aws is lacking. It only mentions file exclusion, but you can include files too.
Edit 2: I don't think Semaphore supports the use of .ebignore, so right now this solution isn't of any use. :(
I just had a great first experience with https://deploybot.com/. The can deploy directly to elastic beanstalk. It might be interesting or you.