Giter VIP home page Giter VIP logo

damon's Introduction

Damon - A terminal Dashboard for HashiCorp Nomad

Damon is a terminal user interface (TUI) for Nomad. It provides functionality to observe and interact with Nomad resources such as Jobs, Deployments, or Allocations. Interactions include:

  • View Jobs and Job allocations
  • View Deployments
  • View Namespaces
  • Show Task events
  • Show Job status/information (equally to $ nomad status <job>)
  • Show Logs in an active log stream (including filtering + highlighting).
  • and more...

Additional Notes

Damon is in an early stage and is under active development. We are working on improving the performance and adding new features to Damon. Please take a look at the Damon project board to see what features you can expect in near future. If you find a bug or you have great ideas how Damon can be improved feel free to open an issue. To avoid duplicates, please check the project board before submitting one. Thank you!

Screenshot

image

Installation

Brew

--> Coming soon

Building from source and Run Damon

Make sure you have your go environment setup:

  1. Clone the project
  2. Run $ make build to build the binary
  3. Run $ make run to run the binary
  4. You can use $ make install-osx on a Mac to cp the binary to /usr/local/bin/damon

or

$ go install ./cmd/damon

How to use it

Once Damon is installed and avialable in your path, simply run:

$ damon

Environment Variables

Damon reads the following environment variables on startup:

  • NOMAD_TOKEN
  • NOMAD_ADDR
  • NOMAD_REGION
  • NOMAD_NAMESPACE
  • NOMAD_HTTP_AUTH
  • NOMAD_CACERT
  • NOMAD_CAPATH
  • NOMAD_CLIENT_CERT
  • NOMAD_CLIENT_KEY
  • NOMAD_TLS_SERVER_NAME
  • NOMAD_SKIP_VERIFY

You can read about them in detail here.

Navigation

General

On every table or text view, you can use:

  • k or arrow up to navigate up
  • j or arrow down to navigate down

Top Level Commands

  • Show Jobs: ctrl-j
  • Show Deployments: ctrl-d
  • Show Namespaces: ctrl-n
  • Jump to a Jobs Allocations: ctrl-j
  • Switch Namespace: s
  • Quit: ctrl-c

Job View Commands

  • Show Allocations for a Job: <ENTER> (on the selected job)
  • Show TaskGroups for a Job: <t> (on the selected job)
  • Show information for a Job: <i> (on the selected job)
  • Filter Job: </> (on the selected job)
  • Show Job Info: i (on the selected job)

Task View Commands

  • Show logs on STDOUT for a Task: <ENTER>
  • Show logs on STDERR for a Task: <ctrl-e>
  • Show events for a Task: <e>

Log View

When Damon displays logs, you can navigate through the logs using j, k, G, and g.

  • To filter logs you can hit / which will open an input field to enter the filter string.
  • To highligh logs you can hit h. This will also open an input field to enter the highlighting string.
  • Hit s to stop a log stream.
  • Hit r to resume a log stream.

damon's People

Contributors

dependabot[bot] avatar hashicorp-copywrite[bot] avatar hashicorp-tsccr[bot] avatar hcjulz avatar jezemery avatar jrasell avatar levex avatar lgfa29 avatar sarahethompson avatar tgross avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

damon's Issues

Seeing Tasks groups of namespace NB in namespace NA

Hello guys,

I started to use damon version v0.1.0-dev (8ff5085) with is a great tool for quick debugging.
Let's say I deployed an application A in namespace NA and NB.
I noticied that when I'm in a namespace NA, I'm able to see taskgroup of namespace NB.
Anyone else noticed that?
Any fix soon?

Seg fault running Damon

I am getting a seg fault after running damon for ~10 seconds. The seg fault breaks the current terminal session and breaks formatting. I have copied the error below and tried to format it to make is a bit more readable.

panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x6f9abe]
    goroutine 37 [running]:
      github.com/hcjulz/damon/nomad.getTasksFromAlloc(0xc0001901e8?, 0xc000a97e60?)
      /home/.../damon/nomad/alloc.go:61 +0x1be
      github.com/hcjulz/damon/nomad.(*Nomad).toAllocs(0xc000220180, {0xc000ac8000, 0x43, 0xc0002749f0?})
      /home/.../damon/nomad/alloc.go:87 +0x12b
      github.com/hcjulz/damon/nomad.(*Nomad).Allocations(0xc000220180, 0xc0000a4f60?)
      /home/.../damon/nomad/alloc.go:47 +0xc8
      github.com/hcjulz/damon/watcher.(*Watcher).updateAllocations(0xc0000a6550)
      /home/.../damon/watcher/watcher.go:185 +0x57
      github.com/hcjulz/damon/watcher.(*Watcher).update(0x75d460?, {0x7c5971, 0xa})
      /home/.../damon/watcher/watcher.go:156 +0x72
      github.com/hcjulz/damon/watcher.(*Watcher).Watch(0xc0000a6550)
      /home/.../damon/watcher/watcher.go:130 +0x1d7
      created by main.main
      /home/.../tools/damon/cmd/damon/main.go:100 +0xeb6

I compiled Damon using Go 1.19

$ go version
go version go1.19 linux/amd64

🍦 As a user, I want to see events for my tasks.

Description

The allocation view so far only gives the user the ability to show logs. Other valuable information for allocations is to show task information such as the task events. This information can be valuable when debugging failing containers.

Task

Add the ability to the allocations view to show the events using the shortcut e.

Acceptance

  • Run a job
  • start Damon
  • show the allocation for a job
  • hit e to see a table displaying the events for the allocations corresponding task.

[bug] Damon crashes when NOMAD_ADDR does not start with http://

Hello, thanks for making damon! It is a great TUI!

I came across this nil pointer dereference bug:

$ NOMAD_ADDR=192.168.1.13:4646 damon
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x55bf74812a97]

goroutine 1 [running]:
github.com/hcjulz/damon/nomad.(*Nomad).Namespaces(0xc00017fe30?, 0x55bf7495c1c0?)
        /home/h/.cache/paru/clone/damon-git/src/damon/nomad/namespaces.go:13 +0x17
main.initializeState(0x0)
        /home/h/.cache/paru/clone/damon-git/src/damon/cmd/damon/main.go:116 +0xeb
main.main()
        /home/h/.cache/paru/clone/damon-git/src/damon/cmd/damon/main.go:49 +0x13b

But if I use NOMAD_ADDR=http://192.168.1.13:4646 damon then it works as expected.

I'm new to Nomad and still learning about it, so I'm not sure what are all protocols supported to connect to a remote cluster. My suggestion is to issue a message/warning missing protocol in nomad address. It should be one of http://, https://, etc://. More details in <link to docs>. and gracefully terminate.

Also, when the port is missing we see no message about that, just that damon can't reach Nomad:

$ NOMAD_ADDR=http://192.168.1.13 damon
2023/10/18 12:54:22 cannot initialize view. Is Nomad running?

A suggestion to add the port in the address would be nice as well.


Some info on my system:

$ damon -v
Damon v0.1.0-dev (523ef4f)

$ nomad -v
Nomad v1.6.1

$ cat /etc/os-release
NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://archlinux.org/"
DOCUMENTATION_URL="https://wiki.archlinux.org/"
SUPPORT_URL="https://bbs.archlinux.org/"
BUG_REPORT_URL="https://bugs.archlinux.org/"
PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/"
LOGO=archlinux-logo

🍦 As a user, I want to stop and start a job from the job view.

Description

This will allow users of Damon to start/stop a job from the Jobs View.

Acceptance Criteria

  • Deploy/Run a job using the nomad cli
  • Open Damon which brings you to the jobs view
  • Hit ctrl-s to stop the running job
    • See that you get a prompt to confirm you really want to stop the job
  • Hit ctrl-s to start the running job
    • See that you get a prompt to confirm you really want to start the job
  • Do the procedure again but see you can cancel stop and starts of a job.

πŸ› Fix the issue that includes allocs from another job that contain the a substring of the selected jobs task-group.

Description

If some-job is selected to display the current allocations it will include all allocations of the job some and job.

This happens because the allocation view just applies a filter using a regexp to display the correct allocations for a job. However, this regexp needs to be adjusted to match only allocation with the task-group that match the selected jobID and only this jobID.

As a user, I want to be able to select which task I want to show the logs for!

Description

Currently, when viewing logs for an allocation that has multiple tasks, it will pick a task randomly to show the logs.

