Skip to content

Commit

Permalink
Fix logging configurations are broken in docker image (apache#4137)
Browse files Browse the repository at this point in the history
(cherry picked from commit 9dab139)
  • Loading branch information
Shawyeok authored and lhotari committed Feb 9, 2024
1 parent 264547c commit 8f9df23
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
23 changes: 15 additions & 8 deletions docker/scripts/apply-config-from-env.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion docker/scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion docker/scripts/init_zookeeper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8f9df23

Please sign in to comment.