How to set Spring active profile while running in WebLogic? - weblogic

I want to set spring active profile in weblogic settings.
I have three properties in src/main/resources. For examp : application-dev.properties , application-qa.properties , application-test.properties.
I dont want to keep spring.profiles.active property in my application.properties file. As I have to change it every time whenever I want to deploy in different server.
I want to active the profile in weblogic (my deploying server for application). Whats is the way and how to fetch the value in springboot application?
Thanks

Pass the profile as java argument -Dspring.profiles.active=dev

A secure way to set profiles in springboot applications is to set environment variables with it. In general, it is a good approach, so you can define it differently for each one of your environments (dev, qa and prod).
Please check this discussion, which explains specifically about Weblogic. In java, you need the SPRING_PROFILES_ACTIVE environment variable set.

Related

Cannot use name when deploying application in Mulesoft Cloudhub

I am using Mule 4 and I am looking to deploy a new application in Cloudhub but it is not allowing me to use the name "customer-api". There is no other application called that in any of the environments and I cannot see it used in API manager either. There was an API called customer-api which has been deleted so not sure if this name could still be cached/ registered somewhere and the entry needs to be cleared.
The only place I can see that name used is in the Anypoint Exchange but wouldn't think that would impact what we are deploying.
Does anybody know what could be preventing me from using that name?
Thanks for any help
Every MuleSoft customer uses the cloudhub, which means it has to be "globally" unique. Try customer-api-randomString and it should work.

How to set Tomcat.runtime.environment.version as PROD on the web server?

I want to set Tomcat environment variable as PROD. I tried by putting
set "ENVIRONMENT=PROD"
set JAVA_OPTS="-Dtomcat.runtime.environment.version=PROD"
in catalina.bat
and tried to retrieve it with
env = System.getProperty("tomcat.runtime.environment.version");
but every time env is null! Where exactly does the variable have to be declared in catalina.bat and what's the perfect syntax to set the environment variable? Other possible ways to declare variables are also welcome!
Since you are on Windows and in production, I'm going to assume that you are using a Microsoft Windows Service for Tomcat. If that's the case, the .bat files are completely ignored when launching and stopping Tomcat. There is a service binary that reads the configuration from the Windows Registry and no disk-based scripts are used at all.
If you run the program called tomcatXw.exe (where X is your Tomcat major version number), that will run the configuration GUI. From there, you can configure everything stored in the Registry.
Go to the "System Properties" tab and add your system property -Dtomcat.runtime.environment.version=PROD to the list of properties already found in there. Restart your service and you should be able to see the new system property available to your application (actually the whole JVM, of course).

OSB Alerts Migration

How can I configure alerts in Eclipse oepe? It's not easy to migrate all the alert rules and slas across environments.Is there any way to have all the alerts/SLAs migrated in case of change in environment like DEV to TEST without making any changes through sbconsole?
Whenever I exported the jar file(sbconfig.jar) from console and imported it in eclipse, all the alerts are not there in any service. The becomes blank.
Pls help.
Do you also export the Global Operation Settings from the OSBConfiguration? Because that info is not stored in a specific project.
OSB Configurator definitely allows this, so it it is possible to put these settings into sbconfig.jar. In fact you can use this to add those settings to a pre-existing sbconfig.jar.
Note, however, that you might need to import it using /sbconsole/ or WLST rather than from inside OEPE. OEPE has a bad habit of ignoring things it doesn't want to set.

How do I configure database and parameters as the app passes from dev, to test to prod?

I am trying to set up my first Cloudbees app.
Is there documentation or tutorial that shows how to
a) set variables depending on the environment. e.g. restful end point URLs have to change depending on dev, test or prod
b) initialize the database. We want to initialise the database when we do from dev to test, but not from test to prod.
Thanks
a) you should use application parameters for your DEV/TEST/PROD application to have adequate URL set as system property. parameters are tied to an application ID, so a common pattern is to deploy same binary to myapp-dev, myapp-test, myapp-prod, but change the configuration bindings.
b) use a boolean system property to disable the database migration process on production.

WLST: deploy application but do not start it -- how?

I need to script an EAR deployment to Weblogic 9.2. Extra requirements I have though are:
Application Name shall be the one I provide, not just EAR name
Application is deployed in Prepared state, not Running one
As far as I can tell, when I use deploy(), the name is got assigned by me (good!), but application starts right away (bad! other services are not ready yet!).
Can anyone point me to a correct way of doing that?
I think that what you're looking for is distributeApplication, not deploy (also see Administration Mode for Isolating Production Applications).
For the application name, why don't you set it in the deployment descriptor?