caiok commented on a change in pull request #197: BOOKKEEPER-974: Add an
official bookkeeper docker image
URL: https://github.com/apache/bookkeeper/pull/197#discussion_r127232485
##########
File path: docker/4.4.0-alpine/run.sh
##########
@@ -0,0 +1,68 @@
+#/bin/bash
+
+# -------------- #
+set -x -e -u
+# -------------- #
+
+# -------------- #
+# Allow the container to be started with `--user`
+if [ "$1" = 'bookkeeper' -a "$(id -u)" = '0' ]; then
+ chown -R "$BK_USER" "${BK_DIR}" "${BK_JOURNAL_DIR}" "${BK_LEDGER_DIR}"
"${BK_INDEX_DIR}"
+ exec su-exec "$BK_USER" /bin/bash "$0" "$@"
+ exit
+fi
+# -------------- #
+
+# -------------- #
+# Copy input config files in Bookkeeper configuration directory
+cp -vaf /conf/* ${BK_DIR}/conf || true
+chown -R "$BK_USER" ${BK_DIR}/conf
+
+# Bookkeeper setup
+sed -r -i.bak \
+ -e "s|^journalDirectory.*=.*|journalDirectory=${BK_JOURNAL_DIR}|" \
+ -e "s|^ledgerDirectories.*=.*|ledgerDirectories=${BK_LEDGER_DIR}|" \
+ -e "s|^[# ]*indexDirectories.*=.*|indexDirectories=${BK_INDEX_DIR}|" \
+ -e "s|^[#
]*useHostNameAsBookieID.*=.*false|useHostNameAsBookieID=true|" \
+ ${BK_DIR}/conf/bk_server.conf
+
+if [[ "${ZK_SERVERS}" != "" ]]; then
+ sed -r -i "s|^zkServers.*=.*|zkServers=${ZK_SERVERS}|"
${BK_DIR}/conf/bk_server.conf
+fi
+if [[ "${BK_PORT}" != "" ]]; then
+ sed -r -i "s|^bookiePort.*=.*|bookiePort=${BK_PORT}|"
${BK_DIR}/conf/bk_server.conf
+fi
+if [[ "${BK_LEDGERS_PATH}" != "" ]]; then
+ sed -r -i "s|^[#
]*zkLedgersRootPath.*=.*|zkLedgersRootPath=${BK_LEDGERS_PATH}|"
${BK_DIR}/conf/bk_server.conf
+fi
+
+diff ${BK_DIR}/conf/bk_server.conf.bak ${BK_DIR}/conf/bk_server.conf || true
+# -------------- #
+
+# -------------- #
+# Wait for zookeeper server
+#set +x
Review comment:
I have un-commented them, it could be useful to wait for zk before start
bookkeeper. Maybe can be enhanced with a timeout.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services