Update nfs setup script.

This commit is contained in:
2025-07-07 09:31:45 -07:00
parent 93240f6300
commit 5053fb8a50
3 changed files with 71 additions and 7 deletions

View File

@@ -1,13 +1,19 @@
# NFS Setup (Optional) # NFS Setup (Optional)
The infrastructure supports optional NFS (Network File System) for shared media storage across the cluster: The infrastructure supports optional NFS (Network File System) for shared media storage across the cluster. If your config.yaml contains the `cloud.nfs` section, the NFS server will be set up automatically.
## Host Setup ## Host Setup
First, set up the NFS server on your chosen host. First, set up the NFS server on your chosen host.
```bash ```bash
./setup-nfs-host.sh ./setup-nfs-host.sh <host> <media-path>
```
Example:
```bash
./setup-nfs-host.sh box-01 /srv/nfs
``` ```
## Cluster Integration ## Cluster Integration
@@ -18,8 +24,8 @@ Add to your `config.yaml`:
cloud: cloud:
nfs: nfs:
host: box-01 host: box-01
mediaPath: /data/media mediaPath: /srv/nfs
storageCapacity: 250Gi storageCapacity: 250Gi # Max size for PersistentVolume
``` ```
And now you can run the nfs cluster setup: And now you can run the nfs cluster setup:

View File

@@ -11,7 +11,7 @@ else
init_wild_env init_wild_env
fi fi
CLUSTER_SETUP_DIR="${WC_HOME}/setup/cluster" CLUSTER_SETUP_DIR="${WC_HOME}/setup/cluster-services"
NFS_DIR="${CLUSTER_SETUP_DIR}/nfs" NFS_DIR="${CLUSTER_SETUP_DIR}/nfs"
print_header "Registering NFS server with Kubernetes cluster" print_header "Registering NFS server with Kubernetes cluster"

View File

@@ -7,8 +7,66 @@ SCRIPT_PATH="$(realpath "${BASH_SOURCE[0]}")"
SCRIPT_DIR="$(dirname "$SCRIPT_PATH")" SCRIPT_DIR="$(dirname "$SCRIPT_PATH")"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")" PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
# Source environment variables usage() {
source "${PROJECT_DIR}/load-env.sh" echo "Usage: setup-nfs-host.sh [server] [media-path] [options]"
echo ""
echo "Set up NFS server on the specified host."
echo ""
echo "Examples:"
echo " setup-nfs-host.sh box-01 /data/media"
echo ""
echo "Options:"
echo " -h, --help Show this help message"
echo " -e, --export-options Set the NFS export options"
}
# Parse arguments
while [[ $# -gt 0 ]]; do
case $1 in
-h|--help)
usage
exit 0
;;
-e|--export-options)
if [[ -z "$2" ]]; then
echo "Error: --export-options requires a value"
exit 1
else
NFS_EXPORT_OPTIONS="$2"
fi
shift 2
;;
-*)
echo "Unknown option $1"
usage
exit 1
;;
*)
# First non-option argument is server
if [[ -z "$NFS_HOST" ]]; then
export NFS_HOST="$1"
# Second non-option argument is media path
elif [[ -z "$NFS_MEDIA_PATH" ]]; then
export NFS_MEDIA_PATH="$1"
else
echo "Too many arguments"
usage
exit 1
fi
shift
;;
esac
done
# Initialize Wild Cloud environment
if [ -z "${WC_ROOT}" ]; then
print "WC_ROOT is not set."
exit 1
else
source "${WC_ROOT}/scripts/common.sh"
init_wild_env
fi
echo "Setting up NFS server on this host..." echo "Setting up NFS server on this host..."