Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker/entrypoint: support disk mounting in service container #2285

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion docker/debian11/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ g_prefix=""
g_preexec="/curvebs/tools-v2/sbin/daemon"
g_binary=""
g_start_args=""
g_disk=""
disk_mount_point=/curvebs/chunkserver/data

############################ BASIC FUNCTIONS
function msg() {
Expand All @@ -30,15 +32,17 @@ function usage () {
Usage:
entrypoint.sh --role=ROLE
entrypoint.sh --role=ROLE --args=ARGS
entrypoint.sh --role=ROLE --args=ARGS --disk=DISKUUID

Examples:
entrypoint.sh --role=etcd
entrypoint.sh --role=client --args="-o default_permissions"
entrypoint.sh --role=chunkserver --args="raftSnapshotUri=curve:///curvebs/chunkserver/data/copysets..." --disk=UUID=39de3b63-ec32-47de-bfa0-e1d6917853da
_EOC_
}

function get_options() {
local long_opts="role:,args:,help"
local long_opts="role:,args:,disk:,help"
local args=`getopt -o ra --long $long_opts -n "$0" -- "$@"`
eval set -- "${args}"
while true
Expand All @@ -52,6 +56,10 @@ function get_options() {
g_args=$2
shift 2
;;
-d|--disk)
g_disk=$2
shift 2
;;
-h)
usage
exit 1
Expand Down Expand Up @@ -81,6 +89,11 @@ function prepare() {
g_start_args="--confPath $conf_path"
;;
chunkserver)
if [ "$g_disk" ]; then
[[ ! -d $disk_mount_point ]] && die "mount point $disk_mount_point does not exist.\n"
mount -o rw,errors=remount-ro $g_disk $disk_mount_point
[[ $? -ne 0 ]] && die "mount disk device $g_disk to $disk_mount_point failed.\n"
fi
g_binary="$g_prefix/sbin/curvebs-chunkserver"
g_start_args="--conf=$conf_path"
;;
Expand Down