Worklight Server Configuration on different WAS Server - ibm-mobilefirst

We have a scenario where we have different app servers like Dev/QA/Stage/Prod and all have different configuration settings (Which normally every Org have) like hostname/portno/jndi etc
My questions are:
What is the best way to deal with different environment server (Dev/QA/Stage/Prod) with different config settings.
Where and how can we set these properties for the worklight project?
Also can we set some configuration file in Worklight project with different environments so that it can change the hostname/port at run-time depending on the environment.
If any one have done this before, please guide on this and if feasible provide any sample file. If someone answer question no three (3), that will help me alot.
Thanks

It is possible to manage different worklight environments using multiple copies of worklight.properties ( eg worklight.properties.STAGE etc) and changing the settings in there for the target environment. This way when you build for each environment the required settings are picked up.
If you do not want to build for each environment you can uninstall the worklight war file and reinstall it by setting jndi properties with required environment variables. This will create entries in the server.xml file that correspond to settings in worklight.properties
Also you can use <include optional=true>additionalServerConfig.xml</include> in the server.xml for was and store configurations for each environment in separate xml files for the given environment and import them using this include mechanism.
Here is a link to some slides I put together on setting some of these things up
https://slides.com/donalspring

Related

Advanced setting not surviving application build - Sitefinity

I'm changing a value in the advanced settings of the CMS, specifically the ProviderTypeName of Blogs -> Providers -> OpenAccessDataProvider
However, when rebuilding the site the setting is reverted to its default.
I believe this is happening because the property is stored in a file, and my build and deployment is overwriting it with whatever is in my repository.
Where is this setting stored in the file structure; or if I'm way off base in my assumption, how do I get this setting to stick?
You right, most probably you overrode configuration changes during the deployment. Most of the time, I am excluding all configuration during website deployments and from VS project.
By default, Sitefinity 10 is using a hybrid mode that stores configuration files on both the file system App_Data/Sitefinity/Configurations and the database in table [sf_xml_config_items]. Documentation: https://docs.sitefinity.com/auto-storage-mode-of-configurations
Also, there is a way to move configurations to database only: https://docs.sitefinity.com/database-storage-of-configurations

How to manage database credentials for mule proejct

I am using database connector component, with vault component to store the database credentials. Now as per the documentation of both components i have created different properties file for each environment to store the encrypted credentials for diff env.
Following is the structure of my mule project
Now the problem with this structure is that i have to build new deployable zip file whenever i have to update the database credentials for any environment.
I need a solution where i can keep all credentials encrypted and centralized and i don't have to create a build every time after updated the credentials, We can afford to restart the server, but building new zip and deploying is really cumbersome.
Second problem we have this approach is a developer needs to know the production db to update it in properties file, this is also a security issue.
Please suggest alternate approach for credentials management for mule projects.
I'm going to recommend you do NOT try to change the secure solution provided to you by MuleSoft. To alleviate the need for packaging and deployment, you would have to extract the properties files outside of the deployment and this would be a huge risk. Regardless of where you store the property files within the deployment if you change the files, you have to package and re-deploy. I see the only solution to your problem as moving the files outside of the deployment and securely storing them. Mule has provided a solution while it may be cumbersome, they are securing these files first with encryption and secondly within the server container. You can move out the property files but you have to provide a custom implementation and you will be assuming great risk to your protected resources.
Set a VM arguement e.g. environment.type=local for local machine on your anypoint studio.
Read this variable in wherever you are reading your properties file in a way that environment type is read dynamically such as below.
" location="classpath:properties/sample-app-${environment.type}.properties" doc:name="Secure Property Placeholder"/>
In order to set the environment type on your production server(or wherever you are using mule runtime), open \conf\wrapper.conf and add the arguement wrapper.java.additional.=-Dserver.type=production. If you already have any property in this file, you may need to set the value of n appropriately. For example 13 or 14.
This way you don't need to generate different deployment artefacts for different environment because correct properties file is picked by using environment specific VM arguement.

Can I provide configurations to a plastic scm sever to automate it's installation?

So I'm trying to automate my Plastic SCM server. But I can't find any way to install all the configurations without a prompt running clconfigureserver in the sever even though I've read the Admin guide a bunch of times looking for something.
So far I'm thinking that just replacing the XML files in /opt/plasticscm5/server/*.config should work. But now I need to figure out how to provide the token to the configuration (or more variables that I may need)
Thanks in advance for the help! I'd like to automate this installation in the best possible way. Any help would be appreciated.
You can directly copy the necessary configuration files in the server binaries folder:
"db.conf" --> where we configure the database parameters.
"users.conf" and "groups.conf" --> where we specify the users and groups.
"remoting.conf" --> where we specify the server channels.
"server.conf" --> where we configure different server settings and parameters
"plasticd.lic" --> the server license
"plasticd.lic.token" --> only if you are using a license token.

