Project

General

Profile

Feature #245

Using NFS To Centralize Web Site Files For Distributed Web Node Workers

Added by Daniel Curtis over 10 years ago. Updated about 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Network Attached Storage
Target version:
-
Start date:
11/26/2013
Due date:
% Done:

100%

Estimated time:
4.00 h
Spent time:

Description

Now that I have multiple web servers, serving copies of the same content by synchronizing between a primary node to the rest of the worker nodes, I need to have a central point for the worker nodes to draw from. This will allow future nodes to be added more easily, at the cost of a little more administration. Currently the web nodes get user information and authentication from a LDAP/Kerberos server, so user information and passwords need to be managed at that server; and now web user files will be offloaded to the NAS. This means that SSH users for each web user must be added to the NAS to allow user file transfers. I also had to enable no_root_squash covered in Issue #243

Add SSH user to FreeNAS

From the web GUI, go to Account -> User -> Add User and add the web user information, making sure to add the proper home path relative to the location on the FreeNAS box.

Backup web site files

Once I had the NAS configured, I copied the original /var/www files to /var/www.orig and then removed the contents of /var/www:

sudo su
mv /var/www /var/www.orig
cd /var/www
rm -rf .

Mount NFS share

After backing up and clearing /var/www, it is time to mount the NFS share. I did this by making a folder to mount the share to and then adding this line to /etc/fstab:

192.168.1.100:/mnt/storage/var/www /mnt/nfs/var/www nfs defaults,auto,rw 0 0

Then mounting the share:
mount /mnt/nfs/var/www
  • Note: I don't actually have the NFS share mounted on the LXC container, but rather the LXC host then remounted to the container in the containers configuration. This is to allow a direct gigabit connection from the LXC host to the NAS, instead of the LXC container traffic being sent through the router then to the NAS (choke point).

Also available in: Atom PDF