Skip to content

Commit

Permalink
Merge pull request #574 from sgibson91/docs/manual-nfs
Browse files Browse the repository at this point in the history
Add docs on manual setup of NFS server
  • Loading branch information
sgibson91 authored Aug 5, 2021
2 parents 89524b3 + 2b0fe35 commit 845c961
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/howto/operate/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ node-administration.md
move-hub.md
new-tf-cluster.md
setup-grafana.md
manual-nfs-setup.md
```
94 changes: 94 additions & 0 deletions docs/howto/operate/manual-nfs-setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Manually setup NFS Server for a cluster

This guide describes the manual steps required for setting up a NFS server to store users' home directories on the hub.
More information about the NFS Server can be found in {ref}`/topic/storage-layer`.

## Deploy the host Virtual Machine

We need to first deploy a small virtual machine with a persistent disk that will host the NFS server.
You can use `gcloud` commands to achieve this.

````{note}
To find the values of `--image` and `--image-project`, run the following:
```bash
gcloud compute images list
```
Add `| grep ubuntu` to filter for Ubuntu images.
You can then check the image suits your needs by running:
```bash
gcloud computer images describe IMAGE_NAME --project=IMAGE_PROJECT
```
````

```bash
gcloud compute instances create nfs-server-01 \
--image=ubuntu-2004-focal-v20210720 \
--image-project=ubuntu-os-cloud \
--machine-type=g1-small \
--boot-disk-device-name=nfs-server-01 \
--boot-disk-size=100GB \
--boot-disk-type=pd-standard
```

````{note}
The boot disk is where users' home directories and data are stored.
Feel free to increase `--boot-disk-size` if 100GB won't be enough.
````

```{note}
If deploying a NFS server for a **private** cluster, add the `--no-address` flag to the `gcloud compute instances create` command.
This will prevent the VM trying to claim an external IP address, which will not be allowed within the private configuration.
```

## Setting up the NFS Server

Once your VM has been deployed, SSH into it so we can configure the NFS server.

```bash
gcloud compute ssh nfs-server-01
```

```{note}
If the cluster you are setting up the NFS for is **private**, you will need to add the `--tunnel-through-iap` flag to the above command.
This is because the VM will not have an external IP address and will therefore need to be routed differently.
```

1. Install the dependencies

```bash
sudo apt update
sudo apt install nfs-kernel-server nfs-common
```

2. Create the appropriate directory

```bash
sudo mkdir -p /export/home-01
```

3. Set the appropriate permissions on the directory

```bash
sudo chmod -R 0700 /export/
sudo chown -R 1000:1000 /export/
```

4. Create the exports rule in the file `/etc/exports`

```bash
sudo nano /etc/exports # Create the file
```

```bash
/export/home-01 10.0.0.0/8(all_squash,anonuid=1000,anongid=1000,no_subtree_check,rw,sync) # Add this line to the bottom of the file
```

5. Run the export command

```bash
sudo exportfs -ra
```

0 comments on commit 845c961

Please sign in to comment.