Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Runtime #287

Merged
merged 42 commits into from
Jun 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
9b779aa
minimal runtime implementation
refs May 19, 2020
b2cece2
working runtime
refs May 20, 2020
29d8b1b
use master @ ocis-accounts, ocis-settings, ocis-proxy
refs May 22, 2020
1ef3792
use golangci-lint
refs May 22, 2020
a36fe74
add golangci.yaml
refs May 22, 2020
feca909
yaml -> yml
refs May 22, 2020
1932fa3
update runtime
refs May 23, 2020
7f23ef5
trigger ci
refs May 23, 2020
f508451
get rid of recursive call
refs May 24, 2020
38049e5
enforce more linters
refs May 24, 2020
2f98b83
update ocis-reva
refs May 25, 2020
6aeb3db
Merge branch 'master' into feature/pacman-runtime
refs May 25, 2020
5204ecf
delay dependant extensions from running
refs May 25, 2020
b39c3c3
update ocis reva
refs May 25, 2020
dae7379
update ocis-settings
refs May 25, 2020
24eadda
update ocis-reva
refs May 25, 2020
ebd29e0
downgrade ocis-reva to 2b94f09bfb33
refs May 25, 2020
7eb40ea
upgrade ocis-reva
refs May 25, 2020
75618cf
update ocis-reva@master
refs May 25, 2020
aa46e71
Merge branch 'master' into feature/pacman-runtime
refs May 27, 2020
b769ebe
update branch
refs May 27, 2020
80de0cd
update ocis-proxy
refs May 27, 2020
2f4c5e3
update refs/pman
refs May 27, 2020
b211f29
Merge branch 'master' into feature/pacman-runtime
refs Jun 2, 2020
76d77a9
use ocis-proxy@master
refs Jun 2, 2020
f9d67b6
remove untracked file
refs Jun 2, 2020
4c9b283
Merge branch 'master' into feature/pacman-runtime
refs Jun 2, 2020
ae8f49b
increate golangci-lint timeout to 30s
refs Jun 2, 2020
4c5d557
bring back staticcheck
refs Jun 2, 2020
8f3c88e
Merge branch 'master' into feature/pacman-runtime
refs Jun 2, 2020
19fc24a
address changes
refs Jun 4, 2020
c7310ae
get rid of micro/proxy
refs Jun 4, 2020
c61bbd7
restructure runtime code
refs Jun 4, 2020
a7f5c98
fix simple build (depends on ocis-hello PR)
refs Jun 4, 2020
2a5a1aa
remove replace
refs Jun 4, 2020
ca9bbd0
update ocis-settings@master
refs Jun 4, 2020
6abc81d
update ocis-hello@master
refs Jun 4, 2020
1cc12b0
add kill, list and run commands
refs Jun 4, 2020
0fa1ad4
Fix docblock of commands
kulmann Jun 4, 2020
92ea445
Return possible errors from runtime.Start instead of nil
kulmann Jun 4, 2020
01da4dd
Add changelog items
kulmann Jun 4, 2020
dbd8796
Merge branch 'master' into feature/pacman-runtime
refs Jun 8, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,6 @@ fmt:
vet:
go vet $(PACKAGES)

.PHONY: staticcheck
staticcheck:
go run honnef.co/go/tools/cmd/staticcheck -tags '$(TAGS)' $(PACKAGES)

.PHONY: lint
lint:
for PKG in $(PACKAGES); do go run golang.org/x/lint/golint -set_exit_status $$PKG || exit 1; done;
Expand Down Expand Up @@ -110,6 +106,10 @@ $(BIN)/$(EXECUTABLE)-debug: $(SOURCES)
$(BIN)/$(EXECUTABLE)-linux: $(SOURCES)
GOOS=linux GOARCH=amd64 $(GOBUILD) -v -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -gcflags '$(GCFLAGS)' -o $@ ./cmd/$(NAME)

.PHONY: staticcheck
staticcheck:
go run honnef.co/go/tools/cmd/staticcheck -tags '$(TAGS)' $(PACKAGES)

.PHONY: release
release: release-dirs release-linux release-windows release-darwin release-copy release-check

