From 011bf1714c15a08fa262e30ca1470b91e7edc4e2 Mon Sep 17 00:00:00 2001 From: Kevin Cai Date: Mon, 31 Jul 2023 16:16:24 +0800 Subject: [PATCH] [Enhancement] refactor allin1 image (#28240) * add supervisor and nginx into allin1 * add broker into allin1 * robust register BE BROKER into FE * be able to use stream load directly talking to nginx http port Fixes #13319 Signed-off-by: Kevin Xiaohua Cai --- .dockerignore | 3 + .../dockerfiles/allin1/allin1-ubi.Dockerfile | 21 +- .../allin1/allin1-ubuntu.Dockerfile | 15 +- docker/dockerfiles/allin1/banner.txt | 23 ++ docker/dockerfiles/allin1/entrypoint.sh | 56 ++++ .../allin1/services/director/run.sh | 248 ++++++++++++++++++ .../services/feproxy/feproxy.conf.template | 67 +++++ .../services/supervisor/supervisord.conf | 94 +++++++ docker/dockerfiles/allin1/start_fe_be.sh | 36 --- docker/dockerfiles/be/be-ubi.Dockerfile | 4 +- docker/dockerfiles/fe/fe-ubi.Dockerfile | 4 +- 11 files changed, 514 insertions(+), 57 deletions(-) create mode 100644 docker/dockerfiles/allin1/banner.txt create mode 100755 docker/dockerfiles/allin1/entrypoint.sh create mode 100755 docker/dockerfiles/allin1/services/director/run.sh create mode 100644 docker/dockerfiles/allin1/services/feproxy/feproxy.conf.template create mode 100644 docker/dockerfiles/allin1/services/supervisor/supervisord.conf delete mode 100644 docker/dockerfiles/allin1/start_fe_be.sh diff --git a/.dockerignore b/.dockerignore index 87e662caf9e..af7fe243d83 100644 --- a/.dockerignore +++ b/.dockerignore @@ -17,3 +17,6 @@ output/fe/meta output/fe/log output/be/storage output/be/log +# allow build fs_broker into allin1 docker image +!fs_brokers/apache_hdfs_broker/output +fs_brokers/apache_hdfs_broker/output/log diff --git a/docker/dockerfiles/allin1/allin1-ubi.Dockerfile b/docker/dockerfiles/allin1/allin1-ubi.Dockerfile index fe4ef36f766..910040dcc10 100644 --- a/docker/dockerfiles/allin1/allin1-ubi.Dockerfile +++ b/docker/dockerfiles/allin1/allin1-ubi.Dockerfile @@ -2,7 +2,7 @@ # Please run this command from the git repo root directory to build: # # - Use artifact image to package runtime container: -# > DOCKER_BUILDKIT=1 docker build --build-arg ARTIFACT_SOURCE=image --build-arg ARTIFACTIMAGE=ghcr.io/starrocks/starrocks/artifact-centos7:latest -f docker/dockerfiles/allin1/allin1-ubi.Dockerfile -t allin1-ubi:latest . +# > DOCKER_BUILDKIT=1 docker build --build-arg ARTIFACT_SOURCE=image --build-arg ARTIFACTIMAGE=starrocks/artifacts-centos7:latest -f docker/dockerfiles/allin1/allin1-ubi.Dockerfile -t allin1-ubi:latest . # - Use locally build artifacts to package runtime container: # > DOCKER_BUILDKIT=1 docker build --build-arg ARTIFACT_SOURCE=local --build-arg LOCAL_REPO_PATH=. -f docker/dockerfiles/allin1/allin1-ubi.Dockerfile -t allin1-ubi:latest . # @@ -20,6 +20,7 @@ ARG LOCAL_REPO_PATH COPY ${LOCAL_REPO_PATH}/output/fe /release/fe_artifacts/fe COPY ${LOCAL_REPO_PATH}/output/be /release/be_artifacts/be +COPY ${LOCAL_REPO_PATH}/fs_brokers/apache_hdfs_broker/output/apache_hdfs_broker /release/broker_artifacts/apache_hdfs_broker FROM artifacts-from-${ARTIFACT_SOURCE} as artifacts @@ -29,10 +30,11 @@ FROM registry.access.redhat.com/ubi8/ubi:8.7 ARG DEPLOYDIR=/data/deploy ENV SR_HOME=${DEPLOYDIR}/starrocks -RUN yum install -y java-1.8.0-openjdk-devel tzdata openssl curl vim ca-certificates fontconfig gzip tar less hostname procps-ng lsof && \ - rpm -ivh https://repo.mysql.com/mysql57-community-release-el7.rpm && \ +RUN yum install -y java-1.8.0-openjdk-devel tzdata openssl curl vim ca-certificates fontconfig gzip tar less hostname procps-ng lsof python3-pip nginx nc && \ + rpm -ivh https://repo.mysql.com/mysql80-community-release-el8-7.noarch.rpm && \ yum -y install mysql-community-client --nogpgcheck && \ - yum remove -y mysql57-community-release-el7 + yum remove -y mysql80-community-release && \ + pip3 install supervisor ENV JAVA_HOME=/usr/lib/jvm/java-openjdk WORKDIR $DEPLOYDIR @@ -40,14 +42,13 @@ WORKDIR $DEPLOYDIR # Copy all artifacts to the runtime container image COPY --from=artifacts /release/be_artifacts/ $DEPLOYDIR/starrocks COPY --from=artifacts /release/fe_artifacts/ $DEPLOYDIR/starrocks +COPY --from=artifacts /release/broker_artifacts/ $DEPLOYDIR/starrocks -# Copy Setup script. -COPY --chmod=755 docker/dockerfiles/allin1/*.sh $DEPLOYDIR - -# Copy config files -COPY docker/dockerfiles/allin1/*.conf $DEPLOYDIR +# Copy setup script and config files +COPY docker/dockerfiles/allin1/*.sh docker/dockerfiles/allin1/*.conf docker/dockerfiles/allin1/*.txt $DEPLOYDIR +COPY docker/dockerfiles/allin1/services/ $SR_HOME RUN cat be.conf >> $DEPLOYDIR/starrocks/be/conf/be.conf && \ cat fe.conf >> $DEPLOYDIR/starrocks/fe/conf/fe.conf && \ mkdir -p $DEPLOYDIR/starrocks/fe/meta && mkdir -p $DEPLOYDIR/starrocks/be/storage && touch /.dockerenv -CMD ./start_fe_be.sh +CMD ./entrypoint.sh diff --git a/docker/dockerfiles/allin1/allin1-ubuntu.Dockerfile b/docker/dockerfiles/allin1/allin1-ubuntu.Dockerfile index 116f54e7231..b998939ea2c 100644 --- a/docker/dockerfiles/allin1/allin1-ubuntu.Dockerfile +++ b/docker/dockerfiles/allin1/allin1-ubuntu.Dockerfile @@ -2,7 +2,7 @@ # Please run this command from the git repo root directory to build: # # - Use artifact image to package runtime container: -# > DOCKER_BUILDKIT=1 docker build --build-arg ARTIFACT_SOURCE=image --build-arg ARTIFACTIMAGE=ghcr.io/starrocks/starrocks/artifact-ubuntu:latest -f docker/dockerfiles/allin1/allin1-ubuntu.Dockerfile -t allin1-ubuntu:latest . +# > DOCKER_BUILDKIT=1 docker build --build-arg ARTIFACT_SOURCE=image --build-arg ARTIFACTIMAGE=starrocks/artifacts-ubuntu:latest -f docker/dockerfiles/allin1/allin1-ubuntu.Dockerfile -t allin1-ubuntu:latest . # - Use locally build artifacts to package runtime container: # > DOCKER_BUILDKIT=1 docker build --build-arg ARTIFACT_SOURCE=local --build-arg LOCAL_REPO_PATH=. -f docker/dockerfiles/allin1/allin1-ubuntu.Dockerfile -t allin1-ubuntu:latest . # @@ -20,6 +20,7 @@ ARG LOCAL_REPO_PATH COPY ${LOCAL_REPO_PATH}/output/fe /release/fe_artifacts/fe COPY ${LOCAL_REPO_PATH}/output/be /release/be_artifacts/be +COPY ${LOCAL_REPO_PATH}/fs_brokers/apache_hdfs_broker/output/apache_hdfs_broker /release/broker_artifacts/apache_hdfs_broker FROM artifacts-from-${ARTIFACT_SOURCE} as artifacts @@ -30,7 +31,7 @@ ARG DEPLOYDIR=/data/deploy ENV SR_HOME=${DEPLOYDIR}/starrocks RUN apt-get update -y && apt-get install -y --no-install-recommends \ - binutils-dev default-jdk python2 mysql-client curl vim tree net-tools less tzdata linux-tools-common linux-tools-generic && \ + binutils-dev default-jdk python2 mysql-client curl vim tree net-tools less tzdata linux-tools-common linux-tools-generic supervisor nginx netcat && \ ln -fs /usr/share/zoneinfo/UTC /etc/localtime && \ dpkg-reconfigure -f noninteractive tzdata && \ rm -rf /var/lib/apt/lists/* @@ -42,14 +43,14 @@ WORKDIR $DEPLOYDIR # Copy all artifacts to the runtime container image COPY --from=artifacts /release/be_artifacts/ $DEPLOYDIR/starrocks COPY --from=artifacts /release/fe_artifacts/ $DEPLOYDIR/starrocks +COPY --from=artifacts /release/broker_artifacts/ $DEPLOYDIR/starrocks -# Copy Setup script. -COPY --chmod=755 docker/dockerfiles/allin1/*.sh $DEPLOYDIR +# Copy setup script and config files +COPY docker/dockerfiles/allin1/*.sh docker/dockerfiles/allin1/*.conf docker/dockerfiles/allin1/*.txt $DEPLOYDIR +COPY docker/dockerfiles/allin1/services/ $SR_HOME -# Copy config files -COPY docker/dockerfiles/allin1/*.conf $DEPLOYDIR RUN cat be.conf >> $DEPLOYDIR/starrocks/be/conf/be.conf && \ cat fe.conf >> $DEPLOYDIR/starrocks/fe/conf/fe.conf && \ mkdir -p $DEPLOYDIR/starrocks/fe/meta && mkdir -p $DEPLOYDIR/starrocks/be/storage && touch /.dockerenv -CMD ./start_fe_be.sh +CMD ./entrypoint.sh diff --git a/docker/dockerfiles/allin1/banner.txt b/docker/dockerfiles/allin1/banner.txt new file mode 100644 index 00000000000..b4c06c17dfd --- /dev/null +++ b/docker/dockerfiles/allin1/banner.txt @@ -0,0 +1,23 @@ +**************************************************************************************************** +* ________ _________ ________ ________ ________ ________ ________ ___ __ ________ +* |\ ____\|\___ ___\\ __ \|\ __ \|\ __ \|\ __ \|\ ____\|\ \|\ \ |\ ____\ +* \ \ \___|\|___ \ \_\ \ \|\ \ \ \|\ \ \ \|\ \ \ \|\ \ \ \___|\ \ \/ /|\ \ \___|_ +* \ \_____ \ \ \ \ \ \ __ \ \ _ _\ \ _ _\ \ \\\ \ \ \ \ \ ___ \ \_____ \ +* \|____|\ \ \ \ \ \ \ \ \ \ \ \\ \\ \ \\ \\ \ \\\ \ \ \____\ \ \\ \ \|____|\ \ +* ____\_\ \ \ \__\ \ \__\ \__\ \__\\ _\\ \__\\ _\\ \_______\ \_______\ \__\\ \__\____\_\ \ +* |\_________\ \|__| \|__|\|__|\|__|\|__|\|__|\|__|\|_______|\|_______|\|__| \|__|\_________\ +* \|_________| \|_________| +* +* ________ ___ ___ ___ ________ _____ +* |\ __ \|\ \ |\ \ |\ \|\ ___ \ / __ \ +* \ \ \|\ \ \ \ \ \ \ \ \ \ \ \\ \ \|\/_|\ \ +* \ \ __ \ \ \ \ \ \ \ \ \ \ \\ \ \|/ \ \ \ +* \ \ \ \ \ \ \____\ \ \____\ \ \ \ \\ \ \ \ \ \ +* \ \__\ \__\ \_______\ \_______\ \__\ \__\\ \__\ \ \__\ +* \|__|\|__|\|_______|\|_______|\|__|\|__| \|__| \|__| +* +**************************************************************************************************** + +StarRocks [(Blazing Fast)]> _ + + diff --git a/docker/dockerfiles/allin1/entrypoint.sh b/docker/dockerfiles/allin1/entrypoint.sh new file mode 100755 index 00000000000..6f5a862f99a --- /dev/null +++ b/docker/dockerfiles/allin1/entrypoint.sh @@ -0,0 +1,56 @@ +#!/bin/bash +# Copyright 2021-present StarRocks, Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -e + +get_fe_http_port() +{ + source $SR_HOME/fe/bin/common.sh + export_env_from_conf $SR_HOME/fe/conf/fe.conf + echo ${http_port:-8030} +} + +update_feproxy_config() +{ + # process fe http_port from a sub shell to avoid env var escalation + fehttpport=`get_fe_http_port` + cat $SR_HOME/feproxy/feproxy.conf.template | sed -e "s|{{feproxyhome}}|$SR_HOME/feproxy|g" -e "s|{{fewebport}}|${fehttpport}|g" > $SR_HOME/feproxy/feproxy.conf +} + +setup_priority_networks() +{ + echo "priority_networks = 127.0.0.1/32" >> $SR_HOME/fe/conf/fe.conf + echo "priority_networks = 127.0.0.1/32" >> $SR_HOME/be/conf/be.conf +} + +# print banner +if [ -f $SR_HOME/../banner.txt ] ; then + cat $SR_HOME/../banner.txt +fi + +# setup log directories +mkdir -p $SR_HOME/{supervisor,fe,be,apache_hdfs_broker,feproxy}/log + +update_feproxy_config +# use 127.0.0.1 for all the services, include fe/be/broker +setup_priority_networks + +# setup supervisor and start +SUPERVISORD_HOME=$SR_HOME/supervisor +# allow supervisorctl to find the correct supervisord.conf +ln -sfT $SUPERVISORD_HOME/supervisord.conf /etc/supervisord.conf + +cd $SUPERVISORD_HOME +exec supervisord -n -c $SUPERVISORD_HOME/supervisord.conf diff --git a/docker/dockerfiles/allin1/services/director/run.sh b/docker/dockerfiles/allin1/services/director/run.sh new file mode 100755 index 00000000000..cb078bf36f5 --- /dev/null +++ b/docker/dockerfiles/allin1/services/director/run.sh @@ -0,0 +1,248 @@ +#!/bin/bash +# Copyright 2021-present StarRocks, Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SQL_RETRY_INTERNAL=5 +FE_HOME=$SR_HOME/fe +BE_HOME=$SR_HOME/be +MYCNF=$SR_HOME/director/my.cnf +BROKER_HOME=$SR_HOME/apache_hdfs_broker +source $FE_HOME/bin/common.sh +PREVIOUS_FQDN= +CURRENT_FQDN=`hostname -f` + +PASSWD_ERROR_MSG="Password error, stop retrying! +If the root user password is changed, please re-run the container with '-e MYSQL_PWD='" +PERSISTENT_MSG=" * IMPORTANT NOTICE! + +If FE/BE state needs to be persisted, please be sure the following directories are mounted: +* FE service meta: $FE_HOME/meta +* BE service storage: $BE_HOME/storage +" +HOSTNAME_MISMATCH_MSG=" +Detect FE service hostname mismatch, FE service won't start. +This is probably caused by persisted fe/meta from outside container, but the container's +hostname is not fixed. If running with docker engine, use '-h ' to assign a +fixed hostname and restart. +" + +MYHOST=127.0.0.1 + +log_stderr() +{ + echo "`date --rfc-3339=seconds` $@" >&2 +} + +loginfo() +{ + log_stderr "INFO $@" +} + +logwarn() +{ + log_stderr "WARN $@" +} + +logerror() +{ + log_stderr "ERROR $@" +} + +hang_and_die() +{ + sleeptime=15 + logerror "will force shutdown in $sleeptime seconds ..." + sleep $sleeptime + supervisorctl shutdown + exit 1 +} + +fe_mysql_port() +{ + export_env_from_conf $FE_HOME/conf/fe.conf + echo ${query_port:-"9030"} +} + +be_heartbeat_service_port() +{ + export_env_from_conf $BE_HOME/conf/be.conf + echo ${heartbeat_service_port:-"9050"} +} + +broker_ipc_port() +{ + export_env_from_conf $BROKER_HOME/conf/apache_hdfs_broker.conf + echo ${broker_ipc_port:-"8000"} +} + +check_fe_fqdn_mismatch() +{ + if [ -f $FE_HOME/meta/image/ROLE ] ; then + previous_name=`grep '^name=' $FE_HOME/meta/image/ROLE | sed 's/name=//' | awk -F'_' '{print $1}'` + if [ "$previous_name" == "127.0.0.1" ] ; then + return + fi + current_name=`hostname -f` + if [[ "$previous_name" != "$current_name" ]] ; then + loginfo "hostname in FE meta: $previous_name" + loginfo "current container hostname: $current_name" + logerror "$HOSTNAME_MISMATCH_MSG" + hang_and_die + fi + fi +} + +# check fe service aliveness +check_fe_liveness() +{ + fequeryport=`fe_mysql_port` + loginfo "checking if FE service query port:$fequeryport alive or not ..." + while true + do + if nc -z -4 -w 5 $MYHOST $fequeryport ; then + loginfo "FE service query port:$fequeryport is alive!" + break + else + logwarn "FE service query port:$fequeryport is NOT alive yet!" + sleep 2 + fi + done +} + +generate_my_cnf() +{ + loginfo "generate my.cnf file ..." + fequeryport=`fe_mysql_port` + cat > $MYCNF << EOF +[client] +user=root +host=$MYHOST +port=$fequeryport +column-names=FALSE +connect-timeout=2 +EOF +} + +exec_sql() +{ + mysql --defaults-file=$MYCNF --batch -e "$@" +} + +exec_sql_with_column() +{ + mysql --defaults-file=$MYCNF --column-names --batch -e "$@" +} + +exec_sql_with_retry() +{ + local sql="$@" + while true + do + result=`exec_sql "$@" 2>&1` + ret=$? + if [ $ret -eq 0 ] ; then + echo "$result" + return 0 + else + errcode=`echo $result | awk -F " " '{print $2}'` + if [[ $errcode = '1045' || $errcode = '1064' ]] ; then + logerror "$PASSWD_ERROR_MSG" + return 1 + else + logwarn "mysql command fails with error: '$result', will try again" + fi + fi + sleep $SQL_RETRY_INTERNAL + done +} + +check_and_add_be() +{ + loginfo "check if need to add BE into FE service ..." + while true + do + result=`exec_sql_with_retry "SHOW BACKENDS;"` + ret=$? + if [ $ret -ne 0 ] ; then + hang_and_die + else + if echo "$result" | grep -q $MYHOST &>/dev/null ; then + loginfo "BE service already added into FE service ... " + return 0 + else + beheartbeatport=`be_heartbeat_service_port` + loginfo "Add BE($MYHOST:$beheartbeatport) into FE service ..." + exec_sql_with_retry "ALTER SYSTEM ADD BACKEND '$MYHOST:$beheartbeatport';" + fi + fi + done +} + +check_and_add_broker() +{ + loginfo "check if need to add BROKER into FE service ..." + while true + do + result=`exec_sql_with_retry "SHOW BROKER;"` + ret=$? + if [ $ret -ne 0 ] ; then + hang_and_die + else + if echo "$result" | grep -q $MYHOST &>/dev/null ; then + loginfo "broker service already added into FE service ... " + return 0 + else + brokerport=`broker_ipc_port` + loginfo "Add BROKER($MYHOST:$brokerport) into FE service ..." + exec_sql_with_retry "ALTER SYSTEM ADD BROKER allin1broker '$MYHOST:$brokerport';" + fi + fi + done +} + +loginfo "checking if need to perform auto registring Backend and Broker ..." +check_fe_fqdn_mismatch +check_fe_liveness +generate_my_cnf +check_and_add_be +check_and_add_broker +loginfo "cluster initialization DONE!" +loginfo "wait a few seconds for BE and Broker's heartbeat ..." +# allow heartbeat from BE/BROKER to FE +sleep 10 +loginfo "StarRocks Cluster information details:" +exec_sql_with_column 'SHOW FRONTENDS\G' +exec_sql_with_column 'SHOW BACKENDS\G' +exec_sql_with_column 'SHOW BROKER\G' + +loginfo +loginfo +loginfo "$PERSISTENT_MSG" +loginfo +loginfo "FE mysql query port: `fe_mysql_port`" +loginfo "FE http service port: 8080" +loginfo +loginfo "Enjoy the journal to StarRocks blazing-fast lake-house engine!" + +while true +do + st=`supervisorctl status` + running=`echo "$st" | grep RUNNING | wc -l` + bad=`echo "$st" | grep -v RUNNING | wc -l` + if [ $bad -gt 0 ] ; then + logwarn "has $bad services into non-RUNNING status!" + logwarn "$st" + fi + sleep 5 +done diff --git a/docker/dockerfiles/allin1/services/feproxy/feproxy.conf.template b/docker/dockerfiles/allin1/services/feproxy/feproxy.conf.template new file mode 100644 index 00000000000..55fa0be5815 --- /dev/null +++ b/docker/dockerfiles/allin1/services/feproxy/feproxy.conf.template @@ -0,0 +1,67 @@ +user root; +worker_processes 4; +pid {{feproxyhome}}/nginx.pid; +include /usr/share/nginx/modules/*.conf; + +events { + worker_connections 256; +} + +error_log {{feproxyhome}}/log/error.log info; + +http { + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 65; + types_hash_max_size 2048; + client_max_body_size 0; + ignore_invalid_headers off; + underscores_in_headers on; + + access_log {{feproxyhome}}/log/access.log; + include /etc/nginx/mime.types; + default_type application/octet-stream; + server { + listen 8080; + server_name starrocks-allin1.localdomain; + location / { + proxy_pass http://127.0.0.1:{{fewebport}}; + proxy_set_header Expect $http_expect; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_intercept_errors on; + error_page 307 = @handle_redirect; + } + location /api/transaction/load { + proxy_pass http://127.0.0.1:{{fewebport}}; + proxy_pass_request_body off; + proxy_set_header Expect $http_expect; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_intercept_errors on; + error_page 307 = @handle_redirect; + } + location ~ ^/api/.*/.*/_stream_load$ { + proxy_pass http://127.0.0.1:{{fewebport}}; + proxy_pass_request_body off; + proxy_set_header Expect $http_expect; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_intercept_errors on; + error_page 307 = @handle_redirect; + } + location @handle_redirect { + set $redirect_uri '$upstream_http_location'; + proxy_pass $redirect_uri; + proxy_set_header Expect $http_expect; + proxy_pass_request_body on; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } + } +} diff --git a/docker/dockerfiles/allin1/services/supervisor/supervisord.conf b/docker/dockerfiles/allin1/services/supervisor/supervisord.conf new file mode 100644 index 00000000000..b8bf0ce45e9 --- /dev/null +++ b/docker/dockerfiles/allin1/services/supervisor/supervisord.conf @@ -0,0 +1,94 @@ +[unix_http_server] +file=%(ENV_SR_HOME)s/supervisor/supervisor.sock + + +[supervisord] +logfile=%(ENV_SR_HOME)s/supervisor/log/supervisord.log +logfile_maxbytes=50MB +logfile_backups=10 +loglevel=info +pidfile=%(ENV_SR_HOME)s/supervisor/supervisord.pid +user=root +nodaemon=true + + +[rpcinterface:supervisor] +supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface + + +[supervisorctl] +serverurl=unix://%(ENV_SR_HOME)s/supervisor/supervisor.sock + + +[program:feservice] +command=%(ENV_SR_HOME)s/fe/bin/start_fe.sh +numprocs=1 +directory=%(ENV_SR_HOME)s/fe +autostart=true +autorestart=true +startsecs=5 +startretries=3 +stopwaitsecs=15 +redirect_stderr=true +stdout_logfile=%(ENV_SR_HOME)s/fe/log/fe.out +stdout_logfile_maxbytes=200MB +stdout_logfile_backups=20 + + +[program:beservice] +command=%(ENV_SR_HOME)s/be/bin/start_be.sh +numprocs=1 +directory=%(ENV_SR_HOME)s/be +autostart=true +autorestart=true +startsecs=5 +startretries=3 +stopwaitsecs=15 +redirect_stderr=true +stdout_logfile=%(ENV_SR_HOME)s/be/log/be.out +stdout_logfile_maxbytes=200MB +stdout_logfile_backups=20 + + +[program:broker] +command=%(ENV_SR_HOME)s/apache_hdfs_broker/bin/start_broker.sh +numprocs=1 +directory=%(ENV_SR_HOME)s/apache_hdfs_broker +autostart=true +autorestart=true +startsecs=5 +startretries=3 +stopwaitsecs=15 +redirect_stderr=true +stdout_logfile=%(ENV_SR_HOME)s/apache_hdfs_broker/log/apache_hdfs_broker.out +stdout_logfile_maxbytes=200MB +stdout_logfile_backups=20 + + +[program:feproxy] +command=nginx -g "daemon off;" -c %(ENV_SR_HOME)s/feproxy/feproxy.conf +numprocs=1 +directory=%(ENV_SR_HOME)s/feproxy +autostart=true +autorestart=true +startsecs=5 +startretries=3 +stopwaitsecs=15 +redirect_stderr=true +stdout_logfile=%(ENV_SR_HOME)s/feproxy/log/feproxy.out +stdout_logfile_maxbytes=200MB +stdout_logfile_backups=20 + + +[program:director] +command=%(ENV_SR_HOME)s/director/run.sh +numprocs=1 +directory=%(ENV_SR_HOME)s/director +autostart=true +autorestart=true +startsecs=5 +startretries=3 +stopwaitsecs=15 +redirect_stderr=true +stdout_logfile=/dev/fd/1 +stdout_logfile_maxbytes=0 diff --git a/docker/dockerfiles/allin1/start_fe_be.sh b/docker/dockerfiles/allin1/start_fe_be.sh deleted file mode 100644 index f4fa3a316d2..00000000000 --- a/docker/dockerfiles/allin1/start_fe_be.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -log_stdin() -{ - echo "[`date`] $@" >&1 -} - -# Start FE. -cd $SR_HOME/fe/bin/ -log_stdin "Start FE" -./start_fe.sh --host_type FQDN --daemon - -# Start BE. -log_stdin "Start BE" -cd $SR_HOME/be/bin/ -./start_be.sh --daemon - - -# Sleep until the cluster starts. -sleep 15; - -# Fetch fqdn with the command suggested by AWS official doc: https://docs.aws.amazon.com/managedservices/latest/userguide/find-FQDN.html -MYFQDN=`hostname --fqdn` -log_stdin "Register BE ${MYFQDN} to FE" -mysql -uroot -h${MYFQDN} -P 9030 -e "alter system add backend '${MYFQDN}:9050';" - - -# health check the entire stack end-to-end and exit on failure. -while sleep 10; do - PROCESS_STATUS=`mysql -uroot -h127.0.0.1 -P 9030 -e "show backends\G" |grep "Alive: true"` - if [ -z "$PROCESS_STATUS" ]; then - log_stdin "service has exited" - exit 1; - fi; - log_stdin $PROCESS_STATUS -done diff --git a/docker/dockerfiles/be/be-ubi.Dockerfile b/docker/dockerfiles/be/be-ubi.Dockerfile index 097c668ac86..94d8564f429 100644 --- a/docker/dockerfiles/be/be-ubi.Dockerfile +++ b/docker/dockerfiles/be/be-ubi.Dockerfile @@ -28,9 +28,9 @@ FROM registry.access.redhat.com/ubi8/ubi:8.7 ARG STARROCKS_ROOT=/opt/starrocks RUN yum install -y java-1.8.0-openjdk-devel tzdata openssl curl vim ca-certificates fontconfig gzip tar less hostname procps-ng lsof && \ - rpm -ivh https://repo.mysql.com/mysql57-community-release-el7.rpm && \ + rpm -ivh https://repo.mysql.com/mysql80-community-release-el8-7.noarch.rpm && \ yum -y install mysql-community-client --nogpgcheck && \ - yum remove -y mysql57-community-release-el7 + yum remove -y mysql80-community-release ENV JAVA_HOME=/usr/lib/jvm/java-openjdk RUN touch /.dockerenv diff --git a/docker/dockerfiles/fe/fe-ubi.Dockerfile b/docker/dockerfiles/fe/fe-ubi.Dockerfile index ebdc79884e8..a6fdb55ab2a 100644 --- a/docker/dockerfiles/fe/fe-ubi.Dockerfile +++ b/docker/dockerfiles/fe/fe-ubi.Dockerfile @@ -28,9 +28,9 @@ FROM registry.access.redhat.com/ubi8/ubi:8.7 ARG STARROCKS_ROOT=/opt/starrocks RUN yum install -y java-1.8.0-openjdk-devel tzdata openssl curl vim ca-certificates fontconfig gzip tar less hostname procps-ng lsof && \ - rpm -ivh https://repo.mysql.com/mysql57-community-release-el7.rpm && \ + rpm -ivh https://repo.mysql.com/mysql80-community-release-el8-7.noarch.rpm && \ yum -y install mysql-community-client --nogpgcheck && \ - yum remove -y mysql57-community-release-el7 + yum remove -y mysql80-community-release ENV JAVA_HOME=/usr/lib/jvm/java-openjdk RUN touch /.dockerenv