Skip to content

Commit b66fbfb

Browse files
committed
Additional explanation/documentation
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
1 parent fa0a2a1 commit b66fbfb

File tree

434 files changed

+36815
-57511
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

434 files changed

+36815
-57511
lines changed

cmd/agent_logs.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,16 @@ func makeAgentLogs() *cobra.Command {
1515
cmd := &cobra.Command{
1616
Use: "agent-logs",
1717
Short: "Fetch logs from the agent's systemd service",
18-
Example: ` # Latest logs for a given host:
18+
Long: `Fetch the service logs from a remote server to if you need
19+
to confirm the rollout of updates, agent version, and to troubleshoot
20+
VM launches.`,
21+
Example: ` # Latest logs for a given OWNER and HOST:
1922
actuated agent-logs --owner OWNER HOST
2023
2124
# Latest logs for a given time-range
2225
actuated agent-logs --owner OWNER --age 1h HOST
2326
`,
24-
Aliases: []string{"service-logs"},
27+
Aliases: []string{"service-logs", "al"},
2528
}
2629

2730
cmd.RunE = runAgentLogsE

cmd/disable.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ import (
1010
"github.com/spf13/cobra"
1111
)
1212

13-
func makeDisable() *cobra.Command {
13+
func makeDisableAgent() *cobra.Command {
1414
cmd := &cobra.Command{
1515
Use: "disable",
1616
Short: "Disable the actuated service remotely.",
17+
Long: `Disable the systemd service named actuated on the remote server, this should
18+
only be used when decommissioning a host. It can only be re-enabled by logging in via
19+
SSH and running "systemctl enable actuated".`,
1720
Example: ` # Disable the actuated systemd service from restarting
1821
1922
actuated-cli disable --owner ORG HOST

cmd/jobs.go

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,27 @@ func makeJobs() *cobra.Command {
1919
cmd := &cobra.Command{
2020
Use: "jobs",
2121
Short: "List jobs in the build queue",
22-
Example: ` # Check queued and in_progress jobs for an organisation
22+
Long: `List the queued and in_progress jobs for a OWNER or leave the option off
23+
to see all your authorized organisations.
24+
25+
Troubleshooting:
26+
27+
Why may a job be "stuck" as queued?
28+
29+
You may have overloaded your runners so that jobs have been taken off the queue
30+
after to save thrashing. See also "actuated-cli repair"
31+
32+
Why may a job be showing as in_progress for days?
33+
34+
GitHub's API is often inconsistent, if you open the job page, you may see it's
35+
finished or cancelled, but still showing as running. This is a flaw in GitHub
36+
and they tend to clean these up periodically. We can mark it as hidden on our
37+
end if you reach out to support.
38+
`,
39+
Example: ` # Check queued and in_progress jobs for your authorized orgs
40+
actuated-cli jobs [--urls]
41+
42+
# See jobs for a specific organisation, if you have access to multiple:
2343
actuated-cli jobs ORG
2444
2545
# Get the same result, but in JSON format
@@ -33,9 +53,7 @@ func makeJobs() *cobra.Command {
3353
cmd.RunE = runJobsE
3454

3555
cmd.Flags().BoolP("verbose", "v", false, "Show additional columns in the output")
36-
3756
cmd.Flags().BoolP("json", "j", false, "Request output in JSON format")
38-
3957
cmd.Flags().BoolP("urls", "u", false, "In verbose mode, control whether to include URLs (URLs always shown in non-verbose mode)")
4058

4159
return cmd
@@ -106,7 +124,7 @@ func runJobsE(cmd *cobra.Command, args []string) error {
106124
if err := json.Unmarshal([]byte(res), &statuses); err != nil {
107125
return err
108126
}
109-
127+
110128
// In non-verbose mode, always show URLs
111129
// In verbose mode, respect the --urls flag
112130
showURL := !verbose || includeURL

cmd/logs.go

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,45 @@ func makeLogs() *cobra.Command {
1818
Long: `Fetch logs from a specific VM or a all VMs over a
1919
range of time.`,
2020

21-
Example: `# Logs from all VMs over the past 15 minutes
22-
actuated-cli logs --owner=OWNER --age=15m HOST
23-
24-
# Get the logs from a specific VM using its hostname as the --id
25-
actuated-cli logs --owner=OWNER --id=ID HOST
21+
Example: ` # Default to get logs from all VMs from past 15 mins
22+
actuated-cli logs --owner OWNER HOST
23+
24+
# Logs from all VMs over the past 1 hour
25+
actuated-cli logs --owner OWNER --age 1h HOST
26+
27+
# Get the logs from a specific VM using its hostname as the --id
28+
actuated-cli logs --owner OWNER --id ID HOST
2629
`,
2730
}
2831

2932
cmd.RunE = runLogsE
33+
cmd.PreRunE = preRunLogsE
34+
cmd.Aliases = []string{"vm-logs", "l"}
3035

3136
cmd.Flags().StringP("owner", "o", "", "List logs owned by this user")
3237
cmd.Flags().String("id", "", "ID variable for a specific runner VM hostname")
33-
cmd.Flags().DurationP("age", "a", time.Minute*15, "Age of logs to fetch")
38+
cmd.Flags().DurationP("age", "a", time.Minute*15, "Age of logs to fetch specified as a Go duration")
3439

3540
return cmd
3641
}
3742

38-
func runLogsE(cmd *cobra.Command, args []string) error {
43+
func preRunLogsE(cmd *cobra.Command, args []string) error {
3944
if len(args) < 1 {
4045
return fmt.Errorf("specify the host as an argument")
4146
}
47+
48+
ageChanged := cmd.Flags().Changed("age")
49+
idChanged := cmd.Flags().Changed("id")
50+
51+
if ageChanged && idChanged {
52+
return fmt.Errorf("--age can't be used with --id")
53+
}
54+
55+
return nil
56+
57+
}
58+
59+
func runLogsE(cmd *cobra.Command, args []string) error {
4260
host := strings.TrimSpace(args[0])
4361

4462
pat, err := getPat(cmd)

cmd/metering.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ func makeMetering() *cobra.Command {
1414
cmd := &cobra.Command{
1515
Use: "metering",
1616
Short: "Fetch metering from a VM",
17-
Long: `Fetch the metering snapshot from a specific VM.`,
17+
Long: `Fetch the metering snapshot from a specific VM generated by
18+
vmmeter. Note: this data is already collected on your behalf and appears under
19+
the "Profiling" tab in the actuated dashboard.`,
1820

1921
Example: `# Get the metering snapshot from a specific VM using its hostname as the --id
2022
actuated-cli metering --owner=OWNER --id=ID HOST

cmd/root.go

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,16 @@ func init() {
1515
root = &cobra.Command{
1616
Use: "actuated-cli",
1717
Short: "The official CLI for actuated",
18-
Long: `The actuated-cli is for customers and operators to query
19-
the status of jobs and servers.
18+
Long: `This CLI can be used to review and manage jobs, and the actuated
19+
agent installed on your servers.
2020
21-
Run "actuated-cli auth" to get a Personal Access Token from GitHub
21+
The --owner flag or OWNER argument is a GitHub organization, i.e. for the path:
22+
self-actuated/actuated-cli, the owner is "self-actuated" also known as an org.
2223
23-
See the project README on GitHub for more:
24+
Run "actuated-cli auth" to authenticate with GitHub.
2425
26+
Learn more:
27+
https://docs.actuated.com/tasks/cli/
2528
https://github.com/self-actuated/actuated-cli
2629
`,
2730
SilenceErrors: true,
@@ -39,24 +42,22 @@ https://github.com/self-actuated/actuated-cli
3942
return nil
4043
}
4144

45+
root.AddCommand(makeAuth())
46+
root.AddCommand(MakeVersion())
47+
root.AddCommand(makeSSH())
48+
4249
root.AddCommand(makeRunners())
4350
root.AddCommand(makeJobs())
4451
root.AddCommand(makeRepair())
45-
root.AddCommand(makeRestart())
52+
root.AddCommand(makeIncreases())
4653

54+
root.AddCommand(makeRestart())
4755
root.AddCommand(makeAgentLogs())
48-
root.AddCommand(makeLogs())
56+
root.AddCommand(makeDisableAgent())
4957
root.AddCommand(makeUpgrade())
50-
root.AddCommand(makeIncreases())
51-
52-
root.AddCommand(makeSSH())
53-
root.AddCommand(makeDisable())
54-
55-
root.AddCommand(makeAuth())
56-
root.AddCommand(MakeVersion())
58+
root.AddCommand(makeLogs())
5759

5860
root.AddCommand(makeController())
59-
6061
root.AddCommand(makeMetering())
6162
}
6263

cmd/ssh_connect.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"strconv"
1313
"strings"
1414

15-
"github.com/google/go-github/v52/github"
15+
"github.com/google/go-github/v76/github"
1616
"github.com/spf13/cobra"
1717
"golang.org/x/oauth2"
1818
)

cmd/ssh_ls.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"strconv"
1212
"time"
1313

14-
"github.com/google/go-github/v52/github"
14+
"github.com/google/go-github/v76/github"
1515
"github.com/olekukonko/tablewriter"
1616
"github.com/spf13/cobra"
1717
"golang.org/x/oauth2"

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
module github.com/self-actuated/actuated-cli
22

3-
go 1.22.0
3+
go 1.24.0
44

55
require (
66
github.com/docker/go-units v0.5.0
7-
github.com/google/go-github/v52 v52.0.0
7+
github.com/google/go-github/v76 v76.0.0
88
github.com/morikuni/aec v1.0.0
99
github.com/olekukonko/tablewriter v0.0.5
1010
github.com/spf13/cobra v1.8.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDD
1010
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
1111
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
1212
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
13-
github.com/google/go-github/v52 v52.0.0 h1:uyGWOY+jMQ8GVGSX8dkSwCzlehU3WfdxQ7GweO/JP7M=
14-
github.com/google/go-github/v52 v52.0.0/go.mod h1:WJV6VEEUPuMo5pXqqa2ZCZEdbQqua4zAk2MZTIo+m+4=
13+
github.com/google/go-github/v76 v76.0.0 h1:MCa9VQn+VG5GG7Y7BAkBvSRUN3o+QpaEOuZwFPJmdFA=
14+
github.com/google/go-github/v76 v76.0.0/go.mod h1:38+d/8pYDO4fBLYfBhXF5EKO0wA3UkXBjfmQapFsNCQ=
1515
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
1616
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
1717
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=

0 commit comments

Comments
 (0)