Skip to content

Commit

Permalink
Docker/entrypoint: support disk mounting in service container
Browse files Browse the repository at this point in the history
Signed-off-by: Lijin Xiong <[email protected]>
  • Loading branch information
Lijin Xiong committed May 25, 2023
1 parent 51f8531 commit 9e09af4
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion docker/debian9/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
############################ GLOBAL VARIABLES
g_role=""
g_args=""
g_disk=""
g_prefix=""
g_preexec=""
g_binary=""
g_start_args=""
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 "disk 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

0 comments on commit 9e09af4

Please sign in to comment.