Skip to content

Commit

Permalink
Update README for v1.0.0 (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
robinovitch61 authored Jan 6, 2024
1 parent 9174ab5 commit c0b4d0c
Show file tree
Hide file tree
Showing 17 changed files with 110 additions and 55 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ mock.go
dist/
id_ed25519*
vendor
ignore.gif
**/*/my_logs.txt
97 changes: 50 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,69 +17,48 @@ An efficient terminal application/TUI for interacting with your [HashiCorp Nomad
- See full job or allocation specs
- Save any content to a local file

![](./img/wander.gif)
`wander` is written with tools from [Charm](https://charm.sh/).

![](./img/wander_flow.drawio.png)
[Feature requests and bug reports are welcome](https://github.com/robinovitch61/wander/issues/new/choose).

`wander` is written with tools from [Charm](https://charm.sh/).
## Demo

![](./img/wander.gif)

[Screenshots](./img/screenshots#readme)

[Feature requests and bug reports for wander are welcome](https://github.com/robinovitch61/wander/issues/new/choose).
## Flow Diagram
![](./img/wander_flow.drawio.png)

## Installation

### > Using Homebrew
The following options are available depending on your platform and tooling:

```shell
# homebrew
brew install robinovitch61/tap/wander

# to upgrade
# upgrade using homebrew
brew update && brew upgrade wander
```

### > Using Nix

#### > nix-shell

Ensure [NUR is accessible](https://github.com/nix-community/NUR), then run:

```shell
# nix-shell
# ensure NUR is accessible (https://github.com/nix-community/NUR)
nix-shell -p nur.repos.robinovitch61.wander
...
[nix-shell:~]$ wander
```

#### > nix flakes

Ensure [flake support is enabled](https://nixos.wiki/wiki/Flakes#Enable_flakes_temporarily), then run:

``` shell
# nix flakes
# ensure flake support is enabled (https://nixos.wiki/wiki/Flakes#Enable_flakes_temporarily)
nix run github:robinovitch61/nur-packages#wander
```

### > Install from AUR

Use your favorite AUR helper:

```shell
# arch linux
# PKGBUILD available at https://aur.archlinux.org/packages/wander
yay -S wander-bin
```

### > Download from GitHub

Download the relevant binary for your operating system (macOS = Darwin) from
the [latest Github release](https://github.com/robinovitch61/wander/releases). Unpack it, then move the binary to
somewhere accessible in your `PATH`, e.g. `mv ./wander /usr/local/bin`.

### > Using [go installed on your machine](https://go.dev/doc/install)

```shell
# with go (https://go.dev/doc/install)
go install github.com/robinovitch61/wander@latest
```

### > Build from source

Clone this repo, build from source with `cd <cloned_repo> && go build`, then move the binary to somewhere accessible in
your `PATH`, e.g. `mv ./wander /usr/local/bin`.
You can also download [prebuilt releases](https://github.com/robinovitch61/wander/releases) and move the unpacked
executable to somewhere in your `PATH`, e.g. `/usr/local/bin`.

## Usage

Expand Down Expand Up @@ -239,6 +218,26 @@ Example yaml file showing all options (copy this into `$HOME/.wander.yaml` and u
#wander_logo_color: "#DBBD70"
```

## Exec Command

`wander` ships with an `exec` command similar to the [`nomad alloc exec`](https://developer.hashicorp.com/nomad/docs/commands/alloc/exec)
utility. Example usage:

```shell
# specify job and task, assuming single allocation
wander exec alright_stop --task redis echo "hi"

# specify allocation, assuming single task
wander exec 3dca0982 echo "hi"

# use prefixes of jobs or allocation ids
wander exec al echo "hi" # prefix of job "alright_stop"
wander exec 3d echo "hi" # prefix of alloc ID "3dca0982"

# specify flags for the exec command with --
wander exec alright_stop --task redis -- echo -n "hi"
```

## SSH App

`wander` can be served via ssh application. For example, you could host an internal ssh application for your company
Expand All @@ -252,8 +251,7 @@ Serve the ssh app with `wander serve`.

## Trying It Out

You can try `wander` out by running a local nomad cluster in dev mode
following [these instructions](https://learn.hashicorp.com/tutorials/nomad/get-started-run?in=nomad/get-started):
You can try `wander` out by running a local development nomad cluster following [these instructions](https://learn.hashicorp.com/tutorials/nomad/get-started-run?in=nomad/get-started):

```sh
# in first terminal session, start and leave nomad running in dev mode
Expand Down Expand Up @@ -281,9 +279,14 @@ In this case, you're responsible for ensuring the specified version is in sync w

## Development

The `scripts/dev.sh` script watches the source code and rebuilds the app on changes
using [entr](https://github.com/eradman/entr). Install the latest release of `nomad`.
To manually build:

```shell
git clone [email protected]:robinovitch61/wander.git
cd wander
go build # outputs ./wander executable
```

`wander` runs the built app. You must rerun it on rebuild.
The [scripts](/scripts) directory contains various development helper scripts.

If the `WANDER_DEBUG` environment variable is set to `true`, the `dev.Debug(s string)` function outputs to `wander.log`.
Binary file added img/screenshots/All_Jobs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/screenshots/All_Tasks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/screenshots/Allocation_Statistics.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/screenshots/Exec.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/screenshots/Global_Events.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions img/screenshots/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# All Jobs
![](./All_Jobs.png)
# Global Events
![](./Global_Events.png)
# All Tasks
![](./All_Tasks.png)
# Exec
![](./Exec.png)
# Tasks for Job
![](./Tasks_for_Job.png)
# Task Logs
![](./Task_Logs.png)
# Save Any View to Local File
![](./Save_Any_View_to_Local_File.png)
# Allocation Statistics
![](./Allocation_Statistics.png)
Binary file added img/screenshots/Save_Any_View_to_Local_File.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/screenshots/Task_Logs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/screenshots/Tasks_for_Job.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/wander.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/wander_flow.drawio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion scripts/dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

thisdir=${0:a:h}

ls $thisdir/../**/*.go | entr -c $thisdir/rebuild.sh
ls $thisdir/../**/*.go | entr -c $thisdir/rebuild.sh $1
15 changes: 14 additions & 1 deletion scripts/gif_demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,21 @@
# https://github.com/charmbracelet/vhs
# expects nomad to already be running locally
# should be run from scripts directory

rm -f /tmp/my_logs.txt
latest_tag=$(git describe --tags --abbrev=0)
tag=${1:-$latest_tag}
./rebuild.sh "$tag"
mv ~/.wander.{yaml,yaml.tmp}
vhs vhs.tape
open ../img/wander.gif
mv ~/.wander.{yaml.tmp,yaml}
rm -f my_logs.txt
open ../img/wander.gif
rm -f ../img/screenshots/README.md
# for files in ../img/screenshots/*.png sorted by modification time
for file in $(ls -t ../img/screenshots/*.png); do
filename=$(basename -- "$file")
filename="${filename%.*}"
echo "# ${filename//_/ }" >> ../img/screenshots/README.md
echo "![](./$filename.png)" >> ../img/screenshots/README.md
done
6 changes: 5 additions & 1 deletion scripts/rebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
thisdir=${0:a:h}
rm -f $GOPATH/bin/wander
echo "building $(date +"%T")"
go build -o $thisdir/wander $thisdir/..
if [ $# -eq 1 ]; then
go build -ldflags "-X github.com/robinovitch61/wander/cmd.Version=$1" -o $thisdir/wander $thisdir/..
else
go build -o $thisdir/wander $thisdir/..
fi
if [ -f $thisdir/wander ]; then
mv $thisdir/wander $GOPATH/bin/wander
echo "built"
Expand Down
27 changes: 22 additions & 5 deletions scripts/vhs.tape
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,21 @@ Set Framerate 15
Hide
Type "wander"
Enter
Sleep 200ms
Sleep 500ms
Show

# All Jobs
Sleep 1s
Type@500ms "jj"
Type@500ms "k"
Sleep 101ms
Screenshot ../img/screenshots/All_Jobs.png
Sleep 1s

# All Events
Type "V"
Sleep 100ms
Screenshot ../img/screenshots/Global_Events.png
Sleep 2s
Type@300ms "j"
Enter
Expand All @@ -74,6 +78,8 @@ Sleep 1s

# All Tasks
Type "A"
Sleep 100ms
Screenshot ../img/screenshots/All_Tasks.png
Sleep 1s
Type@500ms "jj"
Type@500ms "k"
Expand All @@ -89,6 +95,8 @@ Enter
Type@150ms "ls -la"
Sleep 300ms
Enter
Sleep 100ms
Screenshot ../img/screenshots/Exec.png
Sleep 2s
Ctrl+d
Sleep 2s
Expand All @@ -101,10 +109,14 @@ Sleep 1s

# Tasks for Job
Enter
Sleep 100ms
Screenshot ../img/screenshots/Tasks_for_Job.png
Sleep 2s

# Logs for Task, Filtering
Enter
Sleep 100ms
Screenshot ../img/screenshots/Task_Logs.png
Sleep 2s
Type "/"
Sleep 1s
Expand All @@ -119,19 +131,24 @@ Escape@200ms 2

# Save Logs
Ctrl+S
Type@100ms "my_logs.txt"
Type@100ms "/tmp/my_logs.txt"
Sleep 500ms
Enter
Sleep 3s
Sleep 500ms
Screenshot ../img/screenshots/Save_Any_View_to_Local_File.png
Sleep 2.5s

# Back to Tasks for Job
Escape
Sleep 1s

# Stats for Allocation
Type "s"
Sleep 100ms
Screenshot ../img/screenshots/Allocation_Statistics.png
Sleep 2s

# Back to Tasks for Job
Escape
# Exit
Hide
Ctrl+c
Sleep 1s

0 comments on commit c0b4d0c

Please sign in to comment.