Task

Add a selection to Damon that allows users to select a task from a task list.

Acceptance

  • Deploy a job with multiple tasks
  • As a user, I can see that I can select the desired task i want to view the logs for.

🍦 πŸ‘οΈ As a user, I want to see the number of running tasks from the Job View.

Description

Looking at the Jobs in the Jobs View won't give a user any information about the status of the tasks: eg how many tasks are running.

Task

Add a Summary column to the Job Table such that the total number of tasks and the actual number of running tasks are visible (eg 1/2 = 1 out of 2 tasks are running).
The rows with jobs that don't have all tasks running should be displayed in another colour.

Acceptance

  • Run a Job
  • Navigate to the Jobs View
  • Hit ctrl-s and confirm to stop the running job
  • Hit ctrl-s again to confirm to start the running job
  • During the start of the job:
    • See that the number of running tasks jumps from 0/1 to 1/1 eventually.
    • See that the colour of the row changes.

Random task is selected for log viewing when selecting an allocation with multiple tasks

When selecting an allocation from the list to view logs, if the allocation has more than one task it appears to be selecting the task to show logs for at random.

$ nomad alloc status 92ffac07 | grep '^Task "' 
Task "postgres" (prestart sidecar) is "running"
Task "sonarperl" is "running"

In this case, I've had both the logs for the postgres the sonarperl tasks be shown without any indication as to why it was selected.

I checked the projects board and didn't see anything that looked like this so I figured I'd open the issue just in case.

Let me know if I can provide any further info!

Show healthy/running/desired allocs in Job summary

What is the problem?

The current summary data in Jobs view is not very intuitive. Currently it shows, how many groups are running out of total groups in a Job. But people are really interested on whether the desired allocs are running and healthy within a job. Something similar to the below one. This is Job overview from Nomad UI dashboard.

image

How to solve?

We can show below detail in Summary.

<healthy allocs> / <running allocs> / <desired allocs>

Example

image

The allocs should be the sum of allocs from each group. (Mostly each job will have one group. I still can’t find a good use case, where we run multiple groups in a Job)

I can give a PR on this change 😎 . Let me know if this improvement make sense.

Segfault while viewing allocation logs

First off, this project is amazing and will be a staple in my day to day for a long time!

I just built the binary and was testing it out and I left the log viewer open on an allocation for maybe 30-60 seconds while I was reading the projects README when Damon crashed with the error below.

(Note, the TUI crashing left me unable to copypasta the error and it was a bit mangled format-wise in my terminal so I had to hand type it, apologies if the formatting is a bit different)

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation on violation code=0x1 addr=0x10 pc=0x73a1b8]
  goroutine 242 [running]:
      github.com/hcjulz/damon/watcher.(*Watcher).SubscribeToLogs.func1(0xc0004c20c0, 0xc000254190, 0xc0006285a0, 0xc0004a23c0) /workspaces/damon/watcher/logs.go:35 +0x118
      created by github.com/hcjulz/damon/watcher.(*Watcher).SubscribeToLogs /workspaces/damon/watcher/logs.go:31 +0x385

Environment Information

 ➜  consul-cluster git:(master) βœ— cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.3 LTS"

$ nomad version
Nomad v1.1.3 (8c0c8140997329136971e66e4c2337dfcf932692)

$ nomad server members
Name                        Address      Port  Status  Leader  Protocol  Build  Datacenter  Region
nomad-0.global             10.0.0.2   4648   alive   true         2          1.1.3  awe-prod-1  global
nomad-1.global              10.0.0.3   4648   alive   false       2           1.1.3  awe-prod-1  global
nomad-2.global             10.0.0.4   4648   alive   false       2           1.1.3  awe-prod-1  global

Haven't been able to reproduce the error again since but i'll try to watch more closely when monitoring logs to try and see if I can get some more context.

Feature request: alloc exec

This tool is great!

I'd love quick exec access to running tasks. It would make this tool extremely useful for troubleshooting.

Print the commit when running damon --version

It would be really useful to include the commit short sha when printing version information, especially while damon is still early in development. This would help with completing bug reports but would also make it easier to understand if a rebuild and install worked.

Thanks!

Crash while tailing a pretty active web log

