2017-04-14 20:03:22 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
echo MAKE SURE you have \"nfs-kernel-common\" installed on the host before starting this NFS server
|
|
|
|
echo Press Ctrl-C to bail out in 3 seconds
|
|
|
|
|
|
|
|
sleep 3
|
|
|
|
|
|
|
|
echo WARNING: This NFS server won\'t save any data after you delete the container
|
|
|
|
|
2017-04-14 20:42:21 +00:00
|
|
|
sleep 1
|
|
|
|
|
2017-04-14 20:03:22 +00:00
|
|
|
source ./common.sh
|
|
|
|
|
2017-04-14 21:31:52 +00:00
|
|
|
while [[ $# -gt 1 ]]
|
|
|
|
do
|
|
|
|
key="$1"
|
|
|
|
|
|
|
|
case $key in
|
|
|
|
-n|--network)
|
|
|
|
network="$2"
|
|
|
|
shift # past argument
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
# unknown
|
|
|
|
# option
|
|
|
|
echo ${USAGE}
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2017-04-14 20:03:22 +00:00
|
|
|
NFS_SERVER=longhorn-nfs-server
|
|
|
|
NFS_IMAGE=docker.io/erezhorev/dockerized_nfs_server
|
|
|
|
|
|
|
|
BACKUPSTORE_PATH=/opt/backupstore
|
|
|
|
|
2017-04-14 21:31:52 +00:00
|
|
|
network_option=
|
|
|
|
if [ "$network" != "" ]; then
|
|
|
|
network_option="--network ${network}"
|
|
|
|
fi
|
|
|
|
|
2017-04-14 20:03:22 +00:00
|
|
|
docker run -d \
|
|
|
|
--name ${NFS_SERVER} \
|
2017-04-14 21:31:52 +00:00
|
|
|
${network_option} \
|
2017-04-14 20:03:22 +00:00
|
|
|
--privileged \
|
|
|
|
${NFS_IMAGE} ${BACKUPSTORE_PATH}
|
|
|
|
|
|
|
|
nfs_ip=$(get_container_ip ${NFS_SERVER})
|
|
|
|
|
|
|
|
echo NFS server is up
|
|
|
|
echo
|
2017-04-14 20:42:21 +00:00
|
|
|
echo Set following URL as the Backup Target in the Longhorn:
|
2017-04-14 20:03:22 +00:00
|
|
|
echo
|
|
|
|
echo nfs://${nfs_ip}:${BACKUPSTORE_PATH}
|
|
|
|
echo
|