Need advice regarding deployment on multiple remote machines

Currently I am using ms-deploy to build and deploy on several machines using team-city. In my current scenario, I need to build, package and deploy on Dev. After this I need to deploy this package on test and Live servers (which are on different domain. I understand how we do it but problem is Web transformation only occurs for test and live configs if we build a package. It means if I want to use the same package that is created for Dev cannot be used, as web transformation only occurred for Dev web config. Also know that we can change web config when un-packaging but that parameters are very limited. We have a lot of changes not just the connection string or db changes.
Another solution is to add another step to build packages for test and live as part of Dev deployment but then it means a lot of copying on remote servers, once for test and once for live which is a lot of time consuming due to different domains.
Can you please guide what is the best solution in this scenario. So I can use team-city to publish to Dev and test and live using same package and different web configs in one go.
To configure items at deployment time which are not automatically created for you. You can add a file named parameters.xml to your project and extend what you want to make available at deployment time.
Here's some documentation on the approach Using Deployment Parameters for Web.Config File Settings.

Make Maven Proxy/Server settings configurable based on location?

So I'm not sure what the best way to accomplish this is, but basically I have a laptop that I use at work for Maven projects. It works fine when I'm at work, but as soon as I walk out of the door of their corporate proxy and maven server, I often have to do alot of hand-fudging of the settings.xml file when I'm at home if I'm not VPN'ed in:
We have a corporate-installed Maven Repository proxy server to store some of our own artifacts and handle being the middle-man for our commonly used artifacts.
We have an http proxy that we use for connecting to the outside world.
Both configurations have been handled by my settings.xml file for setting a single Nexus group and maven proxies. If I'm not connected to the VPN while away from the office, I have to muck around with the settings.xml each time I'm not on it, then switch it back when I am on it.
What solutions have anyone else found to handle this? I've been trying profiles to manage the proxy, but I can't seem to get it to work correctly, and it's starting to look pretty ugly. Are there some settings configurations that can detect when I'm not behind the proxy at work and not use the corporate proxy server or Maven server?
While I can think of some profile based solution to handle the proxy (basically, reading the <active> value from a property defined in a profile), this wouldn't be fully automated (the profile activation do not support network based stuff) unless you can find a file that is present or not depending on your location (in which case, you could use an existing/missing file trigger but this is kinda hacky). Anyway, this would solve only one part of the problem because mirrors can't be declared in profiles (see MNG-3525).
So, instead of trying to control this with a profile, my suggestion would be to use two settings.xml and to pass your settings-home.xml file with the -s command line option when you're at home.
Another option would be to automate the changes in your settings.xml with a script (Groovy would be a good choice as someone reported in MNG-3525).
I found a use environment variables to set nonProxyHosts together with proxy and noproxy shell aliases to be the most convenient solution when switching between networks with proxy and without it.
In settings.xml, configure proxy with
<host>proxy.corporation.int</host>
<port>8080</port>
<nonProxyHosts>${env.MAVEN_NONPROXY}</nonProxyHosts>
Then in ~/.profile set
export MAVEN_NONPROXY_PROXY='*.corporation.int|local.net|some.host.com'
export MAVEN_NONPROXY_NOPROXY='*'
alias proxy="export MAVEN_NONPROXY=\"$MAVEN_NONPROXY_PROXY\" && export all_proxy=http://proxy.corporation.int:8080"
alias noproxy="export MAVEN_NONPROXY=\"$MAVEN_NONPROXY_NOPROXY\" && unset all_proxy"
To do the switch when roaming, you would just execute from a shell:
[me#linuxbox me]$ proxy
or
[me#linuxbox me]$ noproxy
Obviously, both aliases proxy and noproxy can include much more changes than just setup of MAVEN_NOPROXY and all_proxy.
I was frustrated by the same problem: having to manually edit settings.xml when roaming between networks. So much in fact, that I wrote a Maven plugin that enables automatic discovery of proxy settings. The current implementation uses the proxy-vole library written by Bernd Rosstauscher to detect proxy settings based on OS configuration, browser, and environment settings.
I've just released the source code of the plugin on Github, under an Apache 2.0 license: https://github.com/volkertb/autoproxy-maven-plugin
You're welcome to give it a try and to see if it meets your needs. Any feedback or contributions are welcome!
(Note: you don't necessarily have to add the plugin to your project's POM. You can invoke it from the command line as well, after you've installed it. See the README on the site for more details.)
You can set MAVEN_OPTS when you need to activate a proxy:
export MAVEN_OPTS="-Dhttp.proxyHost=my-proxy-server -Dhttp.proxyPort=80 -Dhttp.nonProxyHosts=*.my.org -Dhttps.proxyHost=my-proxy-server -Dhttps.proxyPort=80 -Dhttps.nonProxyHosts=*.my.org"