robinovitch61 / wander Goto Github PK
View Code? Open in Web Editor NEWA terminal app/TUI for HashiCorp Nomad
License: MIT License
A terminal app/TUI for HashiCorp Nomad
License: MIT License
Listing allocations of a job in a namespace doesn't work. No results are returned. At the Nomad HTTP API level, one must provide the namespace with /v1/:job_id/allocations
. I also tried the wildcard *
namespace and it did not work. Long story short, the job namespace needs to be added to HTTP request.
I have a PR forthcoming.
Is your feature request related to a problem? Please describe.
When I split my terminal horizontally, I would like to hide the headers (showing shortcuts and cluster information) because I have not so much space for this information frame.
Describe the solution you'd like
I would like a shortcut allowing to toggle the headers area on and off to maximize the table height.
To me, the only information being important at all time in the header is the context, so it may be a good idea to keep it in "full screen mode".
Describe alternatives you've considered
Other (harder) alternative should be a ctrl + and ctrl - to increase/decrease the area and adjust it ( please note there are always 3 empty lines above the title of the table)
I have no workaround for now and I deal with it by putting the terminals on a bigger screen or by lowering down the char size...
Additional context
Similar to derailed/k9s#270
If unclear I'll provide more context
Off topic : Great Work for this wonderful app ๐ ๐
There's a lot of duplicate logic in pages that can be consolidated into a single page component. I think this will be possible. Some state may have to move up to main.
Describe the bug
When running a long-running script in a nomad container via the wander exec feature, the session timed out twice in a row with the below message. Unfortunately I can't be sure how long the timeout took to happen, but it was roughly no more than 10min.
To reproduce
Steps to reproduce the behavior:
Error: websocket: close sent
if this seems wrong, consider opening an issue here: https://github.com/robinovitch61/wander/issues/new/choose
q/ctrl+c to quit
Expected behavior
Connection should stay open until I choose to exit. FWIW this script was regularly printing logs to stdout every 20s or so. I can't find a truly reproducible case but will keep an eye out!
Please complete the following information:
.wander.yaml
file: NoneDescribe the solution you'd like
Currently we can view a job spec by typing p
in wander.
That would be great if we can edit the specs and plan a new allocation like in the ui.
By the way, thanks for this amazing tool
Don't do this if causes too much flickering
Describe the bug
Watching logs of an allocation using follow is causing a nil pointer exception.
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x95195c]
goroutine 785 [running]:
github.com/robinovitch61/wander/internal/tui/nomad.ReadLogsStreamNextMessage.func1()
/home/ghthor/go/pkg/mod/github.com/robinovitch61/[email protected]/internal/tui/nomad/logs.go:106 +0x3c
github.com/charmbracelet/bubbletea.(*Program).StartReturningModel.func6.1()
/home/ghthor/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:470 +0x33
created by github.com/charmbracelet/bubbletea.(*Program).StartReturningModel.func6
/home/ghthor/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:468 +0x14d
exit status 2
To reproduce
Steps to reproduce the behavior:
I believe this is the reproduction, but I haven't confirmed as yet. I've seen it twice now, but I was iterating on something else and didn't go intentionally reproduce.
Expected behavior
Return to the allocations page?
OR Post to the logs that the allocation has been stopped maybe?
Screenshots
Please complete the following information:
Additional context
Add any other context about the problem here.
Something that would also be useful -- if it's not too much work -- is the event stream on a single alloc. Sometimes you get an alloc that just gets hella cranky and being able to go 'alright, what are you, and only you doing.' I'd imagine that'd be e on a single alloc from within a job view.
I do the curl thing a lot sometimes. We actually run a python script which tails the global event stream from all namespaces and dumps it into Loki, but it's a lot of events and sometimes having a real-time stream at your fingertips is just what you need.
Describe the bug
The readme states that -t ""
should work to send an empty auth token but I receive an error
To Reproduce
$ wander -a $NOMAD_ADDR -t ""
error: set WANDER_TOKEN env variable, wander_token in config file, or --token argument
$ wander
Using config file: /Users/james/.wander.yaml
error: set WANDER_TOKEN env variable, wander_token in config file, or --token argument
Expected behavior
The -t
should be optional or work with an empty string
Desktop (please complete the following information):
This is a follow-up to #56 , it would be fantastic if we could view an event stream for a scoped job+namespace when viewing any given job. This would allow something like watching an event stream through wander during a rollout.
It's annoying how you can search, find something, then want to view that in context but when you remove the filter the cursor/screen isn't showing what you searched for. Happens most often for me viewing a spec or event.
Will be tricky on things that aren't selectable...
Probably don't do it on logs page, but other (re)loadable pages are probably fine to poll for updates every ~2-3s or something
As a wander
user, I want an option to enter a bash shell on a running job/allocation from the logs view.
Ideally, there should be an additional option added to the list at the top of this page that opens a shell. This is basically re-implementing the "Exec" feature of the on nomad's /ui/jobs
endpoint.
Will require a websocket impl to https://www.nomadproject.io/api-docs/allocations#exec-allocation
Trigger should be pressing s
while selecting a task on the allocations page.
Unsure of the UI yet. Could make a terminal
component that uses a textinput
at the bottom. Unsure if that will handle multiline commands (suffixed with \
) nicely out of the box, or if we just shouldn't support that right away. Should look and feel as much as possible like a normal terminal, with the ability to save sessions to local files just like viewports can.
I (Leo) am not a great designer. A better logo than two yellow triangles posing as sand dunes would be much appreciated :)
Should be fairly straightforward - additional http endpoint and page implementation. Pressing d
(describe? open to other options) when a job (allocation?) is selected shows the spec page. Escape while viewing a spec returns to the job (allocation?) page. Viewport shows nicely formatted spec in cursor-disabled viewport, similar to logline page today for a json log.
Describe the bug
Saving viewport contents when visual wrapping is on includes newlines in the saved content. It should not include wrapping newlines.
To reproduce
In a viewport with wrapping on and long enough lines to wrap around, save the contents with ctrl + s
. You'll see the newlines are saved as well.
Expected behavior
Newlines for visual wrapping purposes should not be present in the saved content.
This should be implemented on the viewport component so any viewport can be saved
Won't handle windows paths out of the box yet
$CURRENT_PAGE = jobs/allocations/logs/log
$TIMESTAMP = ISO 8601 time up to seconds
Placeholder textinput reads "Output file name for $CURRENT_PAGE (path optional)"
On confirm save:
~
, .
, ..
in the specified path will be resolved to its full path and conflicting file logic appliedAfter successful save, textinput will be replaced with "$FULL_PATH_INCLUDING_FILENAME saved!" for 5s
Maybe add a "COPY_FILEPATH_AFTER_SAVE" config option?
If errors, should return ErrMsg and be handled by main as usual
From @viniciusartur :
I was wondering that in k8s we can have a view of all pods in all namespaces, so if one pod is not healthy we can see the red color. This is good as we can use k8s as a dashboard to have a big picture of all pods. I was wondering if we could see all tasks in all namespaces in wander.
https://developer.hashicorp.com/nomad/api-docs/allocations#list-allocations
I'm thinking that while on the logs page, the keyhelp that shows up at the top of the page shows f tail logs
Once f
is pressed, a tailing
indicator shows up to the right of the filter. Pressing f
again turns it off.
Log offsets will need to be tracked, and we'll need to stop using the "plain": "true",
param in the current FetchLogs
impl. There will probably need to be another nomad helper function that returns a suitable stream data structure rather than the full buffer read that currently occurs with nomad.Get
The nomad UI has a "Meta" section showing optional metadata. Might be useful to see this depending on if people add useful data there in there cluster.
I think this is doable, particularly starting with a full-line selection.
Initial impl:
V
to enter visual modeV
then k
k
k
j
leaves 3 full lines selected). Selected lines show up slightly different color than the cursor line, both colors are different from normal cursor colorviw
, etc.), just up and down full line selection to startInspired by comment on https://lobste.rs/s/b67kmz/wander_terminal_app_tui_for_hashicorp
Why the choice to use different variables than the nomad cli tool itself?
At one point I had conflicts between them when wanting to point at a different cluster, so I decided to make an explicit config set specifically for wander. I can see how it might be a bit annoying given that 90% of users will have the same values for NOMAD_ADDR/WANDER_ADDR and NOMAD_TOKEN/WANDER_TOKEN.
I may want to change this in a backwards-compatible way so NOMAD_ prefixes are the recommended way. Maybe print a warning that the config names have changed and will be phased out in a later release.
Alternatively, maybe WANDER_ prefixes are better as they're explicitly for wander only and there will never be confusion with the CLI.
The event log is a big piece of json, hard to read.
I'm wishing we can provide a jq query in config file and use that to transform the event log into information the user cares about.
Thanks for the great tool btw!
It would be incredibly useful to have some form of event stream tailer, especially with the filtering as powerful as what's here now.
https://learn.hashicorp.com/tutorials/nomad/event-stream?in=nomad/nomad-1-0
Using TLS for our cluster & it seems like there is no config options to specify the certificates required.
Wander just exits with Error: Get "https://10.0.0.20:4646//v1/jobs?namespace=%2A": x509: certificate signed by unknown authority
Official documentation regarding TLS for the CLI https://learn.hashicorp.com/tutorials/nomad/security-enable-tls#running-with-tls
@moyiz nicely submitted wander to the ArchLinux AUR in #77
I should add this as a target for future releases with goreleaser so it doesn't get out of date: https://goreleaser.com/customization/aur/
Optionally add this middleware: https://github.com/charmbracelet/wish/blob/main/examples/bubbletea/main.go#L30
I have had users express interest in this. Maybe even fully customizable key bindings?
Some ideas here charmbracelet/lipgloss#55 (comment)
Secure variables are coming in Nomad 1.4. It would be cool to have a TUI interface for viewing, adding, editing, and deleting these variables as allowed by the permissions of the connection.
Source: https://www.hashicorp.com/resources/nomad-the-next-stage-in-evolution
cc @angrycub
Also allow pasting into filter
Especially the "invalid token" message is bizarre and leaves no recourse other than quitting.
Goreleaser is a really great tool for releasing Go projects. I also note its author works at Charm.
By adopting a .goreleaser.yml
file and a GitHub action, the wander
project could be automatically built every push... and upon semantic version tags like v0.1.1
, a GitHub Release and a Homebrew tap can easily be supported. There are other release targets like Debian packages, but homebrew is pretty great for CLI tools.
I committed a branch to my wander fork which does the above. However some aspects are hard-coded to my neomantra
GitHub account, so I have not made a PR yet.
Links to the main blobs:
You can see the branch build and tag builds here:
https://github.com/neomantra/wander/actions
I tagged a v0.0.1
... you can see the resultant release, with auto-Changelog here:
https://github.com/neomantra/wander/releases
And you can see my homebrew tap was updated here:
neomantra/homebrew-github@413bed1
You can do the following to install:
brew tap neomantra/homebrew-github
brew install wander
Doing Homebrew support requires a Homebrew repo.... if you don't want to support that we can remove it. You must set the secret HOMEBREW_TAP_GITHUB_TOKEN
on your wander repo; it is an access token which can affect that Homebrew repo.
Let me know if you have questions...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.