Files
oceanbase/tools/docker/standalone/boot/_boot
Laughing cb3e9eacc2 fix standalone docker bugs (#861)
* Update boot-tmp.yaml
* Update boot-mini-tmp.yaml
* Update Dockerfile
* Update _boot

- change the datafile_size to 10G
- use ob-deploy-1.2.1 instead of ob-deploy;
- use oceanbase-ce-3.1.3 instead of oceanbase-ce-3.1.2

- fix MINI_MODE bug:
`if ${MINI_MODE}` will throw exception while set the environment MINI_MODE=1
2022-04-26 10:21:49 +08:00

54 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
CWD=$(cd `dirname $0`;pwd)
cd "${CWD}"
source _env
STAMP="$(date +%s)"
# return 0 if mini_mode is nil or 'no'/'false'/0
# 0 means true and 1 for false in bash
function is_mini_mode() {
if test -z ${MINI_MODE}
then
return 1
fi
# convert MINI_MODE to upper case string(can work in bash 4.x)
mini_mode=${MINI_MODE^^}
if [ "x${mini_mode}" == "xNO" ] || [ "x${mini_mode}" == "xFALSE" ] || [ "x${mini_mode}" == "x0" ]; then
return 1
fi
return 0
}
[[ -f boot.yaml ]] && echo "find boot.yaml, skip configuring..." || {
echo "generate boot.yaml ..."
TMPFILE="boot.${STAMP}.yaml"
if is_mini_mode
then
echo "oceanbase-ce docker in mini mode"
cp -f boot-mini-tmp.yaml $TMPFILE
else
cp -f boot-tmp.yaml $TMPFILE
fi
sed -i "s|@OB_HOME_PATH@|${OB_HOME_PATH}|g" $TMPFILE
sed -i "s|@OB_MYSQL_PORT@|${OB_MYSQL_PORT}|g" $TMPFILE
sed -i "s|@OB_RPC_PORT@|${OB_RPC_PORT}|g" $TMPFILE
sed -i "s|@OB_ROOT_PASSWORD@|${OB_ROOT_PASSWORD}|g" $TMPFILE
[ "${OB_DATA_DIR}" ] && echo " data_dir: ${OB_DATA_DIR}" >> $TMPFILE
[ "${OB_REDO_DIR}" ] && echo " redo_dir: ${OB_REDO_DIR}" >> $TMPFILE
echo "create boot dirs and deploy ob cluster ..."
mkdir -p $OB_HOME_PATH
obd cluster autodeploy "${OB_CLUSTER_NAME}" -c $TMPFILE \
&& obd cluster tenant create "${OB_CLUSTER_NAME}" -n ${OB_TENANT_NAME} \
&& obclient -h127.1 -uroot@${OB_TENANT_NAME} -A -P${OB_MYSQL_PORT} < init_tenant_user.sql \
&& mv -f $TMPFILE boot.yaml \
&& echo "start ob cluster ..." \
&& echo "boot success!" \
&& exec /sbin/init
}