Skip to content

Commit

Permalink
refactor: default command to container-metric
Browse files Browse the repository at this point in the history
  • Loading branch information
neurosnap committed Nov 20, 2024
1 parent a902725 commit 3c99785
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
fmt:
go fmt ./...
.PHONY: fmt

lint:
golangci-lint run -E goimports -E godot --timeout 10m
.PHONY: lint

test:
go test ./...
.PHONY: test
5 changes: 4 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ services:
ports:
- 8080:8080
labels:
pipemgr.enable: true
pipemgr.enable: false
depends_on:
pipemgr:
condition: service_healthy
6 changes: 4 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"github.com/docker/docker/api/types/events"
"github.com/docker/docker/client"
"github.com/picosh/utils/pipe"
"github.com/picosh/utils/pipe/metrics"
)

func createDockerClient() *client.Client {
Expand Down Expand Up @@ -85,6 +84,7 @@ func main() {
remoteUserFlag := flag.String("remote-user", "", "The remote user to connect as")
keyLocationFlag := flag.String("remote-key-location", "/key", "The location on the filesystem of where to access the ssh key")
keyPassphraseFlag := flag.String("remote-key-passphrase", "", "The passphrase for an encrypted ssh key")
command := flag.String("command", "pub container-drain -b=false", "The command to run for the remote session")

flag.Parse()

Expand Down Expand Up @@ -142,10 +142,12 @@ func main() {
}
ctx := context.Background()

reconn := metrics.RegisterReconnectMetricRecorder(
reconn := pipe.NewReconnectReadWriteCloser(
ctx,
rootLogger,
info,
"pipemgr",
*command,
100,
10*time.Millisecond,
)
Expand Down

0 comments on commit 3c99785

Please sign in to comment.