This is an automated email from the ASF dual-hosted git repository.
yong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
The following commit(s) were added to refs/heads/master by this push:
new 9dab13911c Fix logging configurations are broken in docker image
(#4137)
9dab13911c is described below
commit 9dab13911c3b9c6917a3a19328250e343a5c212a
Author: 萧易客 <[email protected]>
AuthorDate: Fri Dec 29 10:08:51 2023 +0800
Fix logging configurations are broken in docker image (#4137)
---
docker/scripts/apply-config-from-env.py | 23 +++++++++++++++--------
docker/scripts/common.sh | 2 +-
docker/scripts/init_zookeeper.sh | 2 +-
3 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/docker/scripts/apply-config-from-env.py
b/docker/scripts/apply-config-from-env.py
index 105a2bacaf..7b74b50341 100755
--- a/docker/scripts/apply-config-from-env.py
+++ b/docker/scripts/apply-config-from-env.py
@@ -23,21 +23,28 @@
## based on the ENV variables
## export my-key=new-value
##
-## ./apply-config-from-env config_dir
+## ./apply-config-from-env file ...
##
import os, sys
-if len(sys.argv) != 2:
- print('Usage: %s ' + 'config_dir' % (sys.argv[0]))
+if len(sys.argv) < 2:
+ print('Usage: %s file ...' % (sys.argv[0]))
sys.exit(1)
-def mylistdir(dir):
- return [os.path.join(dir, filename) for filename in os.listdir(dir)]
+def prepare_conf_files(files):
+ conf_files = []
+ for f in files:
+ if os.path.isfile(f):
+ if not os.path.isabs(f):
+ f = os.path.join(os.getcwd(), f)
+ conf_files.append(f)
+ else:
+ print('%s is not a readable file' % f)
+ sys.exit(1)
+ return conf_files
-# Always apply env config to all the files under conf
-conf_dir = sys.argv[1]
-conf_files = mylistdir(conf_dir)
+conf_files = prepare_conf_files(sys.argv[1:])
print('conf files: ')
print(conf_files)
diff --git a/docker/scripts/common.sh b/docker/scripts/common.sh
index 5bbcd20807..0f745db4b4 100755
--- a/docker/scripts/common.sh
+++ b/docker/scripts/common.sh
@@ -71,7 +71,7 @@ echo " BK_STREAM_STORAGE_ROOT_PATH is
${BK_STREAM_STORAGE_ROOT_PATH}"
echo " BK_NUM_STORAGE_CONTAINERS is ${BK_NUM_STORAGE_CONTAINERS}"
echo " BOOKIE_GRPC_PORT is ${BOOKIE_GRPC_PORT}"
-python scripts/apply-config-from-env.py ${BK_HOME}/conf
+python scripts/apply-config-from-env.py ${BK_HOME}/conf/*.conf
export BOOKIE_CONF=${BK_HOME}/conf/bk_server.conf
export SERVICE_PORT=${PORT0}
diff --git a/docker/scripts/init_zookeeper.sh b/docker/scripts/init_zookeeper.sh
index 803ef91d78..cff981211c 100755
--- a/docker/scripts/init_zookeeper.sh
+++ b/docker/scripts/init_zookeeper.sh
@@ -63,7 +63,7 @@ function create_zk_dynamic_conf() {
function init_zookeeper() {
# apply zookeeper envs
- python scripts/apply-config-from-env.py ${BK_HOME}/conf
+ python scripts/apply-config-from-env.py ${BK_HOME}/conf/zookeeper.conf
# create dirs if they don't exist
create_zk_dirs