Where do I set the script MODE - spring-boot

I want to create an init.d service for my spring-boot app.
I want it to be stopped by default and only run when the user runs service my-app start.
Where do I set MODE=service as described on below page.
http://docs.spring.io/spring-boot/docs/current/reference/html/deployment-install.html

Found I needed to add the embeddedLaunchScriptProperties option to the Spring Boot Maven

Related

How can I override quarkus.security.users.embedded.users on docker run command line?

I have a quarkus based webapp that uses Basic Authentication with Embedded Realm Configuration. The webapp runs in a docker container. The authentication properties are specified in application.properties like this:
quarkus.http.auth.basic=true
quarkus.security.users.embedded.enabled=true
quarkus.security.users.embedded.plain-text=true
quarkus.security.users.embedded.users.test=mypass
quarkus.security.users.embedded.roles.test=admin
I would like to override quarkus.security.users.embedded.users.test to specify a password at docker runtime.
I tried to do this by overriding the quarkus property using an environment variable at docker runtime.
docker run -p 9999:9999 -e QUARKUS_SECURITY_USERS_EMBEDDED_USERS_TEST=newpasswd mywebapp
This does not work. When I access mywebapp using http://locahost:9999 I must login using test/mypass. I expected to login using test/newpasswd.
Any help greatly appreciated.
I suggest you report an issue for this problem. While Quarkus won't be able to "enumerate" any new users from environment variables (the correct property names cannot be deduced), I think it should still be possible to override the password of a user that has already been specified in application.properties using an environment variable like you try to do.

spring boot logging.file not getting created in openshift

I want to export the logs of a spring boot application into a file in order to preserve it in a persistent volume.
In application.properties i added logging.file=myapplication.log
When i build and run the docker image locally, the myapplication.log file gets created in the container. But when i push the image to the Openshift internal registry and do
`oc new-app --name=<app> <image-name>`
the container gets created and works fine but the log file does not exist. I also tried inserting -Dlogging.file=myapplication.log in the dockerfile which also works locally but not in openshift.
What i am doing wrong! I am going insane!

Different profile per spring boot application instance in cloud foundy

Is it possible to programmatically set a different profile for every instance of a spring boot application deployed in cloud foundry using for example ConfigurableEnvironment and cloud foundry instance index?
I would suggest that you look into using tasks.
https://docs.cloudfoundry.org/devguide/using-tasks.html
Here's roughly how this would work.
Run cf push to deploy your application to CF. If you do not actually have an application to run, that is OK. You just need to push the app and start it once so that it stages and creates a droplet. After that, you can run cf stop to shutdown the instance (note: cf push --no-start won't work, because the app needs to stage at least once).
Run cf run-task <app> <command>. This is where you kick off your batch jobs. The <command> argument is going to be the full command to run your batch job. In this, you can include an argument to indicate the profiles that should be used. Ex: --spring.profiles.active=dev,hsqldb.
https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-profiles.html
You need to use the full or relative path to the java exceutable because the Java buildpack does not put it onto the path. If you wanted to run a task that printed the version of the JVM, you'd use this command '.java-buildpack/open_jdk_jre/bin/java -version'.
Ex: cf run-task <app> '.java-buildpack/open_jdk_jre/bin/java -version'
See this SO post though for drawbacks of hardcoding the path to the Java executable in your command. My suggestion would be to take the command that's listed when you run cf push and modify to your needs.

not able to set spring active profile in tomcat

Tomcat8 is set to run as a service on ubuntu
I have deployed an application in tomcat8, I want the app to load(dev,local,prod)environment specific propety file
Which config file should I set -Dspring.profiles.active=\"prod\" value so the correct property file is read.
I tried in catalina.sh as JAVA_OPTS="$JAVA_OPTS -Dspring.profiles.active=\"prod\""
and also in /etc/default/tomcat8
In setenv.sh
CATALINA_OPTS="-Dspring.profiles.active=prod ...a whole bunch of stuff might already be here"

Deploying an osgi bundle (jsp hook) in liferay 7

Created an osgi bundle (jsp hook) in liferay. Using the server tab in Liferay Workspace environment, added the bundle to configured server.
Checked the osgi shell with
lb -s mytest.hook
START LEVEL 20
ID|State |Level|Symbolic name
455|Installed | 1|mystest.hook (1.0.0.201603221133)
The state is "Installed". Not sure how to proceed further in terms of the deployment. How will the State change to "Active" ?
Try the following command:
start 455
Probably your bundle does not resolve correctly. You should get a an exception that tells you the reason after calling start.
I was able to get it deployed successfully by actually putting it to the deploy folder, from which the Liferay's deployer kick's in and does the rest. So basically the deployer doesn't get notified when you do it from the server tab and add you project for deployment.

Resources