-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add screen-recording script for vagrant-demo (#9)
Signed-off-by: James Hillyerd <[email protected]>
- Loading branch information
Showing
10 changed files
with
212 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
SHELL = /bin/sh | ||
.PHONY = build clean destroy prepare | ||
|
||
configs = flake.nix | ||
srcs = demo.tape | ||
tapes = $(srcs:.tape=.mp4) | ||
|
||
db_ip = 192.168.33.10 | ||
web_ip = 192.168.33.11 | ||
host_ips = $(db_ip) $(web_ip) | ||
|
||
all: clean build | ||
|
||
clean: | ||
git restore $(configs) | ||
rm -f labcoat $(tapes) | ||
nixos-rebuild \ | ||
--flake ".#db-lab" \ | ||
--target-host root@$(db_ip) \ | ||
--build-host localhost switch | ||
ssh root@$(db_ip) nix-collect-garbage -d || true | ||
|
||
destroy: | ||
vagrant destroy --force | ||
for ip in $(host_ips); do \ | ||
ssh-keygen -R $$ip; \ | ||
done | ||
|
||
prepare: | ||
git restore $(configs) | ||
vagrant up | ||
ssh-keyscan $(host_ips) >> $$HOME/.ssh/known_hosts | ||
nixos-rebuild \ | ||
--flake ".#db-lab" \ | ||
--target-host root@$(db_ip) \ | ||
--build-host localhost boot | ||
# Kernel upgrade, reboot. | ||
ssh root@$(db_ip) reboot || true | ||
nixos-rebuild \ | ||
--flake ".#web-lab" \ | ||
--target-host root@$(web_ip) \ | ||
--build-host localhost boot | ||
# Kernel upgrade, reboot. | ||
ssh root@$(web_ip) reboot || true | ||
|
||
build: labcoat $(tapes) | ||
|
||
labcoat: | ||
go build ../.. | ||
|
||
%.mp4: %.tape | ||
vhs $< | ||
git restore $(configs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# vagrant-demo | ||
|
||
Used to generated screen recordings of labcoat. | ||
|
||
## Usage | ||
|
||
Warning: The `Makefile` will make changes to your SSH `known_hosts` file. | ||
|
||
```sh | ||
# Setup VMs | ||
make prepare | ||
|
||
# Generate recordings | ||
make | ||
|
||
# Teardown VMs | ||
make destroy | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
Output demo.gif | ||
|
||
Set Width 1600 | ||
Set Height 850 | ||
Set WindowBar Colorful | ||
Set FontSize 14 | ||
Set PlaybackSpeed 0.75 | ||
|
||
Set Shell fish | ||
|
||
# Show off UI. | ||
Sleep 500ms | ||
Type "./labcoat -config labcoat-config.toml" | ||
Enter | ||
Sleep 5s | ||
Type "j" | ||
Sleep 3s | ||
Type "j" | ||
Sleep 3s | ||
Type "j" | ||
Sleep 3s | ||
Type "/" | ||
Sleep 1s | ||
Type "lab" | ||
Sleep 500ms | ||
Enter | ||
Sleep 1.5s | ||
Type "fd" | ||
Sleep 3s | ||
Type "!" | ||
Sleep 500ms | ||
Type "systemctl status " | ||
Sleep 500ms | ||
Type "postgresql" | ||
Sleep 1.5s | ||
Enter | ||
Sleep 3.5s | ||
Type "q" | ||
Sleep 2s | ||
|
||
# Add PostgreSQL to db-lab config. | ||
Type "vim flake.nix" | ||
Enter | ||
Sleep 3s | ||
Type "/d" | ||
Sleep 500ms | ||
Type "b-lab" | ||
Sleep 1.5s | ||
Enter | ||
Sleep 500ms | ||
Type "zz" | ||
Sleep 1.5s | ||
Type "jjo" | ||
Sleep 500ms | ||
Type "{ services.postgresql.enable" | ||
Sleep 200ms | ||
Type " = true; }" | ||
Sleep 500ms | ||
Escape | ||
Type ":wq" | ||
Sleep 500ms | ||
Enter | ||
Sleep 2s | ||
|
||
# Deploy db-lab. | ||
Up | ||
Up | ||
Sleep 500ms | ||
Enter | ||
Sleep 3s | ||
Type "d" | ||
Sleep 10.5s | ||
Type "s" | ||
Sleep 2.5s | ||
Type "!systemctl status " | ||
Sleep 200ms | ||
Type "postgresql" | ||
Enter | ||
Sleep 3s | ||
|
||
# SSH demo. | ||
Type "i" | ||
Sleep 2s | ||
Type "# <<< on the db-lab host; one touch SSH!" | ||
Enter | ||
Sleep 1s | ||
Type "su - postgres" | ||
Enter | ||
Sleep 500ms | ||
Type "psql" | ||
Enter | ||
Sleep 1s | ||
Type "\conninfo" | ||
Enter | ||
Sleep 2s | ||
Type "\q" | ||
Enter | ||
Ctrl+D | ||
Sleep 500ms | ||
Ctrl+D | ||
Sleep 3s | ||
Tab | ||
Sleep 3s | ||
Tab | ||
Sleep 3s | ||
Tab | ||
Sleep 3s | ||
Tab | ||
Sleep 5s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters