From a793a4d1e6ebbb9b5edfadfaba8a1c0103350746 Mon Sep 17 00:00:00 2001 From: Willy Kloucek Date: Mon, 9 May 2022 11:31:26 +0200 Subject: [PATCH] remove run and kill commands from the runtime --- ...change-remove-runtime-kill-run-commands.md | 10 ++++ ocis/pkg/command/kill.go | 55 ------------------ ocis/pkg/command/run.go | 56 ------------------- 3 files changed, 10 insertions(+), 111 deletions(-) create mode 100644 changelog/unreleased/change-remove-runtime-kill-run-commands.md delete mode 100644 ocis/pkg/command/kill.go delete mode 100644 ocis/pkg/command/run.go diff --git a/changelog/unreleased/change-remove-runtime-kill-run-commands.md b/changelog/unreleased/change-remove-runtime-kill-run-commands.md new file mode 100644 index 0000000000..84068ab38a --- /dev/null +++ b/changelog/unreleased/change-remove-runtime-kill-run-commands.md @@ -0,0 +1,10 @@ +Bugfix: Remove runtime kill and run commands + +We've removed the kill and run commands from the oCIS runtime. +If these dynamic capabilities are needed, one should switch to a full fledged +supervisor and start oCIS as individual services. + +If one wants to start a only a subset of services, this is still possible +by setting OCIS_RUN_EXTENSIONS. + +https://github.com/owncloud/ocis/pull/3740 diff --git a/ocis/pkg/command/kill.go b/ocis/pkg/command/kill.go deleted file mode 100644 index 27770ece2a..0000000000 --- a/ocis/pkg/command/kill.go +++ /dev/null @@ -1,55 +0,0 @@ -package command - -import ( - "fmt" - "log" - "net" - "net/rpc" - "os" - - "github.com/owncloud/ocis/v2/ocis-pkg/config" - "github.com/owncloud/ocis/v2/ocis/pkg/register" - "github.com/urfave/cli/v2" -) - -// KillCommand is the entrypoint for the kill command. -func KillCommand(cfg *config.Config) *cli.Command { - return &cli.Command{ - Name: "kill", - Usage: "kill an extension by name in the runtime (supervised mode)", - Category: "runtime", - Flags: []cli.Flag{ - &cli.StringFlag{ - Name: "hostname", - Value: "localhost", - EnvVars: []string{"OCIS_RUNTIME_HOST"}, - Destination: &cfg.Runtime.Host, - }, - &cli.StringFlag{ - Name: "port", - Value: "9250", - EnvVars: []string{"OCIS_RUNTIME_PORT"}, - Destination: &cfg.Runtime.Port, - }, - }, - Action: func(c *cli.Context) error { - client, err := rpc.DialHTTP("tcp", net.JoinHostPort(cfg.Runtime.Host, cfg.Runtime.Port)) - if err != nil { - log.Fatalf("Failed to connect to the runtime. Has the runtime been started and did you configure the right runtime address (\"%s\")", cfg.Runtime.Host+":"+cfg.Runtime.Port) - } - - var arg1 int - - if err := client.Call("Service.Kill", os.Args[2], &arg1); err != nil { - log.Fatal(err) - } - fmt.Printf("process %v terminated", os.Args[2]) - - return nil - }, - } -} - -func init() { - register.AddCommand(KillCommand) -} diff --git a/ocis/pkg/command/run.go b/ocis/pkg/command/run.go deleted file mode 100644 index d5e264f447..0000000000 --- a/ocis/pkg/command/run.go +++ /dev/null @@ -1,56 +0,0 @@ -package command - -import ( - "fmt" - "log" - "net" - "net/rpc" - "os" - - cli "github.com/urfave/cli/v2" - - "github.com/owncloud/ocis/v2/ocis-pkg/config" - "github.com/owncloud/ocis/v2/ocis/pkg/register" -) - -// RunCommand is the entrypoint for the run command. -func RunCommand(cfg *config.Config) *cli.Command { - return &cli.Command{ - Name: "run", - Usage: "run an extension by name in the runtime (supervised mode)", - Category: "runtime", - Flags: []cli.Flag{ - &cli.StringFlag{ - Name: "hostname", - Value: "localhost", - EnvVars: []string{"OCIS_RUNTIME_HOST"}, - Destination: &cfg.Runtime.Host, - }, - &cli.StringFlag{ - Name: "port", - Value: "9250", - EnvVars: []string{"OCIS_RUNTIME_PORT"}, - Destination: &cfg.Runtime.Port, - }, - }, - Action: func(c *cli.Context) error { - client, err := rpc.DialHTTP("tcp", net.JoinHostPort(cfg.Runtime.Host, cfg.Runtime.Port)) - if err != nil { - log.Fatalf("Failed to connect to the runtime. Has the runtime been started and did you configure the right runtime address (\"%s\")", cfg.Runtime.Host+":"+cfg.Runtime.Port) - } - - var reply int - - if err := client.Call("Service.Start", os.Args[2], &reply); err != nil { - log.Fatal(err) - } - fmt.Println(reply) - - return nil - }, - } -} - -func init() { - register.AddCommand(RunCommand) -}