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 <lijin.xiong@zstack.io>
  • Loading branch information
Lijin Xiong committed Mar 3, 2023
1 parent 51f8531 commit f352519
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions 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,10 +32,12 @@ 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_
}

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 f352519

Please sign in to comment.