I'm trying to configure a build and release pipeline in VSTS so that I can push a build to a variety of environments. To accomplish this, I'm leveraging the parameters.xml file for MSDeploy, as well as using a Tokenizer task to overwrite the tokens that are set in the SetParameters.xml file after.
When I deploy to the site, it does reach the destination computer and deploy there, but the path is incorrect. Instead of copying to the virtual directory of the web application that I've specified in parameters.xml, it seems to take the path that is in the package and copies that (so, C:\agent_work...).
I know that the tokenizer and at least part of parameters.xml and SetParameters.xml is working and correctly transforming connection strings, as the generated web.config does have those values correct, but the IIS Web Application Name parameter doesn't seem to be working.
I did get this to work if I create my own publish profile and hard code the site name in the DeployIisAppPath and use that to package instead. This isn't ideal, though, as I want to have the site name as a parameter.
Here are all relevant files. Let me know if you need more info. Thanks so much in advance!
parameters.xml
<parameters>
<parameter name="IIS Web Application Name"
description="Please specify the IIS Web Application Name"
defaultValue="__IISWebApplicationName__">
<parameterentry kind="ProviderPath"
scope="IisApp"
match="#defaultValue">
</parameterentry>
</parameter>
</parameters>
VS Solution Build Task Arguments
/p:PackageAsSingleFile=true
/p:SkipInvalidConfigurations=true
/p:PackageLocation=$(build.artifactstagingdirectory)
/p:AllowUntrustedCertificate=true
/p:IncludeSetAclProviderOnDestination=False
/p:DeployOnBuild=true
/p:AllowUntrustedCertificate=true
/p:WebPublishMethod=Package
/p:SkipInvalidConfigurations=true
/p:DisableAllVSGeneratedMSDeployParameter=true
SetParameters.xml after packaging
<?xml version="1.0" encoding="utf-8"?>
<parameters>
<setParameter name="IIS Web Application Name" value="__IISWebApplicationName__" />
</parameters>
Release Task Environment Variable Configuration
Name = IISWebApplicationName
Value = Site Name
MSDeploy Configuration
Destination Provider: auto
Destination Computer: https://{server}:8172/msdeploy.axd?site=$(IISWebApplicationName)
MSDeploy Commmand
msdeploy.exe -verb:sync -source:package='C:\agent\_work\r4\a\{buildName}\drop\{packageName}' -dest:auto,computerName='https://{server}:8172/msdeploy.axd?site=Site Name',userName='xxx',password='xxx',authType='basic',includeAcls='False' -allowUntrusted -setParamFile=C:\path\to\param\file -verbose
You can deploy web app to IIS by using IIS Web App Deploy task, then you just need to specify Website name with variable directly.
Configure Deployment group
Edit release definition
Add Run on deployment group
Add IIS Web App Deploy task and specify website name
On the other hand, the WinRM: IIS Web App Deployment task in IIS Web App Deployment Using WinRM extension works fine two (Do not need to configure deployment group.)
Related
I have 2 .properties files for my project on hybris .
First one is used for CI process and as a result a got 4 zip files with my already built platform(after ant production).
On my prod instance i need to switch to another properties because there are all my connections to extended services such as mysql solr.. etc
How i can do that without running all ANT steps.
. ./setantenv.sh && sync && ant config -Denv=my_new_properties
then ./hybrisserver.sh start doesn't work.
There is no information on wiki https://cxwiki.sap.com/display/release5/ant+production+improvements
Check if Updating Configuration Settings at Runtime will be useful for you. You will need to use the FileBasedConfigLoader class and the runtime.config.file.path property.
Other best practices include using system variables for secure settings like DB URL. See "Using Environment Variables instead of Files for Secure Settings" section in Configuring the Behavior of SAP Commerce.
Another option you can look at is to have different config folders for different environments (e.g. config-dev, config-prd), and pass it to ant. e..g -Denv=config--dev
Worklight Knowledge Center has the following documentation for using ant to deploy an app to Worklight server:
<app-deployer deployable="app.wlapp"
worklightServerHost="http://server-address:port/contextroot"
userName="username" password="password" />
But it doesn't provide any detail on how to specify contextroot. So I tried the following but none of them work:
worklightServerHost="http://localhost:9080"
worklightServerHost="http://localhost:9080/worklight"
How can contextroot be specified?
The context root by default is your Worklight project's name. So if you project is called MyProject, that's your context root. Change it to that.
Keeping the project name as-is, but using another for the deployment is set-up I believe in the server.xml file.
I'm using the Grails stack on Heroku to deploy an app. I'd like to be able to serve my app with a root of myapp.herokuapp.com/xyz as opposed to myapp.herokuapp.com, in the same way I'm able to serve from root of localhost:8080/xyz in development. I've tried adding a grails.app.context in Config.groovy like so:
environments {
production {
grails.app.context = "/xyz"
}
}
But it doesn't seem to have an effect in deployment. Do I have to configure something with Heroku? Any ideas?
It looks like you have to add a jetty-web.xml file to the WEB-INF directory to set the context path:
<?xml version="1.0" encoding="UTF-8"?>
<!-- File: web-app/WEB-INF/jetty-web.xml -->
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure class="org.mortbay.jetty.webapp.WebAppContext">
<Set name="contextPath">/xyz</Set>
</Configure>
If this helps proper credit goes to this site, which was linked from an article on Grails and Heroku by Tomas Lin.
I don't think you can set context path with the current Grails build pack. If you feel like it, you can fork the build pack and hack it to support setting context (see build pack doc for more info on build packs).
Another option is to build your Grails app locally into a WAR file and deploy the WAR file using WAR deployment. The WAR deployment process will use the webapp-runner utility to run your app with Tomcat and it supports configuring the context path. Here's the help output for webapp-runner 7.0.22.3 (what I happened to have installed, might be slightly out of date):
Tomcat Runner runs a Java web application that is represented as an exploded war in a Tomcat container
Usage: java -jar tomcat-runner.jar [arguments...] path/to/webapp
Arguments:
--session-timeout The number of minutes of inactivity before a user's session is timed out
--port The port that the server will accept http requests on
--context_xml The parth to the context xml to use
--path context path (default is /)
--session_manager session store to use (valid options are 'memcache')
--session_manager_operation_timeoutoperation timeout for the memcached session manager. (default is 5000ms)
--session_manager_locking_modeSession locking mode for use with memcache session store. (default is all)
--session_manager_ignore_patternRequest pattern to not track sessions for. Valid only with memcache session store. (default is '.*\.(png|gif|jpg|css|js)$'
As explained in the WAR deploy doc, you can set webapp-runner options for your webapp using the WEBAPP_RUNNER_OPTS config var.
I am trying to deploy a console application to a folder on a DMZ server using autodeploy with MSBuild and Team Foundation Server.
I am already deploying multiple sites to that same server and it works great. I have tried multiple ways but the files are not deployed.
First, I tried to deploy the console app in the same way as i do for my web site, ie:
<MSBuild
Projects="$(SolutionRoot)\MySolution.sln"
Properties="AllowUntrustedCertificate=True;AuthType=Basic;
Configuration=DEBUG;CreatePackageOnPublish=True;
DeployIisAppPath=Default Website/dummy.dev.myapp;
DeployOnBuild=True;DeployTarget=MsDeployPublish;
MSDeployPublishMethod=WMSvc;
MsDeployServiceUrl=https://xxx.xxx.xxx.xxx:8172/MsDeploy.axd;
UserName=userid;Password=password;UseMsdeployExe=True"
/>
Without success.
EDIT: No error message is returned. It all seems to go well.
Then, I also tried to deploy the console app as follows:
<Exec Command=""C:\Program Files\IIS\Microsoft Web Deploy V2\MSDeploy.exe"
-verb:sync
-source:contentpath="$(OutDir)\MyApp.Precompiled"
-dest:contentpath="D:\dev.myapp",computername=xxx.xxx.xxx.xxx,username=userid,password=password"
ContinueOnError="false" />
I actually also tried with computername as https://xxx.xxx.xxx.xxx:8172/MsDeploy.axd.
EDIT: The following is what I got.
EXEC: FileOrFolderNotFound
EXEC: Object of type 'contentPath' and path 'E:\Builds\1...\dev.myapp' cannot be created.
EXEC: The path '\?\E:\Builds\1...\dev.myapp' is not valid.
EXEC: 1.
E:\Builds\1...\BuildType\Targets\Deploy.targets (142): The command ""C:\Program Files\IIS\Microsoft Web Deploy V2\MSDeploy.exe" -verb:sync -source:contentpath="E:\Builds\1...\dev.myapp" -dest:contentpath="D:\dev.myapp",computername=https://xxx.xxx.xxx.xxx:8172/MsDeploy.axd,username=userid,password=password" exited with code -1.
I realize I haven't read all of the error, Do I really need an UNC path?
Does anyone know how to do this?
I finally found out how to make it work.
<Exec Command=""C:\Program Files\IIS\Microsoft Web Deploy V2\MSDeploy.exe"
-verb:sync
-source:contentpath="$(OutDir)\MyApp.Precompiled"
-dest:contentpath="D:\dev.myapp",computername=https://xxx.xxx.xxx.xxx:8172/MsDeploy.axd,username=userid,password=password,authtype=Basic
-allowUntrusted=True"
ContinueOnError="false" />
I changed computername to computername=https://xxx.xxx.xxx.xxx:8172/MsDeploy.axd, added authtype=Basic and allowUntrusted=True and voila it worked.
It was quite frustrating not having any kind of feedback of what went wrong with the first option. But when I was using the second alternative I got feedback to work with.
If anyone know how to make this work using the MSBuild task, please feel free to enlighten me.
Try dirPath provider instead of contentPath, it'll behave more like a folder sync rather than IIS web site deployment.
Considering the sync worked using the EXEC task, did you make sure you have the Microsoft.WebApplication.targets in your csproj (or vbproj) file? I could see it just ignoring that msbuild task without the correct targets file included.
For example in my web service project files, I have this towards the bottom of my csproj file
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
I am using the Ant wldeploy task to deploy a war file.
It is working fine, but the war file path in the deployed server is set to something like
servers/myadminservername/upload/mywarfilename/app
Instead, I would like to set this path myself in the Ant buildfile.
Can any one please help me with that?
The task I am using for this is:
<wldeploy action="deploy" verbose="false" debug="true"
name="ClientProfileSyncPortTypeImplV8"
source="${results.war.file.dir}/ClientProfileSyncPortTypeImplV8.war"
upload="true" adminurl="t3://${serverip}:${port}"
user="${admin_id}"
password="${admin_pw}"
usenonexclusivelock="${lock}"
targets="${target_managed1}">
</wldeploy>
I think you can edit the config.xml and specify the path of your deployment.
The upload, targets and stage / nostage / externalstage attributes of the wldeploy task give some control over where the deployment is made to.
I ended up deleting the app and the deploying it from ant, accepting the path it chooses. Now I can deploy and redeploy just fine. It's really neither here nor there to me where the ear lives - I was just sad that when I deployed in the UI I couldn't redeploy using ant.
I know this is an old post but I have a partial solution for anyone who stumbles across this question
From the path: "domain/servers/myadminservername/upload/mywarfilename/app" you can change the first part of this (You can edit the "servers/myadminservername/upload") to go to any directory relative to the WLS domain.
Go to the Administrator Console (using: serverIP:serverPort/console) and in the left hand side follow the tree:
environment -> servers -> (AdminServerName) -> Configuration -> Deployment -> Upload Directory Name
The "Upload Directory Name" can contain a path to a directory that is relative to the domain.
So at least "domain/servers/myadminservername/upload/mywarfilename/app" can become "domain/path_of_your_choice/mywarfilename/app"
Hope this helps someone