-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-entrypoint.sh
executable file
·103 lines (85 loc) · 2.17 KB
/
docker-entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/bash
#
# https://github.com/janeczku/docker-nfs-ganesha/blob/master/rootfs/opt/start_nfs.sh
#
set -e
# environment variables
: ${EXPORT_PATH:="/data/nfs"}
: ${PSEUDO_PATH:="/"}
: ${EXPORT_ID:=0}
: ${PROTOCOLS:=4}
: ${TRANSPORTS:="UDP, TCP"}
: ${SEC_TYPE:="sys"}
: ${SQUASH_MODE:="No_Root_Squash"}
: ${GRACELESS:=true}
: ${VERBOSITY:="NIV_EVENT"} # NIV_DEBUG, NIV_EVENT, NIV_WARN
: ${GANESHA_CONFIG:="/etc/ganesha/ganesha.conf"}
: ${GANESHA_LOGFILE:="/dev/stdout"}
init_rpc() {
echo "* Starting rpcbind"
if [ ! -x /run/rpcbind ] ; then
install -m755 -g 32 -o 32 -d /run/rpcbind
install -m755 -g 32 -o 32 -d /run/rpc_pipefs/nfs
fi
rpcbind || return 0
rpc.statd -L || return 0
rpc.idmapd || return 0
sleep 1
}
init_dbus() {
echo "* Starting dbus"
if [ ! -x /var/run/dbus ] ; then
install -m755 -g 81 -o 81 -d /var/run/dbus
fi
rm -f /var/run/dbus/*
rm -f /var/run/messagebus.pid
dbus-uuidgen --ensure
dbus-daemon --system --fork
sleep 1
}
# pNFS
# Ganesha by default is configured as pNFS DS.
# A full pNFS cluster consists of multiple DS
# and one MDS (Meta Data server). To implement
# this one needs to deploy multiple Ganesha NFS
# and then configure one of them as MDS:
# GLUSTER { PNFS_MDS = ${WITH_PNFS}; }
bootstrap_config() {
echo "* Writing configuration"
cat <<END >${GANESHA_CONFIG}
NFSV4 {
Graceless = ${GRACELESS};
}
EXPORT {
Export_Id = ${EXPORT_ID};
Path = "${EXPORT_PATH}";
Pseudo = "${PSEUDO_PATH}";
FSAL {
Name = VFS;
}
Access_type = RW;
Disable_ACL = true;
Squash = ${SQUASH_MODE};
Protocols = ${PROTOCOLS};
}
EXPORT_DEFAULTS {
Transports = ${TRANSPORTS};
SecType = ${SEC_TYPE};
}
END
}
sleep 0.5
if [ ! -f ${EXPORT_PATH} ]; then
mkdir -p "${EXPORT_PATH}"
fi
echo "Initializing Ganesha NFS server"
echo "=================================="
echo "export path: ${EXPORT_PATH}"
echo "=================================="
bootstrap_config
init_rpc
init_dbus
echo "Generated NFS-Ganesha config:"
cat ${GANESHA_CONFIG}
echo "* Starting Ganesha-NFS"
exec /usr/bin/ganesha.nfsd -F -L ${GANESHA_LOGFILE} -f ${GANESHA_CONFIG} -N ${VERBOSITY}