panic: runtime error: index out of range [507] with length 0 [recovered]
        panic: runtime error: index out of range [507] with length 0

goroutine 1 [running]:
github.com/rivo/tview.(*Application).Run.func1(0x1400021c1c0)
        /Users/james/go/pkg/mod/github.com/rivo/[email protected]/application.go:243 +0x7c
panic(0x104d10c80, 0x1400013c4b0)
        /opt/homebrew/Cellar/go/1.16/libexec/src/runtime/panic.go:965 +0x14c
github.com/rivo/tview.(*TextView).Draw(0x14000200600, 0x104d50218, 0x14000254240)
        /Users/james/go/pkg/mod/github.com/rivo/[email protected]/textview.go:1017 +0xb18
github.com/rivo/tview.(*Flex).Draw(0x14000069590, 0x104d50218, 0x14000254240)
        /Users/james/go/pkg/mod/github.com/rivo/[email protected]/flex.go:183 +0x2b8
github.com/rivo/tview.(*Flex).Draw(0x140000695c0, 0x104d50218, 0x14000254240)
        /Users/james/go/pkg/mod/github.com/rivo/[email protected]/flex.go:183 +0x2b8
github.com/rivo/tview.(*Pages).Draw(0x14000069680, 0x104d50218, 0x14000254240)
        /Users/james/go/pkg/mod/github.com/rivo/[email protected]/pages.go:277 +0xb0
github.com/rivo/tview.(*Application).draw(0x1400021c1c0, 0x0)
        /Users/james/go/pkg/mod/github.com/rivo/[email protected]/application.go:597 +0xac
github.com/rivo/tview.(*Application).Draw.func1()
        /Users/james/go/pkg/mod/github.com/rivo/[email protected]/application.go:550 +0x28
github.com/rivo/tview.(*Application).Run(0x1400021c1c0, 0x0, 0x0)
        /Users/james/go/pkg/mod/github.com/rivo/[email protected]/application.go:376 +0x850
main.main()
        /Users/james/Developer/damon/cmd/damon/main.go:104 +0x9d8

Unactionable 500 from watcher

Fresh install of damon, nomad is remote with anonymous acl write access.

If I press a key after more than a short ( < 1s?) time has passed, I get an "Unexpected response code: 500 (Permission Denied)". At this point, the only action is to press enter/escape/ctrl+c, which does nothing, and then any key press, which will then quit. If I press enter before that short time window, then I can trigger the error dialog and then press enter to pop up a level and continue to navigate despite the large error window in the center of the screen. Commenting out line 128 of watcher/watcher.go lets me browse uninterrupted so it doesn't seem all that fatal.

It would be nice to be able to close the dialog box without quitting the application. Secondarily, the modal behavior seems to race with other ui interactions.

Running on ubuntu 20.04/tmux/kitty

Totally understand that this is early stage and I was just tooling around with it and wanted to pass along my experience. It's super cool and look forward to seeing more!

βš™οΈ Allow a subscriber to subscribe to multiple topics at a time.

Description

Currently, a subscriber (that can be a particular view like the Job View) can subscribe to only a single topic (Jobs, Allocs, Deployments). However, there is use-cases where a view is interested in multiple topics.

Task

Update the watcher such that a subscriber can subscribe to multiple topics and that a view is notified for all subscribed topics.

Rendering magic

How do you draw to a terminal aware of the height of the terminal? I know with ANSI control codes you can move the cursor to print on a preceding line or clear the screen and rewrite, but I've never seen how to implement a more complex full terminal screen rendering application.

I did a skim of ./layout and ./view and didn't notice anything.

GitHub Actions - deprecated warnings found - action required!

Workflow Name: Nightly Release
Branch: main
Run URL: https://github.com/hashicorp/damon/actions/runs/4776194691

save-state deprecation warnings: 0
set-output deprecation warnings: 1
node12 deprecation warnings: 3

Please review these deprecation warnings as soon as possible and merge in the necessary updates.

GitHub will be removing support for these commands and plan to fully disable them on 31st May 2023. At this time, any workflow that still utilizes these commands will fail. See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/.

GitHub have not finalized a date for deprecating node12 yet but have indicated that this will be summer 2023. So it is advised to switch to node16 asap. See https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/.

If you need any help, please reach out to us in #team-rel-eng.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.