I want to deploy my war file under several names, just renaming it seems to work fine on tomcat. This obviously then gives me different URLs. I have used request.contextPath to find my own URL within the application while it is running, but if I want e.g. to name the database file after the war file in Datasource.groovy, then there is no request object for me to look at and I am out of luck. How do I do this?
How about if you configure separate config files for each deploy using Externalized configuration
Only the values that are different for each deploy need be in these files. Then every time you create a new war, you also create a new config file for this deploy.
(of course you need to manually create it every time, but i figure you could write a script for that or use a find/replace)
Related
Right now I'm using EnvInject plugin to insert my environment variables through a properties file into my Jenkins job.
However, now I have a second job which needs the same environment variables as the first job and than some more additional variables which I would like to load via another properties file.
I know, there is a possibility to insert the values via Properties Content Edit field of the EnvInject-plugin, but I would like to keep it in a file, so it can be shared between jobs. But there seems to be no possibility to add a second properties file to EnvInject-plugin.
Is there any way to inject more than one properties file into a job or any other plugin, that could handle my scenario?
There is a simple way to get around the limitation you have.
You should load each file in the Build section, as a build step.
Use the Inject environment variables build step, and load each file you want. You can add multiple files by setting up multiple build steps of this type.
This works well for me on a similar need.
You can use Config File Provider Plugin to config some shell scripts.
You can add multiple files and then execute them.
We have a solution stored in TFS that deploys to SharePoint. As part of the solution we have a config file that has a path to a specific site. The problem is this path changes dependent on the users dev machine e.g
<site>devmachine1/somesite</site>
<site>devmachine2/somesite</site>
This can obviously be updated to work locally after a check out however when the file gets checked back in it will be incorrect on the next users machine if they do a Get. Is there a way that the file can be excluded or a script can be run to update the path when checked back in or out?
The best option I'd to rationalist all of the developer workstations.
I would do this by adding an identical entry to the hosts file that hard coded the name of the Sharepoint, allowing you to have the same config file work on every dev machine.
Make it dynamic by having a pre build instruction that adds the host, that way any developer can get and build.
You can use a custom check-in policy to update back the file when is checked-in. See here
let's say I am developing 2 applications for 2 different clients which are, using 2 different database-configurations.
When using Openshift and CakePHP it is considered good practise to not store the real connection-info in the configs, but instead to use environment-variables.
That way the GIT-Repo is also always clean of server-specific stuff.
That is all fine as long as I have ONE project but as soon as there is another one, I need to override my local env-vars according to the current project.
Is there any way to avoid this? Is it possible to set up env-vars on my local machine per directory or something like that?
I am running OSX with Mamp Pro.
This may not be the best solution, but It would work. Create a different user on your local machine and then change to that other user when you need to access those other environment variables.
I create a 'data' directory in my git repo and set it to ignore. This way anything in there will be saved in the repo and sent to openshift. I place a config.ini file with all the info that I don't want in my repo.
I then manually put that config.ini file in Openshift's persistent DATA directory by using winSCP. You only have to do this when you change your config.ini.
When my app runs it detects if it's local or on Openshift and loads the config.ini file from the correct directory.
I would be interested if somebody has a better idea.
HTH
I am trying to send a variable to my grails app through the command line similar to this:
grails -Dmy.build.number=33 prod war ROOT.war
I have tried to access it as grailsApplication.config.my.build.number but I get an empty map. It seems odd that the variable is defined but not set to what I send.
How do I access the command-line property?
I am planning on putting some of my assets(css,js,images,etc) in cloudfront to act as a cdn. So in my build phase I want to use the build number as a cache buster and set my assets to point to mycloudfronturl/assets/${buildnumber}/script.js. If there is a better approach, I'm open to that as well.
System.getProperty("my.build.number");
I have a Rails application which I now plan to deploy many instances to different domains. Originally I only intend for it to be on one domain.
I realize that for each domain, I have to replace all the hard-coded values in various places. These include:
asset host path (assets reside on the same domain)
whenever-gem's :application setting (since two domain can share the same server, and this is to avoid crobtab update clash)
some of tasks which uses curl to its own address to trigger events
carrierwave needs a hardcoded value when computing image full url without the request object.
Question
Is there a strategy to set this, so:
the setting should not be commited into source control (like database.yml.example)
Codes outside Rails can access it (whenever-gem does not load Rails environment)
Ways to access the domain can be consistent
One approach you can take is to have a YAML file with per deployment properties. You could even check the development version in and have your deploy scripts overwrite with the correct version.
Typically I'd put that configuration file in shared/config (assuming a capistrano style layout) and then symlink it into the current release during the deploy.