Skip to content

Commit

Permalink
introduce standard yaml config
Browse files Browse the repository at this point in the history
  • Loading branch information
JunRuiLee committed Oct 29, 2023
1 parent 967be6d commit 3f7ee75
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
15 changes: 10 additions & 5 deletions Dockerfile-ubuntu.template
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,16 @@ RUN set -ex; \
chown -R flink:flink .; \
\
# Replace default REST/RPC endpoint bind address to use the container's network interface \
sed -i 's/rest.address: localhost/rest.address: 0.0.0.0/g' $FLINK_HOME/conf/flink-conf.yaml; \
sed -i 's/rest.bind-address: localhost/rest.bind-address: 0.0.0.0/g' $FLINK_HOME/conf/flink-conf.yaml; \
sed -i 's/jobmanager.bind-host: localhost/jobmanager.bind-host: 0.0.0.0/g' $FLINK_HOME/conf/flink-conf.yaml; \
sed -i 's/taskmanager.bind-host: localhost/taskmanager.bind-host: 0.0.0.0/g' $FLINK_HOME/conf/flink-conf.yaml; \
sed -i '/taskmanager.host: localhost/d' $FLINK_HOME/conf/flink-conf.yaml;
CONF_FILE="$FLINK_HOME/conf/flink-conf.yaml"; \
if [ ! -e "$FLINK_HOME/conf/flink-conf.yaml" ]; then \
CONF_FILE="${FLINK_HOME}/conf/config.yaml"; \
/bin/bash "$FLINK_HOME/bin/flatten-config.sh" "${FLINK_HOME}/conf" "${FLINK_HOME}/bin" "${FLINK_HOME}/lib"; \
fi; \
sed -i 's/rest.address: localhost/rest.address: 0.0.0.0/g' "$CONF_FILE"; \
sed -i 's/rest.bind-address: localhost/rest.bind-address: 0.0.0.0/g' "$CONF_FILE"; \
sed -i 's/jobmanager.bind-host: localhost/jobmanager.bind-host: 0.0.0.0/g' "$CONF_FILE"; \
sed -i 's/taskmanager.bind-host: localhost/taskmanager.bind-host: 0.0.0.0/g' "$CONF_FILE"; \
sed -i '/taskmanager.host: localhost/d' "$CONF_FILE";

# Configure container
COPY docker-entrypoint.sh /
Expand Down
9 changes: 8 additions & 1 deletion docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ COMMAND_HISTORY_SERVER="history-server"

# If unspecified, the hostname of the container is taken as the JobManager address
JOB_MANAGER_RPC_ADDRESS=${JOB_MANAGER_RPC_ADDRESS:-$(hostname -f)}
CONF_FILE="${FLINK_HOME}/conf/flink-conf.yaml"
CONF_FILE_DIR="${FLINK_HOME}/conf"

drop_privs_cmd() {
if [ $(id -u) != 0 ]; then
Expand Down Expand Up @@ -112,6 +112,13 @@ maybe_enable_jemalloc

copy_plugins_if_required

CONF_FILE=""

if [ -e "${CONF_FILE_DIR}/flink-conf.yaml" ]; then
CONF_FILE="${CONF_FILE_DIR}/flink-conf.yaml"
else
CONF_FILE="${CONF_FILE_DIR}/config.yaml"
fi
prepare_configuration

args=("$@")
Expand Down

0 comments on commit 3f7ee75

Please sign in to comment.