orchardup/fig — pull request #246 by d11wtq (2014-06-07 08:37:27+00:00)
Title: Add feature: `fig run --up SERVICE COMMAND [ARGS...]`

This is still a spike, so please don't merge yet (there are no tests and I don't write python very much). I'm just initiating this PR to get some feedback.

I mostly write libraries, rather than complete applications. As such, I tend to depend on one or more "services" and also have an additional "console" environment where I test drive code that integrates with those services.

Using fig for this purpose isn't much more convenient than just manually using docker, since fig requires you to `fig up -d SERVICE` for each service, before using `fig run SERVICE COMMAND` to get into a console. That's more or less the native docker approach, with the omission of the need to pass flags like `-v` and `-p` repeatedly.

I think fig can fit this use case, however, if the idea that every key in the fig.yml represents a long-running "service" can be by-passed on a case-by-case basis and if `fig run` can optionally support starting linked services.

Therefore, keeping the existing behaviour by default, I've added support for `auto_start: false` to fig.yml, so that console-only keys, intended to be used with `fig run` do not try to start on `fig up`. I've also added a `--up` flag to `fig run`, as a convenience to avoid the need to do `fig up -d` followed by the `fig run`. This basically allows you to launch into a console in a single command, with all services running and linked.

I absolutely need to add both unit and integration tests for this, but would you accept a PR like this?

Any criticism of my amateur python code would be welcomed and acted upon.