chain commands, and let a project refine a catalogue stack
myos build up logs host/fabio runs the three in order and stops at the first failure, the way make build up logs STACK=host/fabio did. Leading words that name commands are commands; the first word that is not one starts the stacks. A stack found in several directories of the stack path is now merged rather than shadowed, least specific first, so a project drops stack/postgres/postgres.local.yml next to the catalogue's postgres.yml and refines it. Settings hooks follow the same order, so a project can redefine a default the catalogue ships. Neither engine did this before: the project directory simply hid the catalogue one. An unknown command now says so and suggests the command to type, instead of printing the whole usage.
This commit is contained in:
+10
-3
@@ -48,6 +48,9 @@ myos down <stack> # remove the containers
|
||||
|
||||
A reference is `[<group>/]<name>[:<version>]`, or a path.
|
||||
|
||||
Commands chain: `myos build up logs host/fabio` runs the three in order and
|
||||
stops at the first failure.
|
||||
|
||||
```sh
|
||||
myos up # the current directory, when it holds a compose file
|
||||
myos up host # a group: expands to host/consul host/fabio ...
|
||||
@@ -57,9 +60,13 @@ myos -C /opt/app up # somewhere else
|
||||
myos -e master up # in another environment
|
||||
```
|
||||
|
||||
Stacks are looked up along the stack path, project first:
|
||||
`./stack`, `../stack`, `~/.local/share/myos/stack`, `/usr/local/share/myos/stack`,
|
||||
`/usr/share/myos/stack`. `myos doctor` prints the resolved path.
|
||||
Stacks are looked up along the stack path: `./stack`, `../stack`,
|
||||
`~/.local/share/myos/stack`, `/usr/local/share/myos/stack`, `/usr/share/myos/stack`.
|
||||
`myos doctor` prints the resolved path.
|
||||
|
||||
A stack found in several of them is **merged**, the project last, so a project
|
||||
adds `stack/postgres/postgres.local.yml` next to the catalogue's `postgres.yml`
|
||||
and refines it instead of replacing it. The same goes for the settings hooks.
|
||||
|
||||
## Three kinds of stack
|
||||
|
||||
|
||||
@@ -30,6 +30,20 @@ myos [options] <command> [stack...] [VAR=value...] [-- args...]
|
||||
| `doctor` | check the installation |
|
||||
| `version` | the myos version |
|
||||
|
||||
## Several commands at once
|
||||
|
||||
Commands chain, the way make targets did. Leading words that name commands are
|
||||
commands; the first word that is not one starts the list of stacks.
|
||||
|
||||
```sh
|
||||
myos build up logs host/fabio # like: make build up logs STACK=host/fabio
|
||||
myos up ps host
|
||||
```
|
||||
|
||||
They run in order and stop at the first failure. A stack whose name is also a
|
||||
command name has to be given as `STACK=<name>`, otherwise it is read as a
|
||||
command.
|
||||
|
||||
Anything after `--` goes to docker compose:
|
||||
|
||||
```sh
|
||||
@@ -65,7 +79,8 @@ does not: a typo is an error.
|
||||
|---|---|
|
||||
| `make up STACK=host` | `myos up host` |
|
||||
| `make print-COMPOSE_FILE` | `myos env COMPOSE_FILE` |
|
||||
| `make host` | `myos up host` |
|
||||
| `make host` | `myos up host` (a bare stack name is not a command) |
|
||||
| `make build up logs STACK=host/fabio` | `myos build up logs host/fabio` |
|
||||
| `make stack-host-config` | `myos config host` |
|
||||
| `make up@master` | `myos -e master up` |
|
||||
| `make exec SERVICE=php ARGS='ls'` | `myos exec <stack> -- php ls` |
|
||||
|
||||
@@ -99,6 +99,20 @@ parsed, never sourced, so a value may contain a `#` or a `$(...)` without
|
||||
breaking anything or being executed. The make engine included `.env` as a
|
||||
makefile, where both broke.
|
||||
|
||||
## Where a stack lives
|
||||
|
||||
The same stack may exist in several directories of the stack path. They are all
|
||||
loaded, least specific first, so the project has the last word:
|
||||
|
||||
```
|
||||
/usr/local/share/myos/stack/postgres/postgres.yml the catalogue
|
||||
./stack/postgres/postgres.local.yml the project refines it
|
||||
./stack/postgres/postgres.sh and may redefine a default
|
||||
```
|
||||
|
||||
Nothing has to be copied to change one setting: a value in the project `.env`
|
||||
already wins over any default a stack ships.
|
||||
|
||||
## Per-stack settings
|
||||
|
||||
A stack keeps its own settings next to its compose files:
|
||||
|
||||
Reference in New Issue
Block a user