mirror of
https://github.com/vimagick/dockerfiles.git
synced 2024-12-25 02:04:06 +02:00
add nfs
This commit is contained in:
parent
12829e241d
commit
39b2387334
18
nfs/Dockerfile
Normal file
18
nfs/Dockerfile
Normal file
@ -0,0 +1,18 @@
|
||||
#
|
||||
# Dockerfile for nfs
|
||||
#
|
||||
|
||||
FROM debian:bullseye
|
||||
MAINTAINER EasyPi Software Foundation
|
||||
|
||||
RUN set -xe \
|
||||
&& apt update \
|
||||
&& apt install -y nfs-ganesha nfs-ganesha-vfs tini \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY ./docker-entrypoint.sh /entrypoint.sh
|
||||
|
||||
EXPOSE 2049
|
||||
|
||||
ENTRYPOINT ["tini", "--"]
|
||||
CMD ["/entrypoint.sh"]
|
@ -1,22 +1,12 @@
|
||||
nfs:
|
||||
image: erichough/nfs-server
|
||||
ports:
|
||||
- "111:111/tcp"
|
||||
- "111:111/udp"
|
||||
- "2049:2049/tcp"
|
||||
- "2049:2049/udp"
|
||||
- "32765:32765/tcp"
|
||||
- "32765:32765/udp"
|
||||
- "32767:32767/tcp"
|
||||
- "32767:32767/udp"
|
||||
volumes:
|
||||
- ./data/splash:/export/splash:ro
|
||||
- /lib/modules:/lib/modules:ro
|
||||
environment:
|
||||
- NFS_LOG_LEVEL=DEBUG
|
||||
- NFS_EXPORT_0=/export/splash/filters *(ro,no_subtree_check)
|
||||
- NFS_EXPORT_1=/export/splash/js-profiles *(ro,no_subtree_check)
|
||||
- NFS_EXPORT_2=/export/splash/lua_modules *(ro,no_subtree_check)
|
||||
- NFS_EXPORT_3=/export/splash/proxy-profiles *(ro,no_subtree_check)
|
||||
privileged: true
|
||||
restart: unless-stopped
|
||||
version: "3.8"
|
||||
services:
|
||||
nfs:
|
||||
build: .
|
||||
image: vimagick/nfs
|
||||
ports:
|
||||
- "2049:2049"
|
||||
volumes:
|
||||
- ./data:/data
|
||||
environment:
|
||||
- EXPORT_PATH=/data
|
||||
restart: unless-stopped
|
||||
|
22
nfs/docker-compose.yml.old
Normal file
22
nfs/docker-compose.yml.old
Normal file
@ -0,0 +1,22 @@
|
||||
nfs:
|
||||
image: erichough/nfs-server
|
||||
ports:
|
||||
- "111:111/tcp"
|
||||
- "111:111/udp"
|
||||
- "2049:2049/tcp"
|
||||
- "2049:2049/udp"
|
||||
- "32765:32765/tcp"
|
||||
- "32765:32765/udp"
|
||||
- "32767:32767/tcp"
|
||||
- "32767:32767/udp"
|
||||
volumes:
|
||||
- ./data/splash:/export/splash:ro
|
||||
- /lib/modules:/lib/modules:ro
|
||||
environment:
|
||||
- NFS_LOG_LEVEL=DEBUG
|
||||
- NFS_EXPORT_0=/export/splash/filters *(ro,no_subtree_check)
|
||||
- NFS_EXPORT_1=/export/splash/js-profiles *(ro,no_subtree_check)
|
||||
- NFS_EXPORT_2=/export/splash/lua_modules *(ro,no_subtree_check)
|
||||
- NFS_EXPORT_3=/export/splash/proxy-profiles *(ro,no_subtree_check)
|
||||
privileged: true
|
||||
restart: unless-stopped
|
96
nfs/docker-entrypoint.sh
Executable file
96
nfs/docker-entrypoint.sh
Executable file
@ -0,0 +1,96 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# environment variables
|
||||
|
||||
: ${EXPORT_PATH:="/data"}
|
||||
: ${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
|
||||
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}
|
Loading…
Reference in New Issue
Block a user