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
Related
Suppose I have a Grails application named myCoolApp.
Furthermore, suppose I have defined some basic properties in grails-app/conf/Config.groovy and grails-app/conf/DataSource.groovy under the test and production profiles.
Config.groovy is set to merge with the following .groovy external configuration file, if found at all:
grails.config.locations = ["file:${userHome}/.grails/${appName}-config.groovy"]
Finally, I have also defined, inside an external testing server, such a file, under a local *NIX user path:
/home/appServerTestUser/.grails/myCoolApp-config.groovy
Sadly, I find that for some reason, the external .groovy file's properties are not being merged when a Tomcat instance starts up.
What options do I have to make Grails tell me: "Oh, yes, I found your external config file at: /home/appServerTestUser/.grails/myCoolApp-config.groovy" and these are the properties I merged into Config.groovy?
Thanks!
File-based paths don't make much sense in a deployed app. It could work when deploying on your dev machine for testing, but will likely fail on any other machine. And it'll probably fail locally even if configured with the correct path since the process will like run as a different low-priviledge user.
You can use absolute paths, e.g. /etc/myapp/path/to/file, but this tends to couple deployment to filesystem structure, so if you develop in Windows and deploy on Linux it'd be tricky to get them both working.
So the best bet for Tomcat deployment is to use the classpath syntax. You can specify multiple files and it will load all that it finds, so I usually have one entry for local dev and one for the deployed app:
grails.config.locations = [
"classpath:${appName}-config.groovy",
"file:./${appName}-config.groovy"
]
I delete the entries for .properties files because Groovy syntax is so much more flexible, but use them if you like. I also keep the dev files in the project root (and exclude from source control).
So when deploying, name the file correctly (different apps will have different files, so no clashing there) and put them in Tomcat's lib directory. This is in the classpath, and so the classpath: entry will see it.
I am attempting to get a Grails project working but need help setting it up. I have an Ubuntu server running on a VM that has Redis installed. The project won't run unless I create a config file that can use Redis on the Ubuntu server. This is the settings I pulled down from GitHub located in the grails-app/conf/Config.groovy file.
http://snag.gy/eYhUY.jpg
I was told I need to create a separate config file that will override these parameters so my project will talk to the ubuntu server on my machine. This is a noob question but where do I create a config file? I can't seem to find a .grails folder. I know I'm suppose to reference my config file, once i've created one, in the grails-app/conf/Config.groovy file
http://snag.gy/SpGGt.jpg
Look at the grails.config.locations specified in your Config.grooy and you can create any of those locations for creating the external Config file.
I prefer using the classpath route. Here is what I would do.
Create a folder (say appConfig) and place it in the tomcat/conf folder.
Add the application config file (proghorn-config.groovy in your case) to the folder, with the required configurations in the file.
Add the folder to the Tomcat classpath by updating either the tomcat/conf/catalina.properties or by creating the tomcat/bin/setenv.sh
The location of the .grails folder depends upon the user account running the container (Tomcat, Jetty, etc.) which hosts your Grails application.
For example on Debian 6 running Tomcat 6.x the location is:
/usr/share/tomcat6/.grails/
You can also use static paths as well:
file:/usr/local/tomcat/conf/myspecific-config.groovy
I’ve added a GRAILS_HOME environment variable, which points to the folder in which I extracted the Grails distribution zip, and I’ve added %GRAILS_HOME%\bin to my path. Yet after I open a new command prompt, the “grails” command is still not found. Does anyone have any clue as to why this is happening?
I’m running Grails 2.2 on Windows 7.
I have the same problem on Windows 7 64 bit and Grails version 2.*
By removing local neither maven repository nor installed plugins repository doesn't help.
I found - just set properties of %GRAILS_HOME%/bin/grails.bat and startGrails.bat as Run in compatibility mode: Windows XP (Service Pack 3).
To do that You need to have local PC Administrators rights.
/igors
have you create JAVA_HOME in there?
Maybe you are experiencing [STS-2530] Problem deploying Grails App if workspace path has a space. Jira shows the issue as resolved but it would not hurt to check that you do not have a space in your workspace path as it my trip up grails.
Do the following.
Go to your command prompt, execute the Path command. If everything has been set right your paths should show up as complete paths starting with C:... If the paths show up with the % sign that means your paths need to be set correctly. I did noticed that in your example you have used the forward slash - I am assuming that is a typo, because that will be a problem.
Another way to trouble shoot the issue is CD to the location C:\Grails\bin, execute the command grails.bat, if it executes you are in a good place that means you have to tweak your paths - following this path might give you a clue about other issues....
You might want to check the bin folder of your grails installation. The grails.bat file could be missing. I had this problem today and solved it by downloading the zip file again.
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 have in my main config something like:
grails.config.locations = ["file:grails-app/config/Jawr.groovy"].
When running the application with grails run-app, everything is OK.
But, on deployment (creating the war archive) this does not work anymore, as the file "Jawr.groovy" is not kept anymore on the filesystem (it should be only in the war).
Do you have a solution for that? Hw do you include external files into the grails main configuration file?
Thanks.
Okay, a few things here.
First, because you don't have a leading slash on your config path, that is a path relative to who knows where. I played with this in Tomcat, and that path ends up being relative to the working directory you were in when starting the Tomcat server. If you start Tomcat, shut it down, change directories, then start it again, you are going to get two different config paths.
Second, the grails-app directory only exists within the source tree of your Grails project. The structure of an unpacked WAR file is more like the web-app folder of your Grails source tree, with folders like WEB-INF, META-INF, js, images, etc.
Third, you probably want to avoid putting your externalized config file inside the folder of your webapp. The next time you deploy your app, that configuration is going to get wiped away with the old version of the app. One of the points of the externalized config is so that you can redeploy without having to reconfigure.
A simple, but less than ideal, solution would be to use a static, fully qualified path, like /etc/yourApp/conf.groovy, then put that in the documentation. There is also a plug-in that handles this.
http://www.grails.org/plugin/external-config
I haven't used it, but the description makes it sound like it does sensible things.
see this: https://stackoverflow.com/questions/6341117/is-it-possible-that-grails-xxconfig-groovy-as-a-script-no-compile
Then I put it into /shared, and
modify:
//Config.groovy
grails.config.locations =
["file:shared/TZLibConfig.groovy"]
//BuildConfig.groovy
grails.war.resources = { stagingDir, args ->
copy(todir: "${stagingDir}/WEB-INF/shared"){
fileset(dir:"shared",includes:"**")
}
}
In my work, our team often use a system properties to save the path to the config file (often in home folder of the user running the app - for privilege sake). Then we manually copy the config file into that path
To identify that it's the production environment, we use the following code in Config.groovy:
if (System.properties["${appName}.config.location"]) {
grails.config.locations = ["file:" + System.properties["${appName}.config.location"]]
}
This article suggests allowing the user to specify the location of the config file as an environment variable or as a java property --- meaning you can simply specify it with -D on the command-line. This can be used in addition to all the other methods.