-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #287 from owncloud/feature/pacman-runtime
- Loading branch information
Showing
37 changed files
with
608 additions
and
322 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Change: Switch over to a new custom-built runtime | ||
|
||
We moved away from using the go-micro runtime and are now using [our own runtime](https://github.com/refs/pman). | ||
This allows us to spawn service processes even when they are using different versions of go-micro. On top of that we | ||
now have the commands `ocis list`, `ocis kill` and `ocis run` available for service runtime management. | ||
|
||
https://github.com/owncloud/ocis/pull/287 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Change: Make ocis-settings available | ||
|
||
This version delivers `settings` as a new service. It is part of the array of services in the `server` command. | ||
|
||
https://github.com/owncloud/ocis/pull/287 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// +build !simple | ||
|
||
package command | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package command | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"net" | ||
"net/rpc" | ||
"os" | ||
|
||
"github.com/micro/cli/v2" | ||
"github.com/owncloud/ocis/pkg/config" | ||
"github.com/owncloud/ocis/pkg/register" | ||
) | ||
|
||
// 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", | ||
Category: "Runtime", | ||
Flags: []cli.Flag{ | ||
&cli.StringFlag{ | ||
Name: "hostname", | ||
Value: "localhost", | ||
EnvVars: []string{"OCIS_RUNTIME_HOSTNAME"}, | ||
Destination: &cfg.Runtime.Hostname, | ||
}, | ||
&cli.StringFlag{ | ||
Name: "port", | ||
Value: "10666", | ||
EnvVars: []string{"OCIS_RUNTIME_PORT"}, | ||
Destination: &cfg.Runtime.Port, | ||
}, | ||
}, | ||
Action: func(c *cli.Context) error { | ||
client, err := rpc.DialHTTP("tcp", net.JoinHostPort(cfg.Runtime.Hostname, cfg.Runtime.Port)) | ||
if err != nil { | ||
log.Fatal("dialing:", err) | ||
} | ||
|
||
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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package command | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"net" | ||
"net/rpc" | ||
|
||
"github.com/micro/cli/v2" | ||
"github.com/owncloud/ocis/pkg/config" | ||
"github.com/owncloud/ocis/pkg/register" | ||
) | ||
|
||
// ListCommand is the entrypoint for the list command. | ||
func ListCommand(cfg *config.Config) *cli.Command { | ||
return &cli.Command{ | ||
Name: "list", | ||
Usage: "Lists running ocis extensions", | ||
Category: "Runtime", | ||
Flags: []cli.Flag{ | ||
&cli.StringFlag{ | ||
Name: "hostname", | ||
Value: "localhost", | ||
EnvVars: []string{"OCIS_RUNTIME_HOSTNAME"}, | ||
Destination: &cfg.Runtime.Hostname, | ||
}, | ||
&cli.StringFlag{ | ||
Name: "port", | ||
Value: "10666", | ||
EnvVars: []string{"OCIS_RUNTIME_PORT"}, | ||
Destination: &cfg.Runtime.Port, | ||
}, | ||
}, | ||
Action: func(c *cli.Context) error { | ||
client, err := rpc.DialHTTP("tcp", net.JoinHostPort(cfg.Runtime.Hostname, cfg.Runtime.Port)) | ||
if err != nil { | ||
log.Fatal("dialing:", err) | ||
} | ||
|
||
var arg1 string | ||
|
||
if err := client.Call("Service.List", struct{}{}, &arg1); err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
fmt.Println(arg1) | ||
|
||
return nil | ||
}, | ||
} | ||
} | ||
|
||
func init() { | ||
register.AddCommand(ListCommand) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// +build !simple | ||
|
||
package command | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// +build !simple | ||
|
||
package command | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// +build !simple | ||
|
||
package command | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// +build !simple | ||
|
||
package command | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// +build !simple | ||
|
||
package command | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// +build !simple | ||
|
||
package command | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// +build !simple | ||
|
||
package command | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// +build !simple | ||
|
||
package command | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// +build !simple | ||
|
||
package command | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// +build !simple | ||
|
||
package command | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// +build !simple | ||
|
||
package command | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// +build !simple | ||
|
||
package command | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// +build !simple | ||
|
||
package command | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// +build !simple | ||
|
||
package command | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// +build !simple | ||
|
||
package command | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// +build !simple | ||
|
||
package command | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package command | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"net" | ||
"net/rpc" | ||
"os" | ||
|
||
"github.com/micro/cli/v2" | ||
"github.com/owncloud/ocis/pkg/config" | ||
"github.com/owncloud/ocis/pkg/register" | ||
"github.com/refs/pman/pkg/process" | ||
) | ||
|
||
// RunCommand is the entrypoint for the run command. | ||
func RunCommand(cfg *config.Config) *cli.Command { | ||
return &cli.Command{ | ||
Name: "run", | ||
Usage: "Runs an extension", | ||
Category: "Runtime", | ||
Flags: []cli.Flag{ | ||
&cli.StringFlag{ | ||
Name: "hostname", | ||
Value: "localhost", | ||
EnvVars: []string{"OCIS_RUNTIME_HOSTNAME"}, | ||
Destination: &cfg.Runtime.Hostname, | ||
}, | ||
&cli.StringFlag{ | ||
Name: "port", | ||
Value: "10666", | ||
EnvVars: []string{"OCIS_RUNTIME_PORT"}, | ||
Destination: &cfg.Runtime.Port, | ||
}, | ||
}, | ||
Action: func(c *cli.Context) error { | ||
client, err := rpc.DialHTTP("tcp", net.JoinHostPort(cfg.Runtime.Hostname, cfg.Runtime.Port)) | ||
if err != nil { | ||
log.Fatal("dialing:", err) | ||
} | ||
|
||
proc := process.NewProcEntry(os.Args[2], []string{os.Args[2]}...) | ||
var res int | ||
|
||
if err := client.Call("Service.Start", proc, &res); err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
fmt.Println(res) | ||
return nil | ||
}, | ||
} | ||
} | ||
|
||
func init() { | ||
register.AddCommand(RunCommand) | ||
} |
Oops, something went wrong.