Skip to content

Commit 8957d87

Browse files
committed
Update readme with new commands
1 parent 7afc778 commit 8957d87

File tree

3 files changed

+97
-24
lines changed

3 files changed

+97
-24
lines changed

.config/README.md.template

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Runbook
2+
3+
## Summary
4+
5+
Runbook is a commandline tool that guides users in an opinionated approach to creating dynamic runbooks.
6+
7+
In this context, a runbook is a mixture of markdown and executable code that contains the steps needed for successful operational executions such as server maintenance, database management, or creating a weekly report.
8+
9+
### When would you use this?
10+
1. When you want quick to write tools that can't be entirely automated, but want the safey of auditable tools.
11+
2. When your tooling needs to adjust rapidly and contain prepared rollback procedures.
12+
3. When this is a semi-custom situation that doesn't warrant building dedicated and expensive tooling
13+
4. When you've grown out of shell scripts but aren't ready to build it in Golang or Rust
14+
15+
### Runbook Best Practices
16+
1. Include a Summary/Purpose, Step descriptions, Warning signs, Verification Steps and Execution Steps in their natural order
17+
2. Non-mutative actions can be included anyhere
18+
3. Mutative actions (destroy a server or force a failover) must use the `confirm` flag
19+
4. Write pre-check steps before mutation steps in order to increase safety of the procedure
20+
5. Runbooks for critical operations should be run by pairs of staff members
21+
1. One to execute the book
22+
2. A second to validate and perform safety checks
23+
24+
## CLI
25+
26+
```sh
27+
$RUNBOOK_HELP
28+
```
29+
30+
Shell completion is included via click library and enabled as follows [link](https://click.palletsprojects.com/en/8.1.x/shell-completion/#enabling-completion)
31+
32+
```
33+
# Bash
34+
# Add this to ~/.bashrc:
35+
eval "$(_RUNBOOK_COMPLETE=bash_source runbook)"
36+
37+
# Zsh
38+
# Add this to ~/.zshrc:
39+
eval "$(_RUNBOOK_COMPLETE=zsh_source runbook)"
40+
41+
# Fish
42+
# Add this to ~/.config/fish/completions/foo-bar.fish:
43+
_RUNBOOK_COMPLETE=fish_source runbook | source
44+
```
45+
46+
For advanced completion setup see [docs](https://click.palletsprojects.com/en/8.1.x/shell-completion/#enabling-completion)
47+
48+
# Principles
49+
50+
- Prefer deno for better package management and developer ergonomics
51+
- But allow for other kernels (python) as secondary option, via compatible libraries
52+
- Make `runbook` batteries included for interfacing with shell commands and common runbook
53+
operations (ie grafana and notifications)
54+
- Sets up necessary requirements to ensure cell executions are timed and displayed as
55+
long as executions run through `runbook run ...` command
56+
57+
# Caveats
58+
59+
1. Running notebook in VScode does not set the timings necessary in notebook for being auditable and exported later
60+
1. Recommendation: if auditable runs are needed, use jupyter via browser `runbook run TITLE`
61+
1. Notebooks have different structured ids per cell depending on run environment
62+
1. Recommendation: if requiring consistency, write your own pre-processor to standardize on an id format
63+
1. Builting shell package requires a shell environment and is only expected to run on Linux or Mac not Windows.
64+
1. Recommendation: suggest fixes in PR or Issues on Github
65+
66+
## Deno / Typescript
67+
1. Parameter cells should use `let` declarations to allow for param overriding
68+
- This is required to correctly support executing the ts version of notebooks.
69+
1. Confirm/prompt functions always return false in notebooks due to lack of support
70+
in deno kernel. We may invest in upstreaming a patch to support this as it has support
71+
in python notebooks

.config/templating.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
3+
set -eou pipefail
4+
set -x
5+
6+
export RUNBOOK_HELP="$(poetry run runbook --help)"
7+
8+
envsubst < ".config/README.md.template"

README.md

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,30 +24,24 @@ In this context, a runbook is a mixture of markdown and executable code that con
2424
## CLI
2525

2626
```sh
27-
# Initialize a folder for use as runbook repository
28-
runbook init
29-
30-
# Create runbook from a template
31-
runbook create [--template=TEMPLATE] TITLE
32-
33-
# Edit a notebook server in browser (starts jupyter server and opens page)
34-
runbook edit RUNBOOK_PATH
35-
36-
# Create an instance of a runbook for execution by filling in parameterization
37-
# Adds metadata indicating that runbook is ready to execute
38-
runbook plan RUNBOOK_PATH
39-
40-
# [Future Implementation]
41-
# Review a runbook which inserts metadata to allow a type of execution
42-
runbook review TITLE
43-
44-
# Execute a runbook where default is --interactive=true
45-
# Note can only find runbooks that have been prepared
46-
runbook run TITLE
47-
48-
# [Future Implementation]
49-
# Export runbook to HTML / PDF / MD
50-
runbook export TITLE
27+
Usage: runbook [OPTIONS] COMMAND [ARGS]...
28+
29+
Options:
30+
--cwd PATH Directory for operations (normally at root above runbooks, ie
31+
../.runbook.yaml)
32+
--help Show this message and exit.
33+
34+
Commands:
35+
check Check language validity and formatting of a notebook.
36+
convert Convert an existing runbook to different format
37+
create Create a new runbook from [template]
38+
diff Diff two notebooks
39+
edit Edit an existing runbook
40+
init Initialize a folder as a runbook repository
41+
plan Prepares the runbook for execution by injecting parameters.
42+
review [Unimplemented] Entrypoint for reviewing runbook
43+
run Run a notebook
44+
version Display version information about runbook
5145
```
5246

5347
Shell completion is included via click library and enabled as follows [link](https://click.palletsprojects.com/en/8.1.x/shell-completion/#enabling-completion)

0 commit comments

Comments
 (0)