how create msdeploy package without absolute path in content folder? - azure

I have a problem related to creating msdeploy package for deploying to azure web app.
I run msdeploy -verb:sync -source:contentPath="C:\inetpub\wwwroot\<SiteName>" -dest:package=test.zip And after investigating package i found that it contains a full hierarchy of folders eg: \Content\C_C\inetpub\wwwroot\<SiteName>\ and when i am trying to deploy this package to azure a have an exception because i don't have such permissions.
Question: how to remove path from content folder so my archive will looks like \Content\<SiteName>?

After a day of investigation i figure out how to do this:
$msDeployPackageCommand = "$MsDeployExePath
-source:iisApp=$PathToApplication
-dest:package=$ZipCreationPath
-verb:sync
-enableLink:contentLibExtension
-replace:match=$ReplacePathToApplication,replace=$replaceWith
-retryAttempts:2
-disablerule:BackupRule
-declareParam:name='PackageManagementService',kind='ProviderPath',scope='IisApp',match=$ReplacePathToApplication,defaultValue=$replaceWith";
This works fine.

Related

AWS Elastic beanstalk - My deployed app can't seem to write pdf's into this directory i've set up in my project folder

I am currently using nodejs that is deployed in ebs on aws. I have a function that will write a pdf and then email it off but it says the file path can't be found. I've verified the project file seems to be /var/app/current/, but changing the reference of the file path doesn't seem to remove the error. Any idea how to go about fixing this?
The /var/app/current/ does not exist initially. Its only created at the very last stage of your deployment.
The deployment happens in /var/app/staging/ folder, and at the very last, once everything finishes, /var/app/staging/ is moved into /var/app/current/.
Thus, I would not recommend using absolute paths in your project or config files. Its better to use relative path or container_commands for config scripts:
The specified commands run as the root user, and are processed in alphabetical order by name. Container commands are run from the staging directory, where your source code is extracted prior to being deployed to the application server.

Teamcity deploy command line

I've configured TeamCity for build and deploy IIS app.
Everything works fine. Here is my command line param:
-verb:sync -source:package="webapi-%dep.xxx.build.counter%.zip"
-dest:contentpath="C:\inetpub\wwwroot\test2.com\bin",computerName="www",userName="uuu",password="ccc",includeAcls="False"
-AllowUntrusted -verbose
So, artifacts zip file should extract files to C:\inetpub\wwwroot\test2.com\bin folder. In bin folder i have a lot of xml and config files (zip file dont include this files). In every deploy it delete bin folder and extract zip files.
How can I skip deleting? I just need publish with replace what i have in archive without deleting another files?
Thanks for help
add one more parameter:
-enableRule:DoNotDeleteRule
according to doc:
In a sync operation, blocks deletions of files on the destination computer that do not exist on the source computer. This rule applies to the contentPath, dirPath, and filePath providers. This rule is disabled by default.

msdeploy.exe: Deploy only changed files

I am using msdeploy.exe for deploying my project to remote iis site using below command
msdeploy.exe -source:iisApp="D:\publish" -dest:iisApp="test-site",ComputerName="https://url:8172/msdeploy.axd?site=test-site",UserName="u",Password="p",IncludeAcls='False',AuthType='Basic' -verb:sync -enablerule:AppOffline -enableRule:DoNotDeleteRule -retryAttempts:20 -allowUntrusted='True'
But it is always uploading each an every file during deployment.
Is there any way so that i can upload only changed files using msdeploy.exe?
Solved using -useChecksum paremeter

Azure webapp deployment fails after removing Composer SiteExtension

I had Composer Site extension installed till now on azure php webapp.
I need custom deployment that can run grunt tasks also. So I created the .deployment and deploy.sh files in project root. But that deploy.sh is not being picked up.
.deployment file contents:
[config]
command = bash deploy.sh
Looking at the deployment logs, I find this
2017-05-04T06:21:03.9301086Z,Updating submodules.,8bc3029f-d77b-4c1e-860f-a3d439d7a354,0
2017-05-04T06:21:03.9926050Z,Preparing deployment for commit id 'e2b45fb52b'.,61c286b1-5c00-4c11-ae14-54e0711d6857,0
2017-05-04T06:21:04.2632947Z,Running custom deployment command...,e71c397e-bc63-4357-abc4-acd49bc2041d,0
2017-05-04T06:21:04.3101663Z,Running deployment command...,24db1c4f-8a51-463b-8c4a-ee040bc5dfd8,0
2017-05-04T06:21:04.3101663Z,Command: D:\home\SiteExtensions\ComposerExtension\Hooks\deploy.cmd,,0
2017-05-04T06:21:04.4039215Z,The system cannot find the path specified.,,1
2017-05-04T06:21:04.4195462Z,The system cannot find the path specified.\r\nD:\Program Files (x86)\SiteExtensions\Kudu\62.60430.2807\bin\Scripts\starter.cmd D:\home\SiteExtensions\ComposerExtension\Hooks\deploy.cmd,,2
Seems like somewhere the trigger for Composer site extension still remains which is being invoked during deployment.
How can I completely remove Composer site extension and use my custom deployment script deploy.sh? Thanks in advance.
Found the problem. After uninstalling Composer SiteExtension, this environment variable is still present APPSETTING_COMMAND = D:\home\SiteExtensions\ComposerExtension\Hooks\deploy.cmd. Deleted the environment variable using kudu console and then deployment succeeded.
After removing the Composer Extension the APPSETTING_COMMAND remains as an environment variable.
Use the Kudu PowerShell command Remove-Item Env:\APPSETTING_COMMAND to remove the variable online.
Alternatively, restarting the App Service via the overview tab will refresh the environment variables, though this could be a little invasive.

MSDeploy - sync command to copy files to subfolder of iis app

I want to perform a post-build step to copy some files into a website folder using MSDeploy.
Eventually I'll be doing this to a remote location (specifying computerName, userName switches etc.), but for now I'm running it locally:
"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe"
-AllowUntrusted -verb:sync
-source:dirPath="D:\files_to_copy"
-dest:iisApp="My Website Name"
This works, but it removes all contents of the website folder and replaces them with the contents of "D:\files_to_copy" (as you might expect!). So I was wondering how I use this simply copy to a subfolder within the site?
I've tried -dest:iisApp="My Website Name/my_subfolder" but this just creates a new IIS app called "my_subfolder" nested within the existing IIS app.
There are providers other than iisApp, maybe dirPath is the one you want for -dest aswell?:
dirPath: The dirPath provider synchronizes directory content.
filePath: The filePath provider synchronizes individual files.
iisApp: The iisApp provider synchronizes directory content to a folder and marks the folder as an application.
contentPath: The contentPath provider synchronizes Web site content.
Anders's answer above provides the correct information, but the full code I used to successfully carry this out is as follows:
"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe"
-AllowUntrusted -verb:sync
-source:contentPath="D:\files_to_copy"
-dest:contentPath="My Website Name\my_new_folder"
Adding a single file to the root of the site (for example robots.txt) can be done using the following:
"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe"
-AllowUntrusted -verb:sync
-source:contentPath="D:\my_folder\robots.txt"
-dest:contentPath="My Website Name\robots.txt"
Hopefully this is a useful example for others in the future.

Resources