Expand Down
7 changes: 7 additions & 0 deletions changelog/unreleased/new-runtime.md
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
5 changes: 5 additions & 0 deletions changelog/unreleased/settings-service.md
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
26 changes: 17 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,39 @@ require (
github.com/bmatcuk/doublestar v1.3.0 // indirect
github.com/chzyer/logex v1.1.10 // indirect
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 // indirect
github.com/coreos/etcd v3.3.21+incompatible // indirect
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/go-log/log v0.2.0 // indirect
github.com/gogo/protobuf v1.3.1 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.12.1 // indirect
github.com/karrick/godirwalk v1.15.6 // indirect
github.com/labstack/echo v3.3.10+incompatible // indirect
github.com/labstack/gommon v0.3.0 // indirect
github.com/mattn/go-colorable v0.1.6 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/micro/cli/v2 v2.1.2-0.20200203150404-894195727d9c
github.com/micro/go-micro/v2 v2.0.1-0.20200212105717-d76baf59de2e
github.com/micro/micro/v2 v2.0.1-0.20200210100719-f38a1d8d5348
github.com/micro/cli/v2 v2.1.2
github.com/micro/go-micro/v2 v2.8.0
github.com/micro/micro/v2 v2.8.0
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/nsf/termbox-go v0.0.0-20200418040025-38ba6e5628f1 // indirect
github.com/openzipkin/zipkin-go v0.2.2
github.com/owncloud/flaex v0.2.0
github.com/owncloud/ocis-accounts v0.1.1
github.com/owncloud/ocis-accounts v0.1.2-0.20200522103104-a5d5eac711c1
github.com/owncloud/ocis-glauth v0.4.0
github.com/owncloud/ocis-graph v0.0.0-20200318175820-9a5a6e029db7
github.com/owncloud/ocis-graph-explorer v0.0.0-20200210111049-017eeb40dc0c
github.com/owncloud/ocis-hello v0.1.0-alpha1.0.20200207094758-c866cafca7e5
github.com/owncloud/ocis-hello v0.1.0-alpha1.0.20200604104641-f5d5d6bafa96
github.com/owncloud/ocis-konnectd v0.3.1
github.com/owncloud/ocis-migration v0.0.0-20200504185909-72274a4f1449
github.com/owncloud/ocis-migration v0.1.1-0.20200519133726-4c6b7daff23c
github.com/owncloud/ocis-ocs v0.0.0-20200318181133-cc66a0531da7
github.com/owncloud/ocis-phoenix v0.7.0
github.com/owncloud/ocis-pkg/v2 v2.2.1
github.com/owncloud/ocis-proxy v0.3.1
github.com/owncloud/ocis-pkg/v2 v2.2.2-0.20200527082518-5641fa4a4c8c
github.com/owncloud/ocis-proxy v0.3.2-0.20200529092045-bfe4790ab8cd
github.com/owncloud/ocis-reva v0.4.0
github.com/owncloud/ocis-settings v0.0.0-20200602115916-d10179c1aa59
github.com/owncloud/ocis-thumbnails v0.1.2
github.com/owncloud/ocis-webdav v0.1.0
github.com/refs/pman v0.0.0-20200527204655-c9ccd1c53cc3
github.com/restic/calens v0.2.0
github.com/valyala/fasttemplate v1.1.0 // indirect
go.opencensus.io v0.22.3
Expand All @@ -49,3 +55,5 @@ require (
)

replace google.golang.org/grpc => google.golang.org/grpc v1.26.0

replace github.com/lucas-clemente/quic-go v0.15.7 => github.com/lucas-clemente/quic-go v0.14.1
173 changes: 133 additions & 40 deletions go.sum

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions pkg/command/accounts.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !simple

package command

import (
Expand Down
2 changes: 1 addition & 1 deletion pkg/command/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func Health(cfg *config.Config) *cli.Command {

defer resp.Body.Close()

if resp.StatusCode != 200 {
if resp.StatusCode != http.StatusOK {
logger.Fatal().
Int("code", resp.StatusCode).
Msg("Health seems to be in bad state")
Expand Down
55 changes: 55 additions & 0 deletions pkg/command/kill.go
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)
}
55 changes: 55 additions & 0 deletions pkg/command/list.go
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)
}
2 changes: 2 additions & 0 deletions pkg/command/migration-import.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !simple

package command

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/command/proxy.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !simple

package command

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/command/reva-storage-public-link.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !simple

package command

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/command/revaauthbasic.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !simple

package command

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/command/revaauthbearer.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !simple

package command

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/command/revafrontend.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !simple

package command

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/command/revagateway.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !simple

package command

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/command/revasharing.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !simple

package command

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/command/revastorageeos.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !simple

package command

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/command/revastorageeosdata.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !simple

package command

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/command/revastoragehome.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !simple

package command

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/command/revastoragehomedata.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !simple

package command

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/command/revastorageoc.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !simple

package command

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/command/revastorageocdata.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !simple

package command

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/command/revastorageroot.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !simple

package command

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/command/revausers.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !simple

package command

import (
Expand Down
2 changes: 1 addition & 1 deletion pkg/command/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"github.com/owncloud/ocis-pkg/v2/log"
"github.com/owncloud/ocis/pkg/config"
"github.com/owncloud/ocis/pkg/flagset"
"github.com/owncloud/ocis/pkg/micro/runtime"
"github.com/owncloud/ocis/pkg/register"
"github.com/owncloud/ocis/pkg/runtime"
"github.com/owncloud/ocis/pkg/version"
)

Expand Down
57 changes: 57 additions & 0 deletions pkg/command/run.go
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)
}
Loading