Skip to content

Commit 3b29f51

Browse files
dploegerDennis Ploeger
authored andcommitted
feat: First beta version
1 parent 23d2dca commit 3b29f51

File tree

16 files changed

+2957
-1
lines changed

16 files changed

+2957
-1
lines changed

.github/workflows/build.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Build
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
jobs:
9+
10+
build:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
goos:
15+
- darwin
16+
- windows
17+
- linux
18+
goarch:
19+
- amd64
20+
- arm64
21+
22+
env:
23+
GOOS: ${{ matrix.goos }}
24+
GOARCH: ${{ matrix.goarch }}
25+
26+
steps:
27+
- uses: actions/checkout@v3
28+
29+
- name: Set up Go
30+
uses: actions/setup-go@v3
31+
with:
32+
go-version: 1.19
33+
34+
- name: Build
35+
run: go build -o ccmanager cmd/ccmanager.go
36+
37+
- name: Release file
38+
uses: djnicholson/[email protected]
39+
with:
40+
token: ${{ secrets.GITHUB_TOKEN }}
41+
release-name: ${{ github.event.release.name }}
42+
tag-name: ${{ github.event.release.tag_name }}
43+
asset-name: ccmanager-${{ matrix.goos }}-${{ matrix.goarch }}
44+
file: ccmanager

.github/workflows/test.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Test
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
- develop
8+
9+
jobs:
10+
11+
test:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
- name: Set up Go
16+
uses: actions/setup-go@v4
17+
with:
18+
go-version: "1.20"
19+
cache: false
20+
- name: Run golangci-lint
21+
uses: golangci/[email protected]

.golangci.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
run:
2+
timeout: 10m

