Skip to content

Setting up shared NFS volume with Convoy

Aad Versteden edited this page May 31, 2017 · 2 revisions

To install Convoy with NFS you need first to create a NFS shared directory on one machine. Then mount the NFS shared directory on every node. Then you will need to install the Docker plugin on every node too.

Create the NFS shared directory

In /etc/exports, add a path you want to export:

/tmp/nfs_shared *(rw,sync,nohide,no_root_squash,fsid=0)

Then start your NFS server.

Mount the NFS shared directory

mount -t nfs -o nolock <ADDRESS_TO_THE_NFS_SERVER>:/tmp/nfs_shared /tmp/nfs_shared

Install the Convoy Plugin

As root:

curl -sSL https://github.com/rancher/convoy/releases/download/v0.5.0/convoy.tar.gz | tar xz --strip-components=1 -C /usr/local/bin convoy/convoy
mkdir -p /etc/docker/plugins
echo "unix:///var/run/convoy/convoy.sock" > /etc/docker/plugins/convoy.spec

Run the Convoy Demon

convoy daemon --drivers vfs --driver-opts vfs.path=/tmp/nfs_shared

Demo with Docker Machine

Installation:

# cat - > /etc/exports
/tmp/nfs_shared *(rw,sync,nohide,no_root_squash,fsid=0)
^D
# systemctl start nfs-server
# docker-machine create -d virtualbox mh-keystore
# eval "$(docker-machine env mh-keystore)"
# docker run -d \
  -p "8500:8500" \
  -h "consul" \
  progrium/consul -server -bootstrap
# docker-machine create \
  -d virtualbox \
  --swarm --swarm-master \
  --swarm-discovery="consul://"$(docker-machine ip mh-keystore)":8500" \
  --engine-opt="cluster-store=consul://"$(docker-machine ip mh-keystore)":8500" \
  --engine-opt="cluster-advertise=eth1:2376" \
  mhs-demo0
# cat - | docker-machine ssh mhs-demo0
mkdir -p /tmp/nfs_shared
mount -t nfs -o nolock 192.168.99.1:/tmp/nfs_shared /tmp/nfs_shared
curl -sSL https://github.com/rancher/convoy/releases/download/v0.5.0/convoy.tar.gz | tar xz --strip-components=1 -C /usr/local/bin convoy/convoy
mkdir -p /etc/docker/plugins
echo "unix:///var/run/convoy/convoy.sock" > /etc/docker/plugins/convoy.spec
nohup convoy daemon --drivers vfs --driver-opts vfs.path=/tmp/nfs_shared &
^D
# docker-machine create -d virtualbox \
  --swarm \
  --swarm-discovery="consul://"$(docker-machine ip mh-keystore)":8500" \
  --engine-opt="cluster-store=consul://"$(docker-machine ip mh-keystore)":8500" \
  --engine-opt="cluster-advertise=eth1:2376" \
  mhs-demo1
# cat - | docker-machine ssh mhs-demo1
mkdir -p /tmp/nfs_shared
mount -t nfs -o nolock 192.168.99.1:/tmp/nfs_shared /tmp/nfs_shared
curl -sSL https://github.com/rancher/convoy/releases/download/v0.5.0/convoy.tar.gz | tar xz --strip-components=1 -C /usr/local/bin convoy/convoy
mkdir -p /etc/docker/plugins
echo "unix:///var/run/convoy/convoy.sock" > /etc/docker/plugins/convoy.spec
nohup convoy daemon --drivers vfs --driver-opts vfs.path=/tmp/nfs_shared &
^D

Running a container on the first node:

# eval $(docker-machine env --swarm mhs-demo0)
# docker run -it -v test:/test -e constraint:node==mhs-demo0 --name c1 busybox

Running a container on the second node:

# eval $(docker-machine env --swarm mhs-demo0)
# docker run -it -v test:/test -e constraint:node==mhs-demo1 --name c2 busybox
Clone this wiki locally