Skip to content

Commit

Permalink
Merge branch 'master' into ec2tags
Browse files Browse the repository at this point in the history
  • Loading branch information
echupriyanov committed Mar 7, 2016
2 parents 3ab1df9 + 651846c commit 1b32a27
Show file tree
Hide file tree
Showing 9 changed files with 155 additions and 30 deletions.
9 changes: 7 additions & 2 deletions .docs/about/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ You can determine your currently installed version using `rexray version`:
Commit: 36ccc425faeab49d792eda4851e3d72a85744874
Formed: Tue, 27 Oct 2015 12:54:19 CDT

## Version 0.3.2 (TBA)
## Version 0.3.2 (2016-03-04)

### New Features
* Support for Docker 1.10 and Volume Plugin Interface 1.2 ([#273](https://github.com/emccode/rexray/issues/273))
Expand All @@ -30,19 +30,24 @@ You can determine your currently installed version using `rexray version`:
* ScaleIO Dynamic Storage Pool Support ([#267](https://github.com/emccode/rexray/issues/267))

### Enhancements
* Improved installation documentation ([#331](https://github.com/emccode/rexray/issues/331))
* ScaleIO volume name limitation ([#304](https://github.com/emccode/rexray/issues/304))
* Docker cache volumes for path operations ([#306](https://github.com/emccode/rexray/issues/306))
* Config file validation ([#312](https://github.com/emccode/rexray/pull/312))
* Better logging ([#296](https://github.com/emccode/rexray/pull/296))
* Documentation Updates ([#285](https://github.com/emccode/rexray/issues/285))

### Bug Fixes
* Fixes issue with daemon process getting cleaned as part of SystemD Cgroup ([#327](https://github.com/emccode/rexray/issues/327))
* Fixes regression in 0.3.2 RC3/RC4 resulting in no log file ([#319](https://github.com/emccode/rexray/issues/319))
* Fixes no volumes returned on empty list ([#322](https://github.com/emccode/rexray/issues/322))
* Fixes "Unsupported FS" when mounting/unmounting with EC2 ([#321](https://github.com/emccode/rexray/issues/321))
* ScaleIO re-authentication issue ([#303](https://github.com/emccode/rexray/issues/303))
* Docker XtremIO create volume issue ([#307](https://github.com/emccode/rexray/issues/307))
* Service status is reported correctly ([#310](https://github.com/emccode/rexray/pull/310))

### Updates
* Go 1.6 ([#308](https://github.com/emccode/rexray/pull/308))
* <del>Go 1.6 ([#308](https://github.com/emccode/rexray/pull/308))</del>

### Thank You
* Dan Forrest
Expand Down
60 changes: 46 additions & 14 deletions .docs/user-guide/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,66 @@ Getting the bits, bit by bit
---

## Overview
There are several different methods available for installing `REX-Ray`.
There are several different methods available for installing `REX-Ray`. It
is written in Go, so there are typically no dependencies that must be installed
alongside its single binary file. The manual methods can be extremely simple
through tools like `curl`. You also have the opportunity to perform install
steps individually. Following the manual installs, [configuration](/user-guide/config/)
must take place.

We also provide some great automation examples using tools like `Ansible` and
`Puppet`. These approaches will perform the whole process including configuring
the REX-Ray for you.

## Manual Installs
Manual installations are in contrast to batch, automated installations.

Make sure that before installing REX-Ray that you have uninstalled any previous
versions. A `rexray uninstall` can assist with this where appropriate.

Following an installation and configuration, you can use REX-Ray interactively
through commands like `rexray volume`. Noticeably different from this is having
REX-Ray integrate with Container Engines such as Docker. This requires that
you run `rexray start` or relevant service start command like
`systemctl start rexray`.


### Install via curl
The following command will download the most recent, stable build of `REX-Ray`
and install it to `/usr/bin/rexray.` On Linux systems `REX-Ray` will also be
registered as either a SystemD or SystemV service.
and install it to `/usr/bin/rexray` or `/opt/bin/rexray`. On Linux systems
`REX-Ray` will also be registered as either a SystemD or SystemV service.

There is an optional flag to choose which version to install. Notice how we
specify `stable`, see the additional version names below that are also valid.

```shell
curl -sSL https://dl.bintray.com/emccode/rexray/install | sh -
curl -sSL https://dl.bintray.com/emccode/rexray/install | sh -s stable
```

### Install a pre-built binary
There are also pre-built binaries available for the various release types.
There are a handful of necessary manual steps to properly install REX-Ray
from pre-built binaries.

1. Download the proper binary. There are also pre-built binaries available for
the various release types.

Version | Description
---------|------------
[Unstable](https://dl.bintray.com/emccode/rexray/unstable/latest/) | The most up-to-date, bleeding-edge, and often unstable REX-Ray binaries.
[Staged](https://dl.bintray.com/emccode/rexray/staged/latest/) | The most up-to-date, release candidate REX-Ray binaries.
[Stable](https://dl.bintray.com/emccode/rexray/stable/latest/) | The most up-to-date, stable REX-Ray binaries.

Version | Description
---------|------------
[Unstable](https://dl.bintray.com/emccode/rexray/unstable/latest/) | The most up-to-date, bleeding-edge, and often unstable REX-Ray binaries.
[Staged](https://dl.bintray.com/emccode/rexray/staged/latest/) | The most up-to-date, release candidate REX-Ray binaries.
[Stable](https://dl.bintray.com/emccode/rexray/stable/latest/) | The most up-to-date, stable REX-Ray binaries.
2. Uncompress and move the binary to the proper location. Preferably `/usr/bin`
should be where REX-Ray is moved, but this path is not required.
3. Install as a service with `rexray install`. This will register itself
with SystemD or SystemV for proper initialization.

### Build and install from source
`REX-Ray` is also fairly simple to build from source, especially if you have `Docker` installed:
`REX-Ray` is also fairly simple to build from source, especially if you have
`Docker` installed:

```shell
SRC=$(mktemp -d 2> /dev/null || mktemp -d -t rexray 2> /dev/null) && cd $SRC && docker run --rm -it -v $SRC:/usr/src/rexray -w /usr/src/rexray golang:1.5.1 bash -c "git clone https://github.com/emccode/rexray.git . && make build-all”
SRC=$(mktemp -d 2> /dev/null || mktemp -d -t rexray 2> /dev/null) && cd $SRC && docker run --rm -it -e GO15VENDOREXPERIMENT=1 -v $SRC:/usr/src/rexray -w /usr/src/rexray golang:1.5.1 bash -c "git clone https://github.com/emccode/rexray.git -b master . && make build-all”
```
If you'd prefer to not use `Docker` to build `REX-Ray` then all you need is Go 1.5:
Expand Down Expand Up @@ -75,15 +107,15 @@ all the necessary variables to properly fill out your `config.yml` file.
Install the role from Galaxy:
```shell
ansible-galaxy install codenrhoden.rexray
ansible-galaxy install emccode.rexray
```
Example playbook for installing REX-Ray on GCE Docker hosts:
```yaml
- hosts: gce_docker_hosts
roles:
- { role: codenrhoden.rexray,
- { role: emccode.rexray,
rexray_service: true,
rexray_storage_drivers: [gce],
rexray_gce_keyfile: "/opt/gce_keyfile" }
Expand Down
45 changes: 37 additions & 8 deletions .docs/user-guide/schedulers.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@ This page reviews the scheduling systems supported by `REX-Ray`.
## Docker
`REX-Ray` has a `Docker Volume Driver` which is compatible with 1.7+.

It is suggested that you are running `Docker 1.10+` with `REX-Ray` especially
if you are sharing volumes between containers.
It is suggested that you are running `Docker 1.10.2+` with `REX-Ray` especially
if you are sharing volumes between containers, or you want interactive
volume commands through `docker volume`.

### Examples
### Example Configuration
Below is an example `config.yml` that can be used. The `volume.mount.preempt`
is an optional parameter here which enables any host to take control of a
volume irrespective of whether other hosts are using the volume. If this is
set to `false` then mostly plugins ensure `safeety` first for locking the
volume.
set to `false` then plugins should ensure `safety` first by locking the
volume from to the current owner host. We also specify `docker.size` which will
create all new volumes at the specified size in GB.

```yaml
rexray:
Expand All @@ -27,26 +29,53 @@ rexray:
volume:
mount:
preempt: true
docker:
size: 1
virtualbox:
endpoint: http://yourlaptop:18083
volumePath: /Users/youruser/VirtualBox Volumes
controllerName: SATA
```

#### Extra Global Parameters
These are all valid parameters that can be configured for the service.

parameter|description
------|-----------
docker.size|Size in GB
docker.iops|IOPS
docker.volumeType|Type of Volume or Storage Pool
docker.fsType|Type of filesystem for new volumes (ext4/xfs)
docker.availabilityZone|Extensible parameter per storage driver
linux.volume.rootPath|The path within the volume to private mount (/data)
rexray.volume.mount.preempt|Forcefully take control of volumes when requested

### Starting Volume Driver

REX-Ray must be running as a service to serve requests from Docker. This can be
done by running `rexray start`. Make sure you restart REX-Ray if you make
configuration changes.

$ ./rexray start
$ sudo rexray start
Starting REX-Ray...SUCESS!

The REX-Ray daemon is now running at PID 18141. To
shutdown the daemon execute the following command:

sudo /home/ubuntu/rexray stop
sudo rexray stop

Following this you can now leverage volumes with Docker.

### Creating and Using Volumes
There are two ways to interact with volumes. You can use the `docker run`
command in combination with `--volume-driver` for new volumes, or
specify `-v volumeName` by itself for existing volumes. The `--volumes-from`
will also work when sharing existing volumes with a new container.

The `docker volume` sub-command
enables complete management to create, remove, and list existing volumes. All
volumes are returned from the underlying storage platform.

1. Run containers with volumes (1.7+)

docker run -ti --volume-driver=rexray -v test:/test busybox
Expand All @@ -55,7 +84,7 @@ Following this you can now leverage volumes with Docker.

docker volume create --driver=rexray --opt=size=5 --name=test

### Extra Options
### Extra Volume Create Options
option|description
------|-----------
size|Size in GB
Expand Down
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
go_import_path: github.com/emccode/rexray

language: go

go:
- 1.6
- 1.5.1

addons:
apt:
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.2-rc3
0.4.0
4 changes: 2 additions & 2 deletions daemon/module/docker/volumedriver/voldriver.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,14 +349,14 @@ func (m *mod) buildMux() *http.ServeMux {
var pr pluginRequest
if err := json.NewDecoder(r.Body).Decode(&pr); err != nil {
http.Error(w, fmt.Sprintf("{\"Error\":\"%s\"}", err.Error()), 500)
log.WithField("error", err).Error("/VolumeDriver.Path: error decoding json")
log.WithField("error", err).Error("/VolumeDriver.List: error decoding json")
return
}

volList, err := m.r.Volume.List()
if err != nil {
http.Error(w, fmt.Sprintf("{\"Error\":\"%s\"}", err.Error()), 500)
log.WithField("error", err.Error()).Error("/VolumeDriver.Get: error listing volumes")
log.WithField("error", err.Error()).Error("/VolumeDriver.List: error listing volumes")
log.Error(err)
return
}
Expand Down
11 changes: 9 additions & 2 deletions drivers/volume/docker/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ func (d *driver) Mount(volumeName, volumeID string, overwriteFs bool, newFsType
}

switch {
case d.volumeType() != "":
newFsType = d.volumeType()
case d.fsType() != "":
newFsType = d.fsType()
case newFsType == "":
newFsType = "ext4"
}
Expand Down Expand Up @@ -680,6 +680,8 @@ func (d *driver) get(volumeName string) ([]core.VolumeMap, error) {
}

switch {
case len(volumes) == 0 && volumeName == "":
return nil, nil
case len(volumes) == 0:
return nil, goof.New("No volumes returned")
case len(volumes) > 1 && volumeName != "":
Expand Down Expand Up @@ -861,8 +863,13 @@ func (d *driver) availabilityZone() string {
return d.r.Config.GetString("docker.availabilityZone")
}

func (d *driver) fsType() string {
return d.r.Config.GetString("docker.fsType")
}

func configRegistration() *gofig.Registration {
r := gofig.NewRegistration("Docker")
r.Key(gofig.String, "", "", "", "docker.fsType")
r.Key(gofig.String, "", "", "", "docker.volumeType")
r.Key(gofig.String, "", "", "", "docker.iops")
r.Key(gofig.String, "", "", "", "docker.size")
Expand Down
4 changes: 4 additions & 0 deletions glide.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package: github.com/emccode/rexray
import:
- package: github.com/Sirupsen/logrus
ref: feature/logrus-aware-types
repo: https://github.com/akutz/logrus
vcs: git
- package: github.com/akutz/goof
ref: master
vcs: git
Expand Down
46 changes: 46 additions & 0 deletions rexray/cli/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,17 @@ import (
"github.com/emccode/rexray/util"
)

var (
useSystemDForSCMCmds = gotil.FileExists(util.UnitFilePath) &&
getInitSystemType() == SystemD
)

func (c *CLI) start() {
if !c.fg && useSystemDForSCMCmds {
startViaSystemD()
return
}

checkOpPerms("started")

log.WithField("os.Args", os.Args).Debug("invoking service start")
Expand Down Expand Up @@ -62,6 +72,33 @@ func failOnError(err error) {
}
}

func startViaSystemD() {
execSystemDCmd("start")
statusViaSystemD()
}

func stopViaSystemD() {
execSystemDCmd("stop")
statusViaSystemD()
}

func statusViaSystemD() {
execSystemDCmd("status")
}

func execSystemDCmd(cmdType string) {
cmd := exec.Command("systemctl", cmdType, "-l", "rexray")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
if exitErr, ok := err.(*exec.ExitError); ok {
if status, ok := exitErr.Sys().(syscall.WaitStatus); ok {
panic(status.ExitStatus())
}
}
}
}

func (c *CLI) startDaemon() {

var out io.Writer = os.Stdout
Expand Down Expand Up @@ -213,6 +250,11 @@ func (c *CLI) tryToStartDaemon() {
}

func stop() {
if useSystemDForSCMCmds {
stopViaSystemD()
return
}

checkOpPerms("stopped")

if !gotil.FileExists(util.PidFilePath()) {
Expand All @@ -235,6 +277,10 @@ func stop() {
}

func (c *CLI) status() {
if useSystemDForSCMCmds {
statusViaSystemD()
return
}

pidFile := util.PidFilePath()

Expand Down

0 comments on commit 1b32a27

Please sign in to comment.