You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DOC/MINOR: document the 'before' directive in dependencies example
Update the dependencies documentation and example to demonstrate the 'before' configuration option alongside 'after'. A new 'zeroth' process was added to the example YAML and test suite to verify the correct startup sequence (zeroth -> first -> second).
This clarifies how 'before' acts as a mirror edge to 'after', which is particularly useful for inserting a service into the startup order without modifying existing process configurations. Additionally, minor updates were initiated in the restart-backoff documentation.
Copy file name to clipboardExpand all lines: documentation/dependencies/README.md
+14-7Lines changed: 14 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,11 @@
1
1
# Dependencies
2
2
3
-
`after:`controls startup ordering. A service listed in another's `after` is started first; gopherd computes the order with a topological sort.
3
+
`after:`and `before:` control startup ordering. A service listed in another's `after` is started first;`before` is the same edge written from the other side. gopherd computes the order with a topological sort.
4
4
5
5
## Config
6
6
7
7
```yaml
8
-
# Order startup with `after`: `first` runs before `second`.
8
+
# Order startup with `after` and `before`: zeroth -> first -> second.
9
9
processes:
10
10
- name: second
11
11
command: /bin/sh
@@ -16,21 +16,28 @@ processes:
16
16
command: /bin/sh
17
17
args: ["-c", "echo first >> ORDERLOG && sleep 300"]
- `second` declares `after: [first]`, so gopherd starts `first` first.
27
+
- `zeroth` declares `before: [first]` — the mirror form, useful when the
28
+
inserted service is the one being added and the existing configs should
29
+
stay untouched.
22
30
- Declaration order in the file does not matter — the dependency graph does.
23
-
- `after`orders startup only; use `requires` if a dependency failure should also fail the dependent.
31
+
- `after`/`before` order startup only; use `requires` if a dependency failure should also fail the dependent.
24
32
25
33
## Expected behavior
26
34
27
-
- `first`starts and appends `first` to the log.
28
-
- `second`starts afterward and appends `second`.
29
-
- The log reads `first` then `second`.
35
+
- `zeroth`starts first, then `first`, then `second`; the log reads
36
+
`zeroth`, `first`, `second`.
30
37
31
38
## Test
32
39
33
-
`ORDERLOG`is replaced with a temp path via `RunConfig`. The test asserts gopherd starts `first` before `second` (the daemon's `started` lines). Note `after` orders gopherd's start calls; the echoes themselves run in separate shells, so use a `ready-check` when the dependent needs the dependency's work completed.
40
+
`ORDERLOG`is replaced with a temp path via `RunConfig`. The test asserts gopherd's `started` lines appear in `zeroth`, `first`, `second` order. Note `after`/`before` order gopherd's start calls; the echoes themselves run in separate shells, so use a `ready-check` when the dependent needs the dependency's work completed.
0 commit comments