StorageOS and Docker - Getting Started

Introduction

StorageOS

Documenting the scripts used to get up and running with StorageOS. Quotes will be added for a-ha moments.

00: Setup

$ curl -sS https://docs.storageos.com/assets/Vagrantfile -o Vagrantfile
$ vagrant up
$ vagrant ssh storageos-1;

If you’ve followed the steps within Setup, skip to 02: Provisioning Storage.

01: Install StorageOS with Docker

Storage can be spread across a cluster of Docker nodes.

Setup each Node of the Cluster

$ sudo modprobe nbd nbds_max=1024
$ sudo mkdir -p /var/lib/storageos
$ sudo curl -o /etc/docker/plugins/storageos.json --create-dirs https://docs.storageos.com/assets/storageos.json
$ curl -sSL https://github.com/storageos/go-cli/releases/download/0.0.13/storageos_linux_amd64 > /usr/local/bin/storageos
$ chmod +x /usr/local/bin/storageos
$ export STORAGEOS_USERNAME=storageos STORAGEOS_PASSWORD=storageos STORAGEOS_HOST=localhost

Setup the Cluster

StorageOS nodes need to know the exact cluster size and peers to connect to during start up. This enables nodes to contact each other over the network.

CLUSTER_ID=$(storageos cluster create --size 3)

Install containers

$ docker -H {{host}}:{{port}} run -d --name storageos -e HOSTNAME=<<host>> -e ADVERTISE_IP={{ipAddress}} -e CLUSTER_ID=$CLUSTER_ID --net=host --pid=host --privileged --cap-add SYS_ADMIN --device /dev/fuse -v /var/lib/storageos:/var/lib/storageos:rshared -v /run/docker/plugins:/run/docker/plugins storageos/node:0.8.1 server

Check Cluster Health

$ storageos cluster health
$ docker logs storageos

02. Provisioning Storage

This is when I started to understand what StorageOS can offer.

$ storageos node ls --format "table {{.Name}}\t{{.Address}}\t{{.Capacity}}\t{{.CapacityUsed}}
$ storageos pool ls --format "table {{.Name}}\t{{.Nodes}}\t{{.Total}}\t{{.CapacityUsed}}"
$ storageos pool inspect default
$ storageos volume create myvol
$ storageos volume ls --format "table {{.Name}}\t{{.Size}}\t{{.Location}}"

References

StorageOS Docker Guide