How can I stop Bonita installed with / within the Docker image?

1
0
-1

Hi,

When I install the docker image: docker pull quay.io/bonitasoft/bonita-subscription:7.11.3

And I run it: docker run -e HTTP_API=true -e REST_API_DYN_AUTH_CHECKS=false --name bonita -v ~/bonita-lic/:/opt/bonita_lic/ -h localhost -d -p 8080:8080 quay.io/bonitasoft/bonita-subscription:7.11.3

Then get inside my container: sudo docker exec -it my-container-id bash

I wantto stop the bonita server with:

root@localhost:/# cd /opt/bonita/BonitaSubscription-7.11.3/
root@localhost:/opt/bonita/BonitaSubscription-7.11.3# ./stop-bonita.sh
Using CATALINA_BASE: /opt/bonita/BonitaSubscription-7.11.3/server
Using CATALINA_HOME: /opt/bonita/BonitaSubscription-7.11.3/server
Using CATALINA_TMPDIR: /opt/bonita/BonitaSubscription-7.11.3/server/temp
Using JRE_HOME: /usr
Using CLASSPATH: /opt/bonita/BonitaSubscription-7.11.3/server/lib/ext/*:/opt/bonita/BonitaSubscription-7.11.3/server/bin/bootstrap.jar:/opt/bonita/BonitaSubscription-7.11.3/server/bin/tomcat-juli.jar
Using CATALINA_OPTS: -Dorg.bonitasoft.platform.setup.folder=/opt/bonita/BonitaSubscription-7.11.3/server/../setup -Dorg.bonitasoft.h2.database.dir=/opt/bonita/BonitaSubscription-7.11.3/server/../h2_database -Dsysprop.bonita.db.vendor=h2 -Dsysprop.bonita.bdm.db.vendor=h2 -Dcom.arjuna.ats.arjuna.common.propertiesFile=/opt/bonita/BonitaSubscription-7.11.3/server/conf/jbossts-properties.xml -Dorg.bonitasoft.engine.incident.folder=/opt/bonita/BonitaSubscription-7.11.3/server/logs -Dfile.encoding=UTF-8 -Xshare:auto -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/opt/bonita/BonitaSubscription-7.11.3/server/logs -Djava.security.egd=file:/dev/./urandom
Using CATALINA_PID: /opt/bonita/BonitaSubscription-7.11.3/server/catalina.pid
$CATALINA_PID was set but the specified file does not exist. Is Tomcat running? Stop aborted.

root@localhost:/opt/bonita/BonitaSubscription-7.11.3#

My Questions are:

- How do I stop bonita from inside my container? It doesn't say in the documentation: https://documentation.bonitasoft.com/bonita/7.11/bonita-docker-installation

- So how do I stop bonita? It doesn't say in the documentation: https://documentation.bonitasoft.com/bonita/7.11/bonita-docker-installation

- I try to do a kill -9 on my PID 1 but it doesn't work. Why is that? :

root@localhost:/opt/bonita/BonitaSubscription-7.11.3# ps -ef | grep BonitaSubscription
bonita 1 0 45 00:03 ? 00:01:01 /usr/bin/java -Djava.util.logging.config.file=/opt/bonita/BonitaSubscription-7.11.3/server/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 -Dorg.bonitasoft.platform.setup.folder=/opt/bonita/BonitaSubscription-7.11.3/server/../setup -Dorg.bonitasoft.h2.database.dir=/opt/bonita/BonitaSubscription-7.11.3/server/../h2_database -Dsysprop.bonita.db.vendor=h2 -Dsysprop.bonita.bdm.db.vendor=h2 -Dcom.arjuna.ats.arjuna.common.propertiesFile=/opt/bonita/BonitaSubscription-7.11.3/server/conf/jbossts-properties.xml -Dorg.bonitasoft.engine.incident.folder=/opt/bonita/BonitaSubscription-7.11.3/server/logs -Dfile.encoding=UTF-8 -Xshare:auto -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/opt/bonita/BonitaSubscription-7.11.3/server/logs -Djava.security.egd=file:/dev/./urandom -Dignore.endorsed.dirs= -classpath /opt/bonita/BonitaSubscription-7.11.3/server/lib/ext/*:/opt/bonita/BonitaSubscription-7.11.3/server/bin/bootstrap.jar:/opt/bonita/BonitaSubscription-7.11.3/server/bin/tomcat-juli.jar -Dcatalina.base=/opt/bonita/BonitaSubscription-7.11.3/server -Dcatalina.home=/opt/bonita/BonitaSubscription-7.11.3/server -Djava.io.tmpdir=/opt/bonita/BonitaSubscription-7.11.3/server/temp org.apache.catalina.startup.Bootstrap start

Thank for your help,

1 answer

1
+1
-1

Hello,

You may start a Bonita Docker container interactively as follows, in order to manually control start/stop of the Tomcat:

docker run --name bonita -h <hostname> -v ~/bonita-lic/:/opt/bonita_lic/ -it -p 8080:8080 quay.io/bonitasoft/bonita-subscription:7.11.3 bash

This will start an interactive Bonita Docker container running bash, but without automatically starting the Tomcat.

In order to start the Tomcat, run the /opt/files/startup.sh command inside the container.

In order to stop the Tomcat inside the container, press Ctrl-C.

Then run the /opt/files/startup.sh to start the Tomcat again.

Comments

Submitted by emmanuel.duchas... on Thu, 12/31/2020 - 09:20

Does it mean that starting the container and stopping the container is not recommended / not clean to interact with Tomcat?

Submitted by Truc on Thu, 12/31/2020 - 09:38

I think the Docker image is originally meant to start the Tomcat automatically to have an automated way of running pre-configured Bonita runtimes.

Controlling start and stop of the Tomcat may be useful for troubleshooting configuration scripts though. I don't see anything unclean in doing so, as long as you use this mode for the appropriate purpose.

Submitted by emmanuel.duchas... on Thu, 12/31/2020 - 12:32

Does it change something to where the logs are generated?

Submitted by Truc on Thu, 12/31/2020 - 12:37

No it does not change where the logs are sent. With the Docker image, the logs are sent to stdout.
When running in "interactive mode", the logs will be displayed in the console output only, unless you redirect the "startup.sh" output to a file for instance.

Submitted by emmanuel.duchas... on Thu, 12/31/2020 - 15:27

Thx for those precisions.

Submitted by marielle.spiteri on Thu, 12/31/2020 - 18:58

Hi, thanks for your comment and answer!

I have some follow up questions:

1. So if I don't start the container interactively but follow the documentation as mentioned previously, then can I stop Bonita without stopping the container? Or must I stop the container? I can't find the information in the documentation.

2. How do I pass this `-e HTTP_API=true -e REST_API_DYN_AUTH_CHECKS=false` if I run interactively? I've tried the following and it doesn't seem to work: `docker run -e HTTP_API=true -e REST_API_DYN_AUTH_CHECKS=false --name bonita -h localhost -v ~/bonita-lic/:/opt/bonita_lic/ -it -d -p 8080:8080 quay.io/bonitasoft/bonita-subscription:7.11.3 bash`

Thanks and happy new year!

Submitted by Truc on Thu, 12/31/2020 - 22:52

Hi,

As regards the follow up questions:

1. When running the container as a daemon as described in the documentation, stopping Bonita pid=1 inside the container can be done with `kill -15 1` (not `kill -9 1`). But this would also stop the container (this is how a Docker container works - it stops when the main process is stopped). So killing the main process or stopping the container are equivalent actions.

2. If running interactively, you would do:

docker run -e HTTP_API=true -e REST_API_DYN_AUTH_CHECKS=false --name bonita -v ~/lic/:/opt/bonita_lic/ -it -p 8080:8080 quay.io/bonitasoft/bonita-subscription:7.11.3 bash

(the mistake in your command line is to keep the `-d` option... which means "run as a daemon")

Submitted by marielle.spiteri on Fri, 01/01/2021 - 00:23

Thank you for your answers Truc! Happy new year!

Notifications