Files
opencloud/ocis/pkg/runtime
Florian Schade f38a9f4385 Introduce Policies-Service (#5716)
* add policies service
add policies proxy middleware
add policies event service
add policies grpc service
prepare ci and git environments (ci, make, readme, doc)

* add webfinger to the drone conf

* fix docs
remove not used virus scan postprocessing step

* relocate example rego file
implicitly enable and disable proxy and postprocessing policy checking by setting the query.
update configuration descriptions

* move policies
update readme

* use converter func to convert pp environment to actual environment
expose and test custom rego functions
add engine unit tests
add opa unit tests
update policies readme

Co-authored-by: Martin <github@diemattels.at>

* relocate sample policies to the deployments folder
change and document policies service port

* update index.md and small fix

* add health command
add version command
add debug server

---------

Co-authored-by: Martin <github@diemattels.at>
2023-03-14 16:08:22 +01:00
..
2022-05-04 14:49:59 +02:00
2022-07-09 12:45:02 -07:00
2022-05-04 14:49:59 +02:00

ownCloud Infinite Scale: Runtime

Pman is a slim utility library for supervising long-running processes. It can be embedded or used as a cli command.

When used as a CLI command it relays actions to a running runtime.

Usage

Start a runtime

package main
import "github.com/owncloud/ocis/ocis/pkg/runtime/service"

func main() {
    service.Start()
}

start runtime

Start sending messages message runtime

Example

package main

import (
	"fmt"
	"github.com/owncloud/ocis/ocis/pkg/runtime/process"
	"github.com/owncloud/ocis/ocis/pkg/runtime/service"
	"github.com/rs/zerolog/log"
	"os"
	"os/signal"
	"syscall"
	"time"
)

func main() {
	s := service.NewService()
	var c = make(chan os.Signal, 1)
	var o int

	signal.Notify(c, syscall.SIGINT, syscall.SIGTERM)
	if err := s.Start(process.NewProcEntry("ocs", nil, "ocs"), &o); err != nil {
		os.Exit(1)
	}

	time.AfterFunc(3*time.Second, func() {
		var acc = "ocs"
		fmt.Printf(fmt.Sprintf("shutting down service: %s", acc))
		if err := s.Controller.Kill(&acc); err != nil {
			log.Fatal()
		}
		os.Exit(0)
	})

	for {
		select {
		case <-c:
			return
		}
	}
}

Run the example above with RUNTIME_KEEP_ALIVE=true and with no RUNTIME_KEEP_ALIVE set to see its behavior. It requires an oCIS binary present in your $PATH for it to work.