README.md

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,49 @@
1-
# ccmanager - CloudControl instance manager
1+
# CCmanager ☁️ 🧰 📺 - CloudControl instance manager
2+
3+
If you're using [CloudControl](https://cloudcontrol.dodevops.io) to manage the infrastructure of multiple projects,
4+
switching between different projects can be cumbersome.
5+
6+
CCmanager is a TUI for managing multiple CloudControl instances. Currently, it expects that all instances are managed
7+
using docker-compose in one or multiple subdirectories.
8+
9+
[![asciicast](https://asciinema.org/a/1sNBj2v0xJLAD7H4mqK1hGHEt.svg)](https://asciinema.org/a/1sNBj2v0xJLAD7H4mqK1hGHEt)
10+
11+
## Requirements
12+
13+
The current implementation only supports Docker with the Docker Compose v2 API.
14+
15+
## Usage
16+
17+
If you're placing all docker-compose files under directories like `$HOME/CloudControl/project1`,
18+
`$HOME/CloudControl/project2`, you can set `CCMANAGER_BASEPATH` to `$HOME/CloudControl`.
19+
20+
If you're using multiple directories, `CCMANAGER_BASEPATH` supports a list of directories separated by `,`.
21+
22+
Afterwards, run CCmanager by placing the binary somewhere in your path and run
23+
24+
ccmanager
25+
26+
CCmanager will load and show you the status of all found instances. Select an instance and use these keyboard
27+
shortcuts:
28+
29+
- `enter`: Start a CloudControl shell
30+
- `c`: Open CloudControlCenter, the CloudControl status web interface
31+
- `L`: Show the log of the instance
32+
- `r`: Restart the instance
33+
- `d`: Stop the instance
34+
- `s`: Start the instance
35+
- `n`: Show an information screen about the instance
36+
37+
You can use `/` to filter the list of instances. For more shortcuts, press `h`.
38+
39+
## Development
40+
41+
CCmanager is based on [Go](https://go.dev),
42+
[Bubbletea](https://pkg.go.dev/github.com/charmbracelet/bubbletea),
43+
[Bubbles](https://pkg.go.dev/github.com/charmbracelet/bubbles),
44+
[Lipgloss](https://pkg.go.dev/github.com/charmbracelet/lipgloss).
45+
46+
The Docker adapter is based on the [official Docker Client API](https://pkg.go.dev/github.com/docker/docker/client)
47+
and [Docker Compose v2](https://pkg.go.dev/github.com/docker/compose/v2).
48+
49+
It adheres to the [Go standard project layout](https://github.com/golang-standards/project-layout).

cmd/ccmanager.go

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package main
2+
3+
// CCmanager - Cloud Control instance manager
4+
5+
import (
6+
"ccmanager/internal/adapters"
7+
"ccmanager/internal/models"
8+
"fmt"
9+
"github.com/akamensky/argparse"
10+
"github.com/charmbracelet/bubbles/list"
11+
tea "github.com/charmbracelet/bubbletea"
12+
"log"
13+
"os"
14+
"strings"
15+
)
16+
17+
func main() {
18+
parser := argparse.NewParser("ccmanager", "CloudControl instance manager")
19+
basePath := parser.StringList("b", "basepath", &argparse.Options{
20+
Help: "Paths where to find CloudControl docker compose folders. Can be set using a comma separated list in CCMANAGER_BASEPATH",
21+
Required: false,
22+
})
23+
24+
if err := parser.Parse(os.Args); err != nil {
25+
log.Fatal(parser.Usage(err))
26+
}
27+
28+
if len(*basePath) == 0 {
29+
if e, found := os.LookupEnv("CCMANAGER_BASEPATH"); found {
30+
*basePath = strings.Split(e, ",")
31+
}
32+
}
33+
34+
if len(*basePath) == 0 {
35+
log.Fatal(parser.Usage("No basepath given. Please use CCMANAGER_BASEPATH or the --basepath argument"))
36+
}
37+
38+
var items []list.Item
39+
40+
d := adapters.DockerAdapter{}
41+
42+
program := tea.NewProgram(models.NewMainModel(d, *basePath, items))
43+
if _, err := program.Run(); err != nil {
44+
fmt.Println("Error running program:", err)
45+
os.Exit(1)
46+
}
47+
}

go.mod

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
module ccmanager
2+
3+
go 1.20
4+
5+
replace (
6+
github.com/cucumber/godog => github.com/laurazard/godog v0.0.0-20220922095256-4c4b17abdae7
7+
k8s.io/api => k8s.io/api v0.22.4
8+
k8s.io/apimachinery => k8s.io/apimachinery v0.22.4
9+
k8s.io/client-go => k8s.io/client-go v0.22.4
10+
)
11+
12+
require (
13+
github.com/akamensky/argparse v1.4.0
14+
github.com/charmbracelet/bubbles v0.15.0
15+
github.com/charmbracelet/bubbletea v0.23.2
16+
github.com/charmbracelet/lipgloss v0.7.1
17+
github.com/compose-spec/compose-go v1.13.0
18+
github.com/docker/cli v23.0.1+incompatible
19+
github.com/docker/compose/v2 v2.16.0
20+
github.com/docker/docker v23.0.1+incompatible
21+
github.com/moby/term v0.0.0-20221205130635-1aeaba878587
22+
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8
23+
)
24+
25+
require (
26+
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230106234847-43070de90fa1 // indirect
27+
github.com/AlecAivazis/survey/v2 v2.3.6 // indirect
28+
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
29+
github.com/Microsoft/go-winio v0.6.0 // indirect
30+
github.com/atotto/clipboard v0.1.4 // indirect
31+
github.com/aws/aws-sdk-go-v2 v1.17.6 // indirect
32+
github.com/aws/aws-sdk-go-v2/config v1.18.17 // indirect
33+
github.com/aws/aws-sdk-go-v2/credentials v1.13.17 // indirect
34+
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.0 // indirect
35+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.30 // indirect
36+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.24 // indirect
37+
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.31 // indirect
38+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.24 // indirect
39+
github.com/aws/aws-sdk-go-v2/service/sso v1.12.5 // indirect
40+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.5 // indirect
41+
github.com/aws/aws-sdk-go-v2/service/sts v1.18.6 // indirect
42+
github.com/aws/smithy-go v1.13.5 // indirect
43+
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
44+
github.com/beorn7/perks v1.0.1 // indirect
45+
github.com/buger/goterm v1.0.4 // indirect
46+
github.com/cenkalti/backoff/v4 v4.2.0 // indirect
47+
github.com/cespare/xxhash/v2 v2.2.0 // indirect
48+
github.com/containerd/console v1.0.3 // indirect
49+
github.com/containerd/containerd v1.7.0 // indirect
50+
github.com/containerd/continuity v0.3.1-0.20230206214859-2a963a2f56e8 // indirect
51+
github.com/containerd/ttrpc v1.2.1 // indirect
52+
github.com/containerd/typeurl v1.0.2 // indirect
53+
github.com/containerd/typeurl/v2 v2.1.0 // indirect
54+
github.com/cyphar/filepath-securejoin v0.2.3 // indirect
55+
github.com/davecgh/go-spew v1.1.1 // indirect
56+
github.com/distribution/distribution/v3 v3.0.0-20230223072852-e5d5810851d1 // indirect
57+
github.com/docker/buildx v0.10.4 // indirect
58+
github.com/docker/distribution v2.8.1+incompatible // indirect
59+
github.com/docker/docker-credential-helpers v0.7.0 // indirect
60+
github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c // indirect
61+
github.com/docker/go-connections v0.4.0 // indirect
62+
github.com/docker/go-metrics v0.0.1 // indirect
63+
github.com/docker/go-units v0.5.0 // indirect
64+
github.com/erikgeiser/promptkit v0.8.0 // indirect
65+
github.com/felixge/httpsnoop v1.0.3 // indirect
66+
github.com/fvbommel/sortorder v1.0.2 // indirect
67+
github.com/go-logr/logr v1.2.3 // indirect
68+
github.com/go-logr/stdr v1.2.2 // indirect
69+
github.com/go-resty/resty/v2 v2.7.0 // indirect
70+
github.com/gofrs/flock v0.8.1 // indirect
71+
github.com/gogo/googleapis v1.4.1 // indirect
72+
github.com/gogo/protobuf v1.3.2 // indirect
73+
github.com/golang/mock v1.6.0 // indirect
74+
github.com/golang/protobuf v1.5.3 // indirect
75+
github.com/google/go-cmp v0.5.9 // indirect
76+
github.com/google/gofuzz v1.2.0 // indirect
77+
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
78+
github.com/googleapis/gnostic v0.5.5 // indirect
79+
github.com/gorilla/mux v1.8.0 // indirect
80+
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
81+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2 // indirect
82+
github.com/hashicorp/errwrap v1.1.0 // indirect
83+
github.com/hashicorp/go-multierror v1.1.1 // indirect
84+
github.com/hashicorp/go-version v1.6.0 // indirect
85+
github.com/imdario/mergo v0.3.13 // indirect
86+
github.com/inconshreveable/mousetrap v1.1.0 // indirect
87+
github.com/jonboulle/clockwork v0.3.1-0.20230117163003-a89700cec744 // indirect
88+
github.com/json-iterator/go v1.1.12 // indirect
89+
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
90+
github.com/klauspost/compress v1.16.3 // indirect
91+
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
92+
github.com/mattn/go-colorable v0.1.13 // indirect
93+
github.com/mattn/go-isatty v0.0.17 // indirect
94+
github.com/mattn/go-localereader v0.0.1 // indirect
95+
github.com/mattn/go-runewidth v0.0.14 // indirect
96+
github.com/mattn/go-shellwords v1.0.12 // indirect
97+
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
98+
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
99+
github.com/miekg/pkcs11 v1.1.1 // indirect
100+
github.com/mitchellh/mapstructure v1.5.0 // indirect
101+
github.com/moby/buildkit v0.11.4 // indirect
102+
github.com/moby/locker v1.0.1 // indirect
103+
github.com/moby/patternmatcher v0.5.0 // indirect
104+
github.com/moby/spdystream v0.2.0 // indirect
105+
github.com/moby/sys/mountinfo v0.6.2 // indirect
106+
github.com/moby/sys/sequential v0.5.0 // indirect
107+
github.com/moby/sys/signal v0.7.0 // indirect
108+
github.com/moby/sys/symlink v0.2.0 // indirect
109+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
110+
github.com/modern-go/reflect2 v1.0.2 // indirect
111+
github.com/morikuni/aec v1.0.0 // indirect
112+
github.com/muesli/ansi v0.0.0-20230307104941-78d3738a59f2 // indirect
113+
github.com/muesli/cancelreader v0.2.2 // indirect
114+
github.com/muesli/reflow v0.3.0 // indirect
115+
github.com/muesli/termenv v0.15.1 // indirect
116+
github.com/opencontainers/go-digest v1.0.0 // indirect
117+
github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b // indirect
118+
github.com/opencontainers/runc v1.1.4 // indirect
119+
github.com/pelletier/go-toml v1.9.5 // indirect
120+
github.com/pkg/errors v0.9.1 // indirect
121+
github.com/pmezard/go-difflib v1.0.0 // indirect
122+
github.com/prometheus/client_golang v1.14.0 // indirect
123+
github.com/prometheus/client_model v0.3.0 // indirect
124+
github.com/prometheus/common v0.42.0 // indirect
125+
github.com/prometheus/procfs v0.9.0 // indirect
126+
github.com/rivo/uniseg v0.4.4 // indirect
127+
github.com/sahilm/fuzzy v0.1.0 // indirect
128+
github.com/serialx/hashring v0.0.0-20200727003509-22c0c7ab6b1b // indirect
129+
github.com/sirupsen/logrus v1.9.0 // indirect
130+
github.com/spf13/cobra v1.6.1 // indirect
131+
github.com/spf13/pflag v1.0.5 // indirect
132+
github.com/stretchr/testify v1.8.2 // indirect
133+
github.com/theupdateframework/notary v0.7.0 // indirect
134+
github.com/thoas/go-funk v0.9.3 // indirect
135+
github.com/tilt-dev/fsnotify v1.4.8-0.20220602155310-fff9c274a375 // indirect
136+
github.com/tonistiigi/fsutil v0.0.0-20230214225802-a3696a2f1f27 // indirect
137+
github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea // indirect
138+
github.com/tonistiigi/vt100 v0.0.0-20210615222946-8066bb97264f // indirect
139+
github.com/weppos/publicsuffix-go v0.30.0 // indirect
140+
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
141+
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
142+
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
143+
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.40.0 // indirect
144+
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.40.0 // indirect
145+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.40.0 // indirect
146+
go.opentelemetry.io/otel v1.14.0 // indirect
147+
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 // indirect
148+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.14.0 // indirect
149+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.14.0 // indirect
150+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.14.0 // indirect
151+
go.opentelemetry.io/otel/metric v0.37.0 // indirect
152+
go.opentelemetry.io/otel/sdk v1.14.0 // indirect
153+
go.opentelemetry.io/otel/trace v1.14.0 // indirect
154+
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
155+
golang.org/x/crypto v0.7.0 // indirect
156+
golang.org/x/mod v0.9.0 // indirect
157+
golang.org/x/net v0.8.0 // indirect
158+
golang.org/x/oauth2 v0.6.0 // indirect
159+
golang.org/x/sync v0.1.0 // indirect
160+
golang.org/x/sys v0.6.0 // indirect
161+
golang.org/x/term v0.6.0 // indirect
162+
golang.org/x/text v0.8.0 // indirect
163+
golang.org/x/time v0.3.0 // indirect
164+
golang.org/x/tools v0.7.0 // indirect
165+
google.golang.org/appengine v1.6.7 // indirect
166+
google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect
167+
google.golang.org/grpc v1.53.0 // indirect
168+
google.golang.org/protobuf v1.29.1 // indirect
169+
gopkg.in/inf.v0 v0.9.1 // indirect
170+
gopkg.in/yaml.v2 v2.4.0 // indirect
171+
gopkg.in/yaml.v3 v3.0.1 // indirect
172+
k8s.io/api v0.26.2 // indirect
173+
k8s.io/apimachinery v0.26.2 // indirect
174+
k8s.io/client-go v0.26.2 // indirect
175+
k8s.io/klog/v2 v2.90.1 // indirect
176+
k8s.io/utils v0.0.0-20230313181309-38a27ef9d749 // indirect
177+
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
178+
sigs.k8s.io/yaml v1.3.0 // indirect
179+
)

0 commit comments

Comments
 (0)