Skip to content

Commit

Permalink
autostop removal (#208)
Browse files Browse the repository at this point in the history
Co-authored-by: Alec Fong <alecfong1@gmail.com>
  • Loading branch information
tmonty12 and theFong authored Nov 13, 2024
1 parent 2aa89be commit 29b358a
Show file tree
Hide file tree
Showing 16 changed files with 0 additions and 4,260 deletions.
30 changes: 0 additions & 30 deletions bin/install-latest-linux.sh

This file was deleted.

24 changes: 0 additions & 24 deletions bin/install-latest.sh

This file was deleted.

52 changes: 0 additions & 52 deletions pkg/autostartconf/autostartconf.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,55 +236,3 @@ User=` + store.GetOSUser() + `
}
return nil
}

func NewBrevMonConfigure(
store AutoStartStore,
disableAutostop bool,
reportInterval string,
portToCheckTrafficOn string,
) DaemonConfigurer {
configFile := fmt.Sprintf(`[Unit]
Description=brevmon
After=network.target
[Service]
User=root
Type=exec
ExecStart=/usr/local/bin/brevmon %s
ExecReload=/usr/local/bin/brevmon %s
Restart=always
[Install]
WantedBy=default.target
`, portToCheckTrafficOn, portToCheckTrafficOn)
if disableAutostop {
configFile = fmt.Sprintf(`[Unit]
Description=brevmon
After=network.target
[Service]
User=root
Type=exec
ExecStart=/usr/local/bin/brevmon %s --disable-autostop --report-interval `+reportInterval+`
ExecReload=/usr/local/bin/brevmon %s --disable-autostop --report-interval `+reportInterval+`
Restart=always
[Install]
WantedBy=default.target
`, portToCheckTrafficOn, portToCheckTrafficOn)
}
return AptBinaryConfigurer{
LinuxSystemdConfigurer: LinuxSystemdConfigurer{
Store: store,
ValueConfigFile: configFile,
ServiceName: "brevmon.service",
ServiceType: "system",
},

URL: "https://s3.amazonaws.com/brevmon.brev.dev/brevmon.tar.gz",
Name: "brevmon",
aptDependencies: []string{
"libpcap-dev",
},
}
}
86 changes: 0 additions & 86 deletions pkg/cmd/autostop/autostop.go

This file was deleted.

34 changes: 0 additions & 34 deletions pkg/cmd/background/background.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,6 @@ type BackgroundStore interface {
CreateWorkspace(organizationID string, options *store.CreateWorkspacesOptions) (*entity.Workspace, error)
}

func DisableAutoStop(s BackgroundStore, workspaceID string) error {
isStoppable := false
_, err := s.ModifyWorkspace(workspaceID, &store.ModifyWorkspaceRequest{
IsStoppable: &isStoppable,
})
if err != nil {
return breverrors.WrapAndTrace(err)
}
return nil
}

func EnableAutoStop(s BackgroundStore, workspaceID string) error {
isStoppable := true
_, err := s.ModifyWorkspace(workspaceID, &store.ModifyWorkspaceRequest{
IsStoppable: &isStoppable,
})
if err != nil {
return breverrors.WrapAndTrace(err)
}
return nil
}

func NewCmdBackground(t *terminal.Terminal, s BackgroundStore) *cobra.Command {
cmd := &cobra.Command{
Annotations: map[string]string{"workspace": ""},
Expand Down Expand Up @@ -88,7 +66,6 @@ func NewCmdBackground(t *terminal.Terminal, s BackgroundStore) *cobra.Command {
log.Fatal(err)
}

checkAutoStop(s)
// Run the command in the background using nohup
c := exec.Command("nohup", "bash", "-c", command+">"+logsDir+"/log.txt 2>&1 &") // #nosec G204
err = c.Start()
Expand Down Expand Up @@ -133,17 +110,6 @@ func NewCmdBackground(t *terminal.Terminal, s BackgroundStore) *cobra.Command {
return cmd
}

func checkAutoStop(s BackgroundStore) {
wsID, err := s.GetCurrentWorkspaceID()
if err == nil && wsID != "" {
// Disable auto stop
err = DisableAutoStop(s, wsID)
if err != nil {
log.Fatal(err)
}
}
}

func pushBackgroundAnalytics(s BackgroundStore) error {
// Call analytics for open
userID := ""
Expand Down
51 changes: 0 additions & 51 deletions pkg/cmd/bmon/bmon.go

This file was deleted.

11 changes: 0 additions & 11 deletions pkg/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@ import (
"fmt"

"github.com/brevdev/brev-cli/pkg/auth"
"github.com/brevdev/brev-cli/pkg/cmd/autostop"
"github.com/brevdev/brev-cli/pkg/cmd/background"
"github.com/brevdev/brev-cli/pkg/cmd/bmon"
"github.com/brevdev/brev-cli/pkg/cmd/clipboard"
"github.com/brevdev/brev-cli/pkg/cmd/configureenvvars"
"github.com/brevdev/brev-cli/pkg/cmd/connect"
"github.com/brevdev/brev-cli/pkg/cmd/create"
"github.com/brevdev/brev-cli/pkg/cmd/delete"
"github.com/brevdev/brev-cli/pkg/cmd/envsetup"
"github.com/brevdev/brev-cli/pkg/cmd/envvars"
"github.com/brevdev/brev-cli/pkg/cmd/fu"
"github.com/brevdev/brev-cli/pkg/cmd/healthcheck"
Expand All @@ -29,7 +26,6 @@ import (
"github.com/brevdev/brev-cli/pkg/cmd/open"
"github.com/brevdev/brev-cli/pkg/cmd/org"
"github.com/brevdev/brev-cli/pkg/cmd/portforward"
"github.com/brevdev/brev-cli/pkg/cmd/postinstall"
"github.com/brevdev/brev-cli/pkg/cmd/profile"
"github.com/brevdev/brev-cli/pkg/cmd/proxy"
"github.com/brevdev/brev-cli/pkg/cmd/recreate"
Expand All @@ -48,7 +44,6 @@ import (
"github.com/brevdev/brev-cli/pkg/cmd/tasks"
"github.com/brevdev/brev-cli/pkg/cmd/test"
"github.com/brevdev/brev-cli/pkg/cmd/updatemodel"
"github.com/brevdev/brev-cli/pkg/cmd/upgrade"
"github.com/brevdev/brev-cli/pkg/cmd/workspacegroups"
"github.com/brevdev/brev-cli/pkg/cmd/writeconnectionevent"
"github.com/brevdev/brev-cli/pkg/config"
Expand Down Expand Up @@ -279,13 +274,7 @@ func createCmdTree(cmd *cobra.Command, t *terminal.Terminal, loginCmdStore *stor

cmd.AddCommand(setupworkspace.NewCmdSetupWorkspace(noLoginCmdStore))
cmd.AddCommand(recreate.NewCmdRecreate(t, loginCmdStore))
cmd.AddCommand(envsetup.NewCmdEnvSetup(loginCmdStore, loginAuth))
cmd.AddCommand(postinstall.NewCmdpostinstall(t, loginCmdStore))
cmd.AddCommand(postinstall.NewCMDOptimizeThis(t, loginCmdStore))
cmd.AddCommand(bmon.NewCmdbmon(t, loginCmdStore))
cmd.AddCommand(upgrade.NewCmdUpgrade(t, loginCmdStore))
cmd.AddCommand(writeconnectionevent.NewCmdwriteConnectionEvent(t, loginCmdStore))
cmd.AddCommand(autostop.NewCmdautostop(t, loginCmdStore))
cmd.AddCommand(updatemodel.NewCmdupdatemodel(t, loginCmdStore))
}

Expand Down
Loading

0 comments on commit 29b358a

Please sign in to comment.