Skip to content

Commit

Permalink
chore: add demo
Browse files Browse the repository at this point in the history
  • Loading branch information
jon4hz committed Nov 22, 2024
1 parent dec3363 commit dae562f
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
awoolt.yml
/awoolt.yml
/awoolt
/demo/vault.pid
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

Interactively browse vault/openbao in the terminal.

![demo](demo/demo.gif)

## 🚀 Installation

```bash
Expand Down
Binary file added demo/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions demo/demo.tape
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Output demo/demo.gif

Set Framerate 60
Set Height 350

Hide
Type "./demo/setup.sh"
Enter
Type "export VAULT_ADDR=http://localhost:8200"
Enter
Type "export CLICOLOR_FORCE=1"
Enter
Type "alias awoolt='./awoolt > /dev/null' && clear"
Enter
Show

Type "awoolt -e kv"
Enter
Sleep 1
# select servers
Enter
Sleep 1
# select vm01
Enter
Sleep 1
# select os
Enter
Sleep 1
# select user02
Down
Sleep 1
Enter
Sleep 0.5
Type "# Values should be printed here. No idea why the demo isn't working :("
Enter
Sleep 3

Hide
Type "./demo/teardown.sh"
Enter
38 changes: 38 additions & 0 deletions demo/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash

set -e

# backup vault token if exists
if [ -f ~/.vault-token ]; then
mv ~/.vault-token ~/.vault-token.bak
fi

# start vault server in backgroud and save pid
vault server -dev > /dev/null 2>&1 &
VAULT_PID=$!

# write pid to file
echo $VAULT_PID > ./demo/vault.pid

export VAULT_ADDR=http://localhost:8200

# wait for vault server to start
sleep 3

vault secrets enable kv > /dev/null
vault kv enable-versioning kv > /dev/null
vault kv put kv/servers/vm01/os/user01 username=root password=toor > /dev/null
vault kv put kv/servers/vm01/os/user02 username=root password=toor > /dev/null
vault kv put kv/servers/vm01/os/user03 username=root password=toor > /dev/null
vault kv put kv/servers/vm01/web/user01 username=root password=toor > /dev/null
vault kv put kv/servers/vm02/os/user01 username=root password=toor > /dev/null
vault kv put kv/servers/vm03/os/user01 username=root password=toor > /dev/null
vault kv put kv/servers/vm04/os/user01 username=root password=toor > /dev/null
vault kv put kv/servers/vm05/os/user01 username=root password=toor > /dev/null
vault kv put kv/servers/vm06/os/user01 username=root password=toor > /dev/null

# disown the process
disown $VAULT_PID

# build awoolt
go build .
18 changes: 18 additions & 0 deletions demo/teardown.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

set -e

# read pid from file
VAULT_PID=$(cat ./demo/vault.pid)

# restore vault token
if [ -f ~/.vault-token.bak ]; then
mv ~/.vault-token.bak ~/.vault-token
fi

# stop vault server
kill "$VAULT_PID"

# remove files
rm ./demo/vault.pid
rm awoolt

0 comments on commit dae562f

Please sign in to comment.