* fix: call cmd.Wait()
Even though the context is cancelled we still need to call cmd.Wait()
after a cmd.Start() to clean up the child (reap) process. Not doing so
results in a zombie journalctl.
I have manually tested this, as I'm still not sure how to e2e test for
this in a simple manner.
Before:
```
root@uncloud2:~# ps aux|grep jou
root 313 0.0 1.2 42272 23352 ? S<s Apr20 0:10 /usr/lib/systemd/systemd-journald
root 15751 0.0 0.0 0 0 pts/0 Z+ 07:02 0:00 [journalctl] <defunct>
root 15754 0.0 0.0 0 0 pts/0 Z+ 07:02 0:00 [journalctl] <defunct>
```
After:
```
root 313 0.0 1.2 42272 23592 ? S<s Apr20 0:10 /usr/lib/systemd/systemd-journald
```
* follow() doesnt need wait
We can keep the wait function more contraint, as follow does not need it
Signed-off-by: Miek Gieben <miek@miek.nl>
---------
Signed-off-by: Miek Gieben <miek@miek.nl>
* ucind: implement cluster list
I keep forgetting my ucind clusters, that add the missing list command:
```
% ./ucind cluster list
NAME MACHINES
miek1 machine-1
```
Just the name would have been enough, but to actually make use of the
tui table a machines list is handy as well.
(There isn't much bubbletea in ucind, but I thought lets start now).
Signed-off-by: Miek Gieben <miek@miek.nl>
* Filter directly when listing
Filter on ucind managed while listing clusters
Signed-off-by: Miek Gieben <miek@miek.nl>
---------
Signed-off-by: Miek Gieben <miek@miek.nl>
* logging: client side
Create internal/logs and put abstracted way service and machine logging in there
This adds the bits to do machine logging of the services.
See #273 and discussion in #158
Signed-off-by: Miek Gieben <miek@miek.nl>
* go mod tidy
Signed-off-by: Miek Gieben <miek@miek.nl>
* fix typo
Signed-off-by: Miek Gieben <miek@miek.nl>
* Hook it up further
Signed-off-by: Miek Gieben <miek@miek.nl>
* Check unit validity server side
Signed-off-by: Miek Gieben <miek@miek.nl>
* Make cli-docs
Signed-off-by: Miek Gieben <miek@miek.nl>
* Add newline to logs
Signed-off-by: Miek Gieben <miek@miek.nl>
* docs
Signed-off-by: Miek Gieben <miek@miek.nl>
* Polish a bit
Signed-off-by: Miek Gieben <miek@miek.nl>
* comment fix
Signed-off-by: Miek Gieben <miek@miek.nl>
* There is no groupid
Signed-off-by: Miek Gieben <miek@miek.nl>
---------
Signed-off-by: Miek Gieben <miek@miek.nl>
* Add corrosion admin client function to get RTT to other machines in the cluster
* Add `uc machine rtt` showing all pair-wise RTT stats from corrosion
* Add long description to machine rtt command
* Include machine peer RTTs in InspectMachine instead of adding new gRPC API for it
* Add nil check on InspectMachine's Rtt field to protect from a potential edge case
* Generate docs for machine rtt command
* Handle m.Message being nil when a node is down or unavailble
* Update cli-docs
* Use tui Table instead of tabwriter
* Change reported RTT to the median rather than mean. Still calculate include stddev, as it might be a useful indication of network jitter.
* Show RTT to peers in `wg show` output
* Update cli docs
* Check autom if we can connect via Unix socket
When there is no config, but a unix socket does exist, connect via the
unix socket. Prohibit saving the config if this is the case.
Fixes: #148
Use the new CutPrefix to shorten some code.
Signed-off-by: Miek Gieben <miek@miek.nl>
* remove error checking; it can not be hit
Signed-off-by: Miek Gieben <miek@miek.nl>
* Extra error text when logged in locally
Signed-off-by: Miek Gieben <miek@miek.nl>
---------
Signed-off-by: Miek Gieben <miek@miek.nl>
* Add version check mechanism to gRPC calls
* Use semver not semver/v3
* Give dev builds a special "infinite" version number (999.0.0-dev)
* Handle no metadata on grpc call correctly for version check
* Move versioncheck package to root pkg/ from pkg/api/ since it is shared by both pkg/api/ and pkg/client/
* Only show "no daemon version" warning once
* Append version headers to metadata, not overwrite...
* Unit tests on versioncheck logic
* Move SetHeader to the ServerStream in ServerStreamInterceptor
* Go modernizer nits: interface{} -> any
* Use more conventional gRPC header names for version/min-versions
* Add TODO notes on checkDaemonVersionInResponse and related code that can be removed eventually after transition to version checking client/daemons
* Use testify for testing assertions
* Add explanatory comments on MinCLIVersion and MinDaemonVersion
---------
Co-authored-by: Pasha Sviderski <me@psviderski.name>
* Add server side of journal logs
This add the server side and grpc methods to get a journal logs from a
machine. It repurposes ServiceLogEntry for these logs to keep the
changes somewhat to a minimum. And it lets us re-use the merging of the
various logs. In the protobufs ContainerLog has been renamed to just Log
and LogEntry, as these are now also used for journal logs.
It does api.LogOptions in more places to reduce the various logOpts that
were used.
It does not yet plumb it through to the uc client, that needs a follow
up pr. Following logs is also not yet implemented.
Signed-off-by: Miek Gieben <miek@miek.nl>
* Fix test too
Signed-off-by: Miek Gieben <miek@miek.nl>
* remove entire comment
Signed-off-by: Miek Gieben <miek@miek.nl>
* Implement the follow option, untested mind you
Signed-off-by: Miek Gieben <miek@miek.nl>
* update debug line
Signed-off-by: Miek Gieben <miek@miek.nl>
* internal/jounal: First batch of PR comments
Signed-off-by: Miek Gieben <miek@miek.nl>
* internal/journal: code review comments
Signed-off-by: Miek Gieben <miek@miek.nl>
* Manually apply suggestion
Signed-off-by: Miek Gieben <miek@miek.nl>
* apply comment manually
Signed-off-by: Miek Gieben <miek@miek.nl>
* internal/journal: add unit test
Signed-off-by: Miek Gieben <miek@miek.nl>
* Use testify
Signed-off-by: Miek Gieben <miek@miek.nl>
* -amFix scanner.Err checking
Signed-off-by: Miek Gieben <miek@miek.nl>
* Implement code review comments
Signed-off-by: Miek Gieben <miek@miek.nl>
---------
Signed-off-by: Miek Gieben <miek@miek.nl>
This runs:
```
go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix ./...
```
over the codebase, as this is using go 1.26, it can also use the new
new() functionallity so AsPtr and boolPtr is are needed anymore.
Signed-off-by: Miek Gieben <miek@miek.nl>