Skip to content

Commit

Permalink
Merge pull request #46 from phase2/develop
Browse files Browse the repository at this point in the history
Version 1.3.0
  • Loading branch information
febbraro authored Jun 6, 2017
2 parents d89b894 + e3578ff commit a55d874
Show file tree
Hide file tree
Showing 34 changed files with 1,065 additions and 235 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
dist
build
vendor
.idea
.idea
.outrigger.yml
25 changes: 25 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
sudo: false

os: linux

language: go
go:
- 1.7
- tip

matrix:
fast_finish: true
allow_failures:
- go: tip

env:
- GO15VENDOREXPERIMENT="0"

before_install: cd cli

script:
- "../scripts/test-go-fmt.sh"

notifications:
flowdock:
secure: "R+oCTutMLINYW1LZpZK14JjkU0Tt2UTc47q+MXKRruDwCp3ntx4RL9GtSp9cg0EHIXPvQ8yesBKIgpZjw3eelAORXzG8FTgvjPH0mu3m1lU20cE3XKHE4+kH0hNLpXQ2V20vj4XnMGmCPizG2GXDBl/LZcAUPoAZy6j+++cTvQRcIkGede9aUCsI5hBRLwdKVqD2lGC+Qr32VZNAcHsNaVHkhR6WustetRIMx3vQSlZWvd8SOaGvWkaBw8nBpPlfnG4bl28kWH9aoJyILyAuNZtz42C5JDCkcq0XjvUOWtXwwGEutKJX5OF77l5lccpRVDYoW+L1xXMrBaYje1+gs0lEUrrJj14yIVLw6gOlumYsmKWNdKob2lDCAL9w3IeQ4VfrAWXYY6M6WTIA6/3SANokgrXwtsV4/rYbtiNsyZA5QB1w32XH+GSjTYRTbMboIoB6kvABN7Y/saX/ShdZn4UgShTkYxckQNytsgvZWAZVdR0QpGzm7CLT2fLNLcb6Z1WdcNJAmSMlR417BwCG8aHUEeCDAGhn1p0mYcE+UiBizYOa9o0HkfcznXyl0YZhybtWj/ZFlX8TTS5fKhYYkTqcGdEYMBFxGAH7mL0Pu2D1j9oclXWeYIEXGpOFRhs0d7X6e5GA9O7rW/mDiirff3FI+4ts6aq1xY+z6hkTayY="
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 1.3.0

- `Commands()` function now returns an array of cli.Command structs instead of a single struct
- Added support for `project` based commands
- Added support for `.outrigger.yml` file in project folders to support custom configuration and scripts
- Added `project run:[script]` command to run commands defined in project config files
- Added `project sync:start` and `project sync:stop` to support Unison based sync volumes for faster in container builds
- Added `project create` that will run a generator image to create default project scaffolding and configuration

## 1.2.3

- Updated mDNSResponder restart to avoid System Integrity Protections
Expand Down
19 changes: 8 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Rig - Outrigger CLI
# Rig - Outrigger CLI [![Build Status](https://travis-ci.org/phase2/rig.svg?branch=develop)](https://travis-ci.org/phase2/rig)

> A CLI for managing the Outrigger container-driven development stack.
Expand All @@ -15,15 +15,14 @@ Install go from homebrew using the flag to include common cross-compiler targets
brew install go --with-cc-common
```

Setup GOPATH and PATH in your favorite shell (`~/.bashrc` or `~/.zshrc`)
This assumes you use `~/Projects` for your code, adjust accordingly.
Setup `$GOPATH` and `$PATH` in your favorite shell (`~/.bashrc` or `~/.zshrc`)

```bash
export GOPATH=$HOME/Projects
export PATH=$PATH:$GOPATH/bin
```

Checkout the code into your $GOPATH, likely in `$GOPATH/src/github.com/phase2/rig`
Checkout the code into your `$GOPATH` in `$GOPATH/src/github.com/phase2/rig`

Get all the dependencies

Expand All @@ -35,7 +34,7 @@ go get github.com/tools/godep
go get github.com/mitchellh/gox

# Install the project dependencies into $GOPATH
cd $GOPATH/src/github.com/phase2/rig
cd $GOPATH/src/github.com/phase2/rig/cli
godep restore
```

Expand All @@ -50,6 +49,8 @@ We make use of a few key libraries to do all the fancy stuff that the `rig` CLI
* All the fancy terminal color output
* https://github.com/bitly/go-simplejson
* The JSON parse and access library used primarily with the output of `docker-machine inspect`
* https://gopkg.in/yaml.v2
* The YAML library for parsing/reading YAML files

Build
-----
Expand All @@ -62,16 +63,12 @@ For development, sometimes you will just want to build for your target platform
do that, simply run the following command.

```bash
gox -cgo -osarch="Darwin/amd64" -output="build/{{.OS}}/rig"
gox -osarch="Darwin/amd64" -output="build/{{.OS}}/rig"
```

This command targets an OS/Architecture (Darwin/Mac and 64bit) and puts the resultant file in the `bin/`
directory for the appropriate OS with the name `rig`.

NOTE: the `-cgo` in the above command is only relevant for building on OSX as this will allow the go binary
to use the OSX DNS Resolver instead of the built in Go resolver. This is needed in order to resolve DNS names
that end in things like *.vm* Using `-cgo` for Linux and Windows architectures will result in a failed build.

Developing Rig with Docker [Experimental]
-----------------------------------------

Expand All @@ -83,7 +80,7 @@ docker-compose run --rm install
docker-compose run --rm build
```

This will produce a working OSX binary with partially limited functionality at `build/darwin/rig`.
This will produce a working OSX binary at `build/darwin/rig`.

Deploy to Homebrew
------------------
Expand Down
2 changes: 2 additions & 0 deletions brew-publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ class Rig < Formula
depends_on "docker-machine"
depends_on "docker-compose"
depends_on "docker-machine-nfs"
depends_on "unison"
depends_on "eugenmayer/dockersync/unox"
def install
bin.install "rig"
Expand Down
9 changes: 5 additions & 4 deletions cli/Godeps/Godeps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cli/commands/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

type RigCommand interface {
Commands() cli.Command
Commands() []cli.Command
}

type BaseCommand struct {
Expand Down
14 changes: 8 additions & 6 deletions cli/commands/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ type Config struct {
BaseCommand
}

func (cmd *Config) Commands() cli.Command {
return cli.Command{
Name: "config",
Usage: "Echo the config to setup the Rig environment. Run: eval \"$(rig config)\"",
Before: cmd.Before,
Action: cmd.Run,
func (cmd *Config) Commands() []cli.Command {
return []cli.Command{
{
Name: "config",
Usage: "Echo the config to setup the Rig environment. Run: eval \"$(rig config)\"",
Before: cmd.Before,
Action: cmd.Run,
},
}
}

Expand Down
14 changes: 8 additions & 6 deletions cli/commands/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ type Dashboard struct {
BaseCommand
}

func (cmd *Dashboard) Commands() cli.Command {
return cli.Command{
Name: "dashboard",
Usage: "Start Dashboard services on the docker-machine",
Before: cmd.Before,
Action: cmd.Run,
func (cmd *Dashboard) Commands() []cli.Command {
return []cli.Command{
{
Name: "dashboard",
Usage: "Start Dashboard services on the docker-machine",
Before: cmd.Before,
Action: cmd.Run,
},
}
}

Expand Down
34 changes: 18 additions & 16 deletions cli/commands/data_backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,26 @@ type DataBackup struct {
BaseCommand
}

func (cmd *DataBackup) Commands() cli.Command {
return cli.Command{
Name: "data-backup",
Usage: "Backup the contents of the /data volume of a docker machine",
Flags: []cli.Flag{
cli.StringFlag{
Name: "data-dir",
Value: "/mnt/sda1/data",
Usage: "Specify the directory on the Docker Machine to backup. Defaults to the entire /data volume.",
},
cli.StringFlag{
Name: "backup-dir",
Value: fmt.Sprintf("%s%c%s", os.Getenv("HOME"), os.PathSeparator, "rig-backups"),
Usage: "Specify the local directory to store the backup zip.",
func (cmd *DataBackup) Commands() []cli.Command {
return []cli.Command{
{
Name: "data-backup",
Usage: "Backup the contents of the /data volume of a docker machine",
Flags: []cli.Flag{
cli.StringFlag{
Name: "data-dir",
Value: "/mnt/sda1/data",
Usage: "Specify the directory on the Docker Machine to backup. Defaults to the entire /data volume.",
},
cli.StringFlag{
Name: "backup-dir",
Value: fmt.Sprintf("%s%c%s", os.Getenv("HOME"), os.PathSeparator, "rig-backups"),
Usage: "Specify the local directory to store the backup zip.",
},
},
Before: cmd.Before,
Action: cmd.Run,
},
Before: cmd.Before,
Action: cmd.Run,
}
}

Expand Down
32 changes: 17 additions & 15 deletions cli/commands/data_restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,25 @@ type DataRestore struct {
BaseCommand
}

func (cmd *DataRestore) Commands() cli.Command {
return cli.Command{
Name: "data-restore",
Usage: "Restore a local backup to the /data volume of a docker machine",
Flags: []cli.Flag{
cli.StringFlag{
Name: "backup-file",
Usage: "Specify the local archive to restore to the VM. Defaults to a file named $HOME/rig-backups/<machinename>.tgz",
},
cli.StringFlag{
Name: "data-dir",
Value: "/mnt/sda1/data",
Usage: "Specify the restore dir on the VM. Defaults to the entire /data volume.",
func (cmd *DataRestore) Commands() []cli.Command {
return []cli.Command{
{
Name: "data-restore",
Usage: "Restore a local backup to the /data volume of a docker machine",
Flags: []cli.Flag{
cli.StringFlag{
Name: "backup-file",
Usage: "Specify the local archive to restore to the VM. Defaults to a file named $HOME/rig-backups/<machinename>.tgz",
},
cli.StringFlag{
Name: "data-dir",
Value: "/mnt/sda1/data",
Usage: "Specify the restore dir on the VM. Defaults to the entire /data volume.",
},
},
Before: cmd.Before,
Action: cmd.Run,
},
Before: cmd.Before,
Action: cmd.Run,
}
}

Expand Down
14 changes: 8 additions & 6 deletions cli/commands/dns-records.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ type DnsRecords struct {
BaseCommand
}

func (cmd *DnsRecords) Commands() cli.Command {
return cli.Command{
Name: "dns-records",
Usage: "List all DNS records for running containers",
Before: cmd.Before,
Action: cmd.Run,
func (cmd *DnsRecords) Commands() []cli.Command {
return []cli.Command{
{
Name: "dns-records",
Usage: "List all DNS records for running containers",
Before: cmd.Before,
Action: cmd.Run,
},
}
}

Expand Down
26 changes: 14 additions & 12 deletions cli/commands/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,22 @@ type Dns struct {
BaseCommand
}

func (cmd *Dns) Commands() cli.Command {
return cli.Command{
Name: "dns",
Usage: "Start DNS services on the docker-machine",
Flags: []cli.Flag{
cli.StringFlag{
Name: "nameservers",
Value: "8.8.8.8:53",
Usage: "Comma separated list of fallback names servers.",
EnvVar: "RIG_NAMESERVERS",
func (cmd *Dns) Commands() []cli.Command {
return []cli.Command{
{
Name: "dns",
Usage: "Start DNS services on the docker-machine",
Flags: []cli.Flag{
cli.StringFlag{
Name: "nameservers",
Value: "8.8.8.8:53",
Usage: "Comma separated list of fallback names servers.",
EnvVar: "RIG_NAMESERVERS",
},
},
Before: cmd.Before,
Action: cmd.Run,
},
Before: cmd.Before,
Action: cmd.Run,
}
}

Expand Down
14 changes: 8 additions & 6 deletions cli/commands/doctor.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ type Doctor struct {
BaseCommand
}

func (cmd *Doctor) Commands() cli.Command {
return cli.Command{
Name: "doctor",
Usage: "Troubleshoot the Rig environment",
Before: cmd.Before,
Action: cmd.Run,
func (cmd *Doctor) Commands() []cli.Command {
return []cli.Command{
{
Name: "doctor",
Usage: "Troubleshoot the Rig environment",
Before: cmd.Before,
Action: cmd.Run,
},
}
}

Expand Down
14 changes: 8 additions & 6 deletions cli/commands/kill.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ type Kill struct {
BaseCommand
}

func (cmd *Kill) Commands() cli.Command {
return cli.Command{
Name: "kill",
Usage: "Kill the docker-machine",
Before: cmd.Before,
Action: cmd.Run,
func (cmd *Kill) Commands() []cli.Command {
return []cli.Command{
{
Name: "kill",
Usage: "Kill the docker-machine",
Before: cmd.Before,
Action: cmd.Run,
},
}
}

Expand Down
Loading

0 comments on commit a55d874

Please sign in to comment.