confluent based image
[dmaap/kafka11aaf.git] / src / main / docker / include / etc / confluent / docker / launch
1 #!/usr/bin/env bash
2 #
3 # Copyright 2016 Confluent Inc.
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 # Override this section from the script to include the com.sun.management.jmxremote.rmi.port property.
18 if [ -z "$KAFKA_JMX_OPTS" ]; then
19   export KAFKA_JMX_OPTS="-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.authenticate=false  -Dcom.sun.management.jmxremote.ssl=false "
20 fi
21
22 # The JMX client needs to be able to connect to java.rmi.server.hostname.
23 # The default for bridged n/w is the bridged IP so you will only be able to connect from another docker container.
24 # For host n/w, this is the IP that the hostname on the host resolves to.
25
26 # If you have more that one n/w configured, hostname -i gives you all the IPs,
27 # the default is to pick the first IP (or network).
28 export KAFKA_JMX_HOSTNAME=${KAFKA_JMX_HOSTNAME:-$(hostname -i | cut -d" " -f1)}
29
30 if [ "$KAFKA_JMX_PORT" ]; then
31   # This ensures that the "if" section for JMX_PORT in kafka launch script does not trigger.
32   export JMX_PORT=$KAFKA_JMX_PORT
33   export KAFKA_JMX_OPTS="$KAFKA_JMX_OPTS -Djava.rmi.server.hostname=$KAFKA_JMX_HOSTNAME -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.rmi.port=$JMX_PORT -Dcom.sun.management.jmxremote.port=$JMX_PORT"
34 fi
35
36 echo "===> Launching ${COMPONENT} ... "
37 exec "${COMPONENT}"-server-start /etc/"${COMPONENT}"/"${COMPONENT}".properties