Skip to content

Commit

Permalink
Fix graceful shutdown in docker-compose examples (apache#11812)
Browse files Browse the repository at this point in the history
- Get OS signals passed to container process by using shell built-in "exec"
- this is required so that the process running in the container is able to
  receive OS signals
  - explained in https://docs.docker.com/develop/develop-images/dockerfile_best-practices/
    and https://docs.docker.com/engine/reference/builder/#entrypoint
- receiving SIGTERM signal is required for graceful shutdown.
  • Loading branch information
lhotari authored Aug 27, 2021
1 parent 3c6f31f commit a97bae4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
26 changes: 13 additions & 13 deletions docker-compose/kitchen-sink/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ services:
bash -c "bin/apply-config-from-env.py conf/zookeeper.conf && \
bin/apply-config-from-env.py conf/pulsar_env.sh && \
bin/generate-zookeeper-config.sh conf/zookeeper.conf && \
bin/pulsar zookeeper"
exec bin/pulsar zookeeper"
environment:
ZOOKEEPER_SERVERS: zk1,zk2,zk3
volumes:
Expand All @@ -49,7 +49,7 @@ services:
bash -c "bin/apply-config-from-env.py conf/zookeeper.conf && \
bin/apply-config-from-env.py conf/pulsar_env.sh && \
bin/generate-zookeeper-config.sh conf/zookeeper.conf && \
bin/pulsar zookeeper"
exec bin/pulsar zookeeper"
environment:
ZOOKEEPER_SERVERS: zk1,zk2,zk3
volumes:
Expand All @@ -65,7 +65,7 @@ services:
bash -c "bin/apply-config-from-env.py conf/zookeeper.conf && \
bin/apply-config-from-env.py conf/pulsar_env.sh && \
bin/generate-zookeeper-config.sh conf/zookeeper.conf && \
bin/pulsar zookeeper"
exec bin/pulsar zookeeper"
environment:
ZOOKEEPER_SERVERS: zk1,zk2,zk3
volumes:
Expand Down Expand Up @@ -102,7 +102,7 @@ services:
bin/apply-config-from-env.py conf/bookkeeper.conf && \
bin/apply-config-from-env.py conf/pulsar_env.sh && \
bin/watch-znode.py -z $$zkServers -p /initialized-$$clusterName -w && \
bin/pulsar bookie"
exec bin/pulsar bookie"
environment:
clusterName: test
zkServers: zk1:2181,zk2:2181,zk3:2181
Expand All @@ -128,7 +128,7 @@ services:
bin/apply-config-from-env.py conf/bookkeeper.conf && \
bin/apply-config-from-env.py conf/pulsar_env.sh && \
bin/watch-znode.py -z $$zkServers -p /initialized-$$clusterName -w && \
bin/pulsar bookie"
exec bin/pulsar bookie"
environment:
clusterName: test
zkServers: zk1:2181,zk2:2181,zk3:2181
Expand All @@ -155,7 +155,7 @@ services:
bin/apply-config-from-env.py conf/bookkeeper.conf && \
bin/apply-config-from-env.py conf/pulsar_env.sh && \
bin/watch-znode.py -z $$zkServers -p /initialized-$$clusterName -w && \
bin/pulsar bookie"
exec bin/pulsar bookie"
environment:
clusterName: test
zkServers: zk1:2181,zk2:2181,zk3:2181
Expand All @@ -182,7 +182,7 @@ services:
bash -c "bin/apply-config-from-env.py conf/broker.conf && \
bin/apply-config-from-env.py conf/pulsar_env.sh && \
bin/watch-znode.py -z $$zookeeperServers -p /initialized-$$clusterName -w && \
bin/pulsar broker"
exec bin/pulsar broker"
environment:
clusterName: test
zookeeperServers: zk1:2181,zk2:2181,zk3:2181
Expand Down Expand Up @@ -211,7 +211,7 @@ services:
bash -c "bin/apply-config-from-env.py conf/broker.conf && \
bin/apply-config-from-env.py conf/pulsar_env.sh && \
bin/watch-znode.py -z $$zookeeperServers -p /initialized-$$clusterName -w && \
bin/pulsar broker"
exec bin/pulsar broker"
environment:
clusterName: test
zookeeperServers: zk1:2181,zk2:2181,zk3:2181
Expand Down Expand Up @@ -241,7 +241,7 @@ services:
bash -c "bin/apply-config-from-env.py conf/broker.conf && \
bin/apply-config-from-env.py conf/pulsar_env.sh && \
bin/watch-znode.py -z $$zookeeperServers -p /initialized-$$clusterName -w && \
bin/pulsar broker"
exec bin/pulsar broker"
environment:
clusterName: test
zookeeperServers: zk1:2181,zk2:2181,zk3:2181
Expand Down Expand Up @@ -272,7 +272,7 @@ services:
bash -c "bin/apply-config-from-env.py conf/proxy.conf && \
bin/apply-config-from-env.py conf/pulsar_env.sh && \
bin/watch-znode.py -z $$zookeeperServers -p /initialized-$$clusterName -w && \
bin/pulsar proxy"
exec bin/pulsar proxy"
environment:
clusterName: test
zookeeperServers: zk1:2181,zk2:2181,zk3:2181
Expand Down Expand Up @@ -305,7 +305,7 @@ services:
bash -c "bin/apply-config-from-env.py conf/websocket.conf && \
bin/apply-config-from-env.py conf/pulsar_env.sh && \
bin/watch-znode.py -z $$zookeeperServers -p /initialized-$$clusterName -w && \
bin/pulsar websocket"
exec bin/pulsar websocket"
environment:
clusterName: test
zookeeperServers: zk1:2181,zk2:2181,zk3:2181
Expand Down Expand Up @@ -335,7 +335,7 @@ services:
bin/gen-yml-from-env.py conf/functions_worker.yml && \
bin/apply-config-from-env.py conf/pulsar_env.sh && \
bin/watch-znode.py -z $$zookeeperServers -p /initialized-$$clusterName -w && \
bin/pulsar functions-worker"
exec bin/pulsar functions-worker"
environment:
clusterName: test
zookeeperServers: zk1:2181,zk2:2181,zk3:2181
Expand Down Expand Up @@ -371,7 +371,7 @@ services:
bash -c "bin/apply-config-from-env-with-prefix.py SQL_PREFIX_ conf/presto/catalog/pulsar.properties && \
bin/apply-config-from-env.py conf/pulsar_env.sh && \
bin/watch-znode.py -z $$zookeeperServers -p /initialized-$$clusterName -w && \
bin/pulsar sql-worker run"
exec bin/pulsar sql-worker run"
environment:
clusterName: test
zookeeperServers: zk1:2181,zk2:2181,zk3:2181
Expand Down
2 changes: 1 addition & 1 deletion docker-compose/standalone-dashboard/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ services:
command: >
/bin/bash -c
"bin/apply-config-from-env.py conf/standalone.conf
&& bin/pulsar standalone --advertised-address standalone"
&& exec bin/pulsar standalone --advertised-address standalone"
dashboard:
image: apachepulsar/pulsar-dashboard
Expand Down

0 comments on commit a97bae4

Please sign in to comment.