to separate controll ower the http and grpc driven services

This commit is contained in:
Roman Perekhod
2025-05-20 23:41:26 +02:00
committed by Jörn Friedrich Dreyer
parent 65d05bbd5c
commit 9a3fc08dd4
44 changed files with 370 additions and 331 deletions

View File

@@ -85,8 +85,6 @@ type Service struct {
Log log.Logger
serviceToken map[string][]suture.ServiceToken
context context.Context
cancel context.CancelFunc
cfg *occfg.Config
}
@@ -108,16 +106,12 @@ func NewService(ctx context.Context, options ...Option) (*Service, error) {
log.Level(opts.Config.Log.Level),
)
globalCtx, cancelGlobal := context.WithCancel(ctx)
s := &Service{
Services: make([]serviceFuncMap, len(_waitFuncs)),
Additional: make(serviceFuncMap),
Log: l,
serviceToken: make(map[string][]suture.ServiceToken),
context: globalCtx,
cancel: cancelGlobal,
cfg: opts.Config,
}
@@ -362,8 +356,11 @@ func Start(ctx context.Context, o ...Option) error {
}
// cancel the context when a signal is received.
notifyCtx, cancel := signal.NotifyContext(ctx, runner.StopSignals...)
defer cancel()
var cancel context.CancelFunc
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
// tolerance controls backoff cycles from the supervisor.
tolerance := 5
@@ -416,12 +413,12 @@ func Start(ctx context.Context, o ...Option) error {
// prepare the set of services to run
s.generateRunSet(s.cfg)
// there are reasons not to do this, but we have race conditions ourselves. Until we resolve them, mind the following disclaimer:
// There are reasons not to do this, but we have race conditions ourselves. Until we resolve them, mind the following disclaimer:
// Calling ServeBackground will CORRECTLY start the supervisor running in a new goroutine. It is risky to directly run
// go supervisor.Serve()
// because that will briefly create a race condition as it starts up, if you try to .Add() services immediately afterward.
// https://pkg.go.dev/github.com/thejerf/suture/v4@v4.0.0#Supervisor
go s.Supervisor.ServeBackground(s.context) // TODO Why does Supervisor uses s.context?
go s.Supervisor.ServeBackground(ctx)
for i, service := range s.Services {
scheduleServiceTokens(s, service)
@@ -442,7 +439,7 @@ func Start(ctx context.Context, o ...Option) error {
}()
// trapShutdownCtx will block on the context-done channel for interruptions.
trapShutdownCtx(s, srv, notifyCtx)
trapShutdownCtx(s, srv, ctx)
return nil
}
@@ -516,8 +513,7 @@ func trapShutdownCtx(s *Service, srv *http.Server, ctx context.Context) {
wg.Add(1)
go func() {
defer wg.Done()
// TODO: To discuss the default timeout
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), runner.DefaultInterruptDuration)
defer cancel()
if err := srv.Shutdown(ctx); err != nil {
s.Log.Error().Err(err).Msg("could not shutdown tcp listener")
@@ -530,13 +526,12 @@ func trapShutdownCtx(s *Service, srv *http.Server, ctx context.Context) {
for i := range s.serviceToken[sName] {
wg.Add(1)
go func() {
s.Log.Warn().Msgf("=== RemoveAndWait for %s", sName)
s.Log.Warn().Msgf("call supervisor RemoveAndWait for %s", sName)
defer wg.Done()
// TODO: To discuss the default timeout
if err := s.Supervisor.RemoveAndWait(s.serviceToken[sName][i], 20*time.Second); err != nil && !errors.Is(err, suture.ErrSupervisorNotRunning) {
if err := s.Supervisor.RemoveAndWait(s.serviceToken[sName][i], runner.DefaultInterruptDuration); err != nil && !errors.Is(err, suture.ErrSupervisorNotRunning) {
s.Log.Error().Err(err).Str("service", sName).Msgf("terminating with signal: %+v", s)
}
s.Log.Warn().Msgf("=== Done RemoveAndWait for %s", sName)
s.Log.Warn().Msgf("done supervisor RemoveAndWait for %s", sName)
}()
}
}
@@ -548,8 +543,7 @@ func trapShutdownCtx(s *Service, srv *http.Server, ctx context.Context) {
}()
select {
// TODO: To discuss the default timeout
case <-time.After(30 * time.Second):
case <-time.After(runner.DefaultGroupInterruptDuration):
s.Log.Fatal().Msg("ocis graceful shutdown timeout reached, terminating")
case <-done:
s.Log.Info().Msg("all ocis services gracefully stopped")

View File

@@ -5,7 +5,6 @@ import (
"errors"
"net"
"net/http"
"time"
ogrpc "github.com/opencloud-eu/opencloud/pkg/service/grpc"
ohttp "github.com/opencloud-eu/opencloud/pkg/service/http"
@@ -102,9 +101,8 @@ func NewGolangHttpServerRunner(name string, server *http.Server, opts ...Option)
}, func() {
// Since Shutdown might take some time, don't block
go func() {
// give 5 secs for the shutdown to finish
// TODO: To discuss the default timeout
shutdownCtx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
// TODO: Provide the adjustable TimeoutDuration
shutdownCtx, cancel := context.WithTimeout(context.Background(), DefaultInterruptDuration)
defer cancel()
debugCh <- server.Shutdown(shutdownCtx)
@@ -135,6 +133,14 @@ func NewGolangGrpcServerRunner(name string, server *grpc.Server, listener net.Li
return r
}
// NewRevaServiceRunner creates a new runner based on the provided reva RevaDrivenServer
// The runner will behave as described:
// * The task is to start a server and listen for connections. If the server
// can't start, the task will finish with that error.
// * The stopper will call the server's stop method and send the result to
// the task.
// * The stopper will run asynchronously because the stop method could take a
// while and we don't want to block
func NewRevaServiceRunner(name string, server runtime.RevaDrivenServer, opts ...Option) *Runner {
httpCh := make(chan error, 1)
r := New(name, func() error {

View File

@@ -7,11 +7,9 @@ import (
var (
// DefaultInterruptDuration is the default value for the `WithInterruptDuration`
// for the "regular" runners. This global value can be adjusted if needed.
// TODO: To discuss the default timeout
DefaultInterruptDuration = 20 * time.Second
// DefaultGroupInterruptDuration is the default value for the `WithInterruptDuration`
// for the group runners. This global value can be adjusted if needed.
// TODO: To discuss the default timeout
DefaultGroupInterruptDuration = 25 * time.Second
)

View File

@@ -28,11 +28,11 @@ func Server(cfg *config.Config) *cli.Command {
},
Action: func(c *cli.Context) error {
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
logger := log.NewLogger(
log.Name(cfg.Service.Name),

View File

@@ -3,11 +3,8 @@ package command
import (
"context"
"fmt"
"os"
"os/signal"
"path"
"github.com/gofrs/uuid"
"github.com/opencloud-eu/reva/v2/cmd/revad/runtime"
"github.com/urfave/cli/v2"
@@ -40,26 +37,31 @@ func Server(cfg *config.Config) *cli.Command {
}
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
gr := runner.NewGroup()
{
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
// run the appropriate reva servers based on the config
rCfg := revaconfig.AppProviderConfigFromStruct(cfg)
reg := registry.GetRegistry()
revaSrv := runtime.RunDrivenServerWithOptions(rCfg, pidFile,
if rServer := runtime.NewDrivenHTTPServerWithOptions(rCfg,
runtime.WithLogger(&logger.Logger),
runtime.WithRegistry(reg),
runtime.WithRegistry(registry.GetRegistry()),
runtime.WithTraceProvider(traceProvider),
)
gr.Add(runner.NewRevaServiceRunner("app-provider_revad", revaSrv))
); rServer != nil {
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rhttp", rServer))
}
if rServer := runtime.NewDrivenGRPCServerWithOptions(rCfg,
runtime.WithLogger(&logger.Logger),
runtime.WithRegistry(registry.GetRegistry()),
runtime.WithTraceProvider(traceProvider),
); rServer != nil {
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rgrpc", rServer))
}
}
{

View File

@@ -3,11 +3,8 @@ package command
import (
"context"
"fmt"
"os"
"os/signal"
"path"
"github.com/gofrs/uuid"
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
"github.com/opencloud-eu/opencloud/pkg/registry"
"github.com/opencloud-eu/opencloud/pkg/runner"
@@ -39,27 +36,31 @@ func Server(cfg *config.Config) *cli.Command {
}
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
gr := runner.NewGroup()
{
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
// run the appropriate reva servers based on the config
rCfg := revaconfig.AppRegistryConfigFromStruct(cfg, logger)
reg := registry.GetRegistry()
revaSrv := runtime.RunDrivenServerWithOptions(rCfg, pidFile,
if rServer := runtime.NewDrivenHTTPServerWithOptions(rCfg,
runtime.WithLogger(&logger.Logger),
runtime.WithRegistry(reg),
runtime.WithRegistry(registry.GetRegistry()),
runtime.WithTraceProvider(traceProvider),
)
gr.Add(runner.NewRevaServiceRunner("app-registry_revad", revaSrv))
); rServer != nil {
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rhttp", rServer))
}
if rServer := runtime.NewDrivenGRPCServerWithOptions(rCfg,
runtime.WithLogger(&logger.Logger),
runtime.WithRegistry(registry.GetRegistry()),
runtime.WithTraceProvider(traceProvider),
); rServer != nil {
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rgrpc", rServer))
}
}
{

View File

@@ -31,11 +31,11 @@ func Server(cfg *config.Config) *cli.Command {
},
Action: func(c *cli.Context) error {
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
logger := logging.Configure(cfg.Service.Name, cfg.Log)
gr := runner.NewGroup()

View File

@@ -3,11 +3,8 @@ package command
import (
"context"
"fmt"
"os"
"os/signal"
"path"
"github.com/gofrs/uuid"
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
"github.com/opencloud-eu/opencloud/pkg/registry"
"github.com/opencloud-eu/opencloud/pkg/runner"
@@ -47,26 +44,30 @@ func Server(cfg *config.Config) *cli.Command {
}
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
gr := runner.NewGroup()
{
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
// run the appropriate reva servers based on the config
rCfg := revaconfig.AuthAppConfigFromStruct(cfg)
reg := registry.GetRegistry()
revaSrv := runtime.RunDrivenServerWithOptions(rCfg, pidFile,
if rServer := runtime.NewDrivenHTTPServerWithOptions(rCfg,
runtime.WithLogger(&logger.Logger),
runtime.WithRegistry(reg),
runtime.WithRegistry(registry.GetRegistry()),
runtime.WithTraceProvider(traceProvider),
)
gr.Add(runner.NewRevaServiceRunner("auth-app_revad", revaSrv))
); rServer != nil {
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rhttp", rServer))
}
if rServer := runtime.NewDrivenGRPCServerWithOptions(rCfg,
runtime.WithLogger(&logger.Logger),
runtime.WithRegistry(registry.GetRegistry()),
runtime.WithTraceProvider(traceProvider),
); rServer != nil {
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rgrpc", rServer))
}
}
{

View File

@@ -3,11 +3,8 @@ package command
import (
"context"
"fmt"
"os"
"os/signal"
"path"
"github.com/gofrs/uuid"
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
"github.com/opencloud-eu/opencloud/pkg/ldap"
"github.com/opencloud-eu/opencloud/pkg/registry"
@@ -40,11 +37,11 @@ func Server(cfg *config.Config) *cli.Command {
}
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
gr := runner.NewGroup()
@@ -61,16 +58,22 @@ func Server(cfg *config.Config) *cli.Command {
}
{
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
// run the appropriate reva servers based on the config
rCfg := revaconfig.AuthBasicConfigFromStruct(cfg)
reg := registry.GetRegistry()
revaSrv := runtime.RunDrivenServerWithOptions(rCfg, pidFile,
if rServer := runtime.NewDrivenHTTPServerWithOptions(rCfg,
runtime.WithLogger(&logger.Logger),
runtime.WithRegistry(reg),
runtime.WithRegistry(registry.GetRegistry()),
runtime.WithTraceProvider(traceProvider),
)
gr.Add(runner.NewRevaServiceRunner("auth-basic_revad", revaSrv))
); rServer != nil {
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rhttp", rServer))
}
if rServer := runtime.NewDrivenGRPCServerWithOptions(rCfg,
runtime.WithLogger(&logger.Logger),
runtime.WithRegistry(registry.GetRegistry()),
runtime.WithTraceProvider(traceProvider),
); rServer != nil {
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rgrpc", rServer))
}
}
{

View File

@@ -3,11 +3,8 @@ package command
import (
"context"
"fmt"
"os"
"os/signal"
"path"
"github.com/gofrs/uuid"
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
"github.com/opencloud-eu/opencloud/pkg/registry"
"github.com/opencloud-eu/opencloud/pkg/runner"
@@ -39,25 +36,31 @@ func Server(cfg *config.Config) *cli.Command {
}
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
gr := runner.NewGroup()
{
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
// run the appropriate reva servers based on the config
rCfg := revaconfig.AuthBearerConfigFromStruct(cfg)
reg := registry.GetRegistry()
revaSrv := runtime.RunDrivenServerWithOptions(rCfg, pidFile,
if rServer := runtime.NewDrivenHTTPServerWithOptions(rCfg,
runtime.WithLogger(&logger.Logger),
runtime.WithRegistry(reg),
runtime.WithRegistry(registry.GetRegistry()),
runtime.WithTraceProvider(traceProvider),
)
gr.Add(runner.NewRevaServiceRunner("auth-bearer_revad", revaSrv))
); rServer != nil {
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rhttp", rServer))
}
if rServer := runtime.NewDrivenGRPCServerWithOptions(rCfg,
runtime.WithLogger(&logger.Logger),
runtime.WithRegistry(registry.GetRegistry()),
runtime.WithTraceProvider(traceProvider),
); rServer != nil {
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rgrpc", rServer))
}
}
{

View File

@@ -3,11 +3,8 @@ package command
import (
"context"
"fmt"
"os"
"os/signal"
"path"
"github.com/gofrs/uuid"
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
"github.com/opencloud-eu/opencloud/pkg/registry"
"github.com/opencloud-eu/opencloud/pkg/runner"
@@ -39,25 +36,31 @@ func Server(cfg *config.Config) *cli.Command {
}
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
gr := runner.NewGroup()
{
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
// run the appropriate reva servers based on the config
rCfg := revaconfig.AuthMachineConfigFromStruct(cfg)
reg := registry.GetRegistry()
revaSrv := runtime.RunDrivenServerWithOptions(rCfg, pidFile,
if rServer := runtime.NewDrivenHTTPServerWithOptions(rCfg,
runtime.WithLogger(&logger.Logger),
runtime.WithRegistry(reg),
runtime.WithRegistry(registry.GetRegistry()),
runtime.WithTraceProvider(traceProvider),
)
gr.Add(runner.NewRevaServiceRunner("auth-machine_revad", revaSrv))
); rServer != nil {
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rhttp", rServer))
}
if rServer := runtime.NewDrivenGRPCServerWithOptions(rCfg,
runtime.WithLogger(&logger.Logger),
runtime.WithRegistry(registry.GetRegistry()),
runtime.WithTraceProvider(traceProvider),
); rServer != nil {
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rgrpc", rServer))
}
}
{

View File

@@ -3,11 +3,8 @@ package command
import (
"context"
"fmt"
"os"
"os/signal"
"path"
"github.com/gofrs/uuid"
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
"github.com/opencloud-eu/opencloud/pkg/registry"
"github.com/opencloud-eu/opencloud/pkg/runner"
@@ -39,25 +36,31 @@ func Server(cfg *config.Config) *cli.Command {
}
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
gr := runner.NewGroup()
{
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
reg := registry.GetRegistry()
rcfg := revaconfig.AuthMachineConfigFromStruct(cfg)
revaSrv := runtime.RunDrivenServerWithOptions(rcfg, pidFile,
// run the appropriate reva servers based on the config
rCfg := revaconfig.AuthMachineConfigFromStruct(cfg)
if rServer := runtime.NewDrivenHTTPServerWithOptions(rCfg,
runtime.WithLogger(&logger.Logger),
runtime.WithRegistry(reg),
runtime.WithRegistry(registry.GetRegistry()),
runtime.WithTraceProvider(traceProvider),
)
gr.Add(runner.NewRevaServiceRunner("auth-service_revad", revaSrv))
); rServer != nil {
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rhttp", rServer))
}
if rServer := runtime.NewDrivenGRPCServerWithOptions(rCfg,
runtime.WithLogger(&logger.Logger),
runtime.WithRegistry(registry.GetRegistry()),
runtime.WithTraceProvider(traceProvider),
); rServer != nil {
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rgrpc", rServer))
}
}
{

View File

@@ -63,11 +63,11 @@ func Server(cfg *config.Config) *cli.Command {
}
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
mtrcs := metrics.New()
mtrcs.BuildInfo.WithLabelValues(version.GetString()).Set(1)

View File

@@ -43,11 +43,11 @@ func Server(cfg *config.Config) *cli.Command {
}
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
// prepare components
if err := helpers.RegisterOpenCloudService(ctx, cfg, logger); err != nil {

View File

@@ -48,11 +48,11 @@ func Server(cfg *config.Config) *cli.Command {
}
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
m := metrics.New()
m.BuildInfo.WithLabelValues(version.GetString()).Set(1)

View File

@@ -3,11 +3,8 @@ package command
import (
"context"
"fmt"
"os"
"os/signal"
"path"
"github.com/gofrs/uuid"
"github.com/opencloud-eu/reva/v2/cmd/revad/runtime"
"github.com/urfave/cli/v2"
@@ -40,11 +37,11 @@ func Server(cfg *config.Config) *cli.Command {
}
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
gr := runner.NewGroup()
@@ -53,15 +50,22 @@ func Server(cfg *config.Config) *cli.Command {
if err != nil {
return err
}
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
reg := registry.GetRegistry()
revaSrv := runtime.RunDrivenServerWithOptions(rCfg, pidFile,
// run the appropriate reva servers based on the config
if rServer := runtime.NewDrivenHTTPServerWithOptions(rCfg,
runtime.WithLogger(&logger.Logger),
runtime.WithRegistry(reg),
runtime.WithRegistry(registry.GetRegistry()),
runtime.WithTraceProvider(traceProvider),
)
gr.Add(runner.NewRevaServiceRunner("frontend_revad", revaSrv))
); rServer != nil {
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rhttp", rServer))
}
if rServer := runtime.NewDrivenGRPCServerWithOptions(rCfg,
runtime.WithLogger(&logger.Logger),
runtime.WithRegistry(registry.GetRegistry()),
runtime.WithTraceProvider(traceProvider),
); rServer != nil {
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rgrpc", rServer))
}
}
{

View File

@@ -3,11 +3,8 @@ package command
import (
"context"
"fmt"
"os"
"os/signal"
"path"
"github.com/gofrs/uuid"
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
"github.com/opencloud-eu/opencloud/pkg/registry"
"github.com/opencloud-eu/opencloud/pkg/runner"
@@ -39,26 +36,31 @@ func Server(cfg *config.Config) *cli.Command {
}
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
gr := runner.NewGroup()
{
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
// run the appropriate reva servers based on the config
rCfg := revaconfig.GatewayConfigFromStruct(cfg, logger)
reg := registry.GetRegistry()
revaSrv := runtime.RunDrivenServerWithOptions(rCfg, pidFile,
if rServer := runtime.NewDrivenHTTPServerWithOptions(rCfg,
runtime.WithLogger(&logger.Logger),
runtime.WithRegistry(reg),
runtime.WithRegistry(registry.GetRegistry()),
runtime.WithTraceProvider(traceProvider),
)
gr.Add(runner.NewRevaServiceRunner("gateway_revad", revaSrv))
); rServer != nil {
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rhttp", rServer))
}
if rServer := runtime.NewDrivenGRPCServerWithOptions(rCfg,
runtime.WithLogger(&logger.Logger),
runtime.WithRegistry(registry.GetRegistry()),
runtime.WithTraceProvider(traceProvider),
); rServer != nil {
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rgrpc", rServer))
}
}
{

View File

@@ -35,11 +35,11 @@ func Server(cfg *config.Config) *cli.Command {
}
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
mtrcs := metrics.New()
mtrcs.BuildInfo.WithLabelValues(version.GetString()).Set(1)

View File

@@ -3,11 +3,8 @@ package command
import (
"context"
"fmt"
"os"
"os/signal"
"path"
"github.com/gofrs/uuid"
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
"github.com/opencloud-eu/opencloud/pkg/ldap"
"github.com/opencloud-eu/opencloud/pkg/registry"
@@ -52,26 +49,31 @@ func Server(cfg *config.Config) *cli.Command {
}
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
gr := runner.NewGroup()
{
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
// run the appropriate reva servers based on the config
rCfg := revaconfig.GroupsConfigFromStruct(cfg)
reg := registry.GetRegistry()
revaSrv := runtime.RunDrivenServerWithOptions(rCfg, pidFile,
if rServer := runtime.NewDrivenHTTPServerWithOptions(rCfg,
runtime.WithLogger(&logger.Logger),
runtime.WithRegistry(reg),
runtime.WithRegistry(registry.GetRegistry()),
runtime.WithTraceProvider(traceProvider),
)
gr.Add(runner.NewRevaServiceRunner("groups_revad", revaSrv))
); rServer != nil {
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rhttp", rServer))
}
if rServer := runtime.NewDrivenGRPCServerWithOptions(rCfg,
runtime.WithLogger(&logger.Logger),
runtime.WithRegistry(registry.GetRegistry()),
runtime.WithTraceProvider(traceProvider),
); rServer != nil {
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rgrpc", rServer))
}
}
{

View File

@@ -38,11 +38,11 @@ func Server(cfg *config.Config) *cli.Command {
},
Action: func(c *cli.Context) error {
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
logger := logging.Configure(cfg.Service.Name, cfg.Log)

View File

@@ -60,11 +60,11 @@ func Server(cfg *config.Config) *cli.Command {
}
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
metrics := metrics.New()
metrics.BuildInfo.WithLabelValues(version.GetString()).Set(1)

View File

@@ -36,11 +36,11 @@ func Server(cfg *config.Config) *cli.Command {
}
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
metrics := metrics.New(metrics.Logger(logger))
metrics.BuildInfo.WithLabelValues(version.GetString()).Set(1)

View File

@@ -31,11 +31,11 @@ func Server(cfg *config.Config) *cli.Command {
logger := logging.Configure(cfg.Service.Name, cfg.Log)
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
gr := runner.NewGroup()
{

View File

@@ -59,11 +59,11 @@ func Server(cfg *config.Config) *cli.Command {
}
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
gr := runner.NewGroup()
{

View File

@@ -38,11 +38,11 @@ func Server(cfg *config.Config) *cli.Command {
}
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
gr := runner.NewGroup()

View File

@@ -3,11 +3,8 @@ package command
import (
"context"
"fmt"
"os"
"os/signal"
"path"
"github.com/gofrs/uuid"
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
"github.com/opencloud-eu/opencloud/pkg/registry"
"github.com/opencloud-eu/opencloud/pkg/runner"
@@ -39,26 +36,31 @@ func Server(cfg *config.Config) *cli.Command {
}
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
gr := runner.NewGroup()
{
// run the appropriate reva servers based on the config
rCfg := revaconfig.OCMConfigFromStruct(cfg, logger)
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
reg := registry.GetRegistry()
revaSrv := runtime.RunDrivenServerWithOptions(rCfg, pidFile,
if rServer := runtime.NewDrivenHTTPServerWithOptions(rCfg,
runtime.WithLogger(&logger.Logger),
runtime.WithRegistry(reg),
runtime.WithRegistry(registry.GetRegistry()),
runtime.WithTraceProvider(traceProvider),
)
gr.Add(runner.NewRevaServiceRunner("ocm_revad", revaSrv))
); rServer != nil {
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rhttp", rServer))
}
if rServer := runtime.NewDrivenGRPCServerWithOptions(rCfg,
runtime.WithLogger(&logger.Logger),
runtime.WithRegistry(registry.GetRegistry()),
runtime.WithTraceProvider(traceProvider),
); rServer != nil {
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rgrpc", rServer))
}
}
{

View File

@@ -41,11 +41,11 @@ func Server(cfg *config.Config) *cli.Command {
}
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
metrics := metrics.New()
metrics.BuildInfo.WithLabelValues(version.GetString()).Set(1)

View File

@@ -35,11 +35,11 @@ func Server(cfg *config.Config) *cli.Command {
},
Action: func(c *cli.Context) error {
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
logger := log.NewLogger(
log.Name(cfg.Service.Name),

View File

@@ -37,11 +37,11 @@ func Server(cfg *config.Config) *cli.Command {
logger := logging.Configure(cfg.Service.Name, cfg.Log)
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
traceProvider, err := tracing.GetServiceTraceProvider(cfg.Tracing, cfg.Service.Name)
if err != nil {

View File

@@ -109,9 +109,8 @@ func Server(cfg *config.Config) *cli.Command {
)
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
@@ -192,7 +191,7 @@ func Server(cfg *config.Config) *cli.Command {
server, err := proxyHTTP.Server(
proxyHTTP.Handler(lh.Handler()),
proxyHTTP.Logger(logger),
proxyHTTP.Context(ctx),
proxyHTTP.Context(cfg.Context),
proxyHTTP.Config(cfg),
proxyHTTP.Metrics(metrics.New()),
proxyHTTP.Middlewares(middlewares),
@@ -212,7 +211,7 @@ func Server(cfg *config.Config) *cli.Command {
{
debugServer, err := debug.Server(
debug.Logger(logger),
debug.Context(ctx),
debug.Context(cfg.Context),
debug.Config(cfg),
)
if err != nil {
@@ -223,7 +222,7 @@ func Server(cfg *config.Config) *cli.Command {
gr.Add(runner.NewGolangHttpServerRunner("proxy_debug", debugServer))
}
grResults := gr.Run(ctx)
grResults := gr.Run(cfg.Context)
// return the first non-nil error found in the results
for _, grResult := range grResults {

View File

@@ -43,11 +43,11 @@ func Server(cfg *config.Config) *cli.Command {
}
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
mtrcs := metrics.New()
mtrcs.BuildInfo.WithLabelValues(version.GetString()).Set(1)

View File

@@ -44,11 +44,11 @@ func Server(cfg *config.Config) *cli.Command {
}
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
mtrcs := metrics.New()
mtrcs.BuildInfo.WithLabelValues(version.GetString()).Set(1)

View File

@@ -5,10 +5,8 @@ import (
"fmt"
"os"
"os/signal"
"path"
"path/filepath"
"github.com/gofrs/uuid"
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
"github.com/opencloud-eu/opencloud/pkg/registry"
"github.com/opencloud-eu/opencloud/pkg/runner"
@@ -52,29 +50,35 @@ func Server(cfg *config.Config) *cli.Command {
}
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
gr := runner.NewGroup()
{
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
rCfg, err := revaconfig.SharingConfigFromStruct(cfg, logger)
if err != nil {
return err
}
reg := registry.GetRegistry()
revaSrv := runtime.RunDrivenServerWithOptions(rCfg, pidFile,
// run the appropriate reva servers based on the config
if rServer := runtime.NewDrivenHTTPServerWithOptions(rCfg,
runtime.WithLogger(&logger.Logger),
runtime.WithRegistry(reg),
runtime.WithRegistry(registry.GetRegistry()),
runtime.WithTraceProvider(traceProvider),
)
gr.Add(runner.NewRevaServiceRunner("sharing_revad", revaSrv))
); rServer != nil {
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rhttp", rServer))
}
if rServer := runtime.NewDrivenGRPCServerWithOptions(rCfg,
runtime.WithLogger(&logger.Logger),
runtime.WithRegistry(registry.GetRegistry()),
runtime.WithTraceProvider(traceProvider),
); rServer != nil {
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rgrpc", rServer))
}
}
{

View File

@@ -36,11 +36,11 @@ func Server(cfg *config.Config) *cli.Command {
},
Action: func(c *cli.Context) error {
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
logger := log.NewLogger(
log.Name(cfg.Service.Name),

View File

@@ -3,11 +3,8 @@ package command
import (
"context"
"fmt"
"os"
"os/signal"
"path"
"github.com/gofrs/uuid"
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
"github.com/opencloud-eu/opencloud/pkg/registry"
"github.com/opencloud-eu/opencloud/pkg/runner"
@@ -39,26 +36,31 @@ func Server(cfg *config.Config) *cli.Command {
}
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
gr := runner.NewGroup()
{
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
// run the appropriate reva servers based on the config
rCfg := revaconfig.StoragePublicLinkConfigFromStruct(cfg)
reg := registry.GetRegistry()
revaSrv := runtime.RunDrivenServerWithOptions(rCfg, pidFile,
if rServer := runtime.NewDrivenHTTPServerWithOptions(rCfg,
runtime.WithLogger(&logger.Logger),
runtime.WithRegistry(reg),
runtime.WithRegistry(registry.GetRegistry()),
runtime.WithTraceProvider(traceProvider),
)
gr.Add(runner.NewRevaServiceRunner("storage-publiclink_revad", revaSrv))
); rServer != nil {
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rhttp", rServer))
}
if rServer := runtime.NewDrivenGRPCServerWithOptions(rCfg,
runtime.WithLogger(&logger.Logger),
runtime.WithRegistry(registry.GetRegistry()),
runtime.WithTraceProvider(traceProvider),
); rServer != nil {
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rgrpc", rServer))
}
}
{

View File

@@ -3,11 +3,8 @@ package command
import (
"context"
"fmt"
"os"
"os/signal"
"path"
"github.com/gofrs/uuid"
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
"github.com/opencloud-eu/opencloud/pkg/registry"
"github.com/opencloud-eu/opencloud/pkg/runner"
@@ -39,26 +36,31 @@ func Server(cfg *config.Config) *cli.Command {
}
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
gr := runner.NewGroup()
{
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
// run the appropriate reva servers based on the config
rCfg := revaconfig.StorageSharesConfigFromStruct(cfg)
reg := registry.GetRegistry()
revaSrv := runtime.RunDrivenServerWithOptions(rCfg, pidFile,
if rServer := runtime.NewDrivenHTTPServerWithOptions(rCfg,
runtime.WithLogger(&logger.Logger),
runtime.WithRegistry(reg),
runtime.WithRegistry(registry.GetRegistry()),
runtime.WithTraceProvider(traceProvider),
)
gr.Add(runner.NewRevaServiceRunner("storage-shares_revad", revaSrv))
); rServer != nil {
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rhttp", rServer))
}
if rServer := runtime.NewDrivenGRPCServerWithOptions(rCfg,
runtime.WithLogger(&logger.Logger),
runtime.WithRegistry(registry.GetRegistry()),
runtime.WithTraceProvider(traceProvider),
); rServer != nil {
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rgrpc", rServer))
}
}
{

View File

@@ -3,11 +3,8 @@ package command
import (
"context"
"fmt"
"os"
"os/signal"
"path"
"github.com/gofrs/uuid"
"github.com/opencloud-eu/reva/v2/cmd/revad/runtime"
"github.com/urfave/cli/v2"
@@ -40,26 +37,31 @@ func Server(cfg *config.Config) *cli.Command {
}
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
gr := runner.NewGroup()
{
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
// run the appropriate reva servers based on the config
rCfg := revaconfig.StorageSystemFromStruct(cfg)
reg := registry.GetRegistry()
revaSrv := runtime.RunDrivenServerWithOptions(rCfg, pidFile,
if rServer := runtime.NewDrivenHTTPServerWithOptions(rCfg,
runtime.WithLogger(&logger.Logger),
runtime.WithRegistry(reg),
runtime.WithRegistry(registry.GetRegistry()),
runtime.WithTraceProvider(traceProvider),
)
gr.Add(runner.NewRevaServiceRunner("storage-system_revad", revaSrv))
); rServer != nil {
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rhttp", rServer))
}
if rServer := runtime.NewDrivenGRPCServerWithOptions(rCfg,
runtime.WithLogger(&logger.Logger),
runtime.WithRegistry(registry.GetRegistry()),
runtime.WithTraceProvider(traceProvider),
); rServer != nil {
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rgrpc", rServer))
}
}
{

View File

@@ -3,11 +3,8 @@ package command
import (
"context"
"fmt"
"os"
"os/signal"
"path"
"github.com/gofrs/uuid"
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
"github.com/opencloud-eu/opencloud/pkg/registry"
"github.com/opencloud-eu/opencloud/pkg/runner"
@@ -41,25 +38,31 @@ func Server(cfg *config.Config) *cli.Command {
}
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
gr := runner.NewGroup()
{
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
// run the appropriate reva servers based on the config
rCfg := revaconfig.StorageUsersConfigFromStruct(cfg)
reg := registry.GetRegistry()
revaSrv := runtime.RunDrivenServerWithOptions(rCfg, pidFile,
if rServer := runtime.NewDrivenHTTPServerWithOptions(rCfg,
runtime.WithLogger(&logger.Logger),
runtime.WithRegistry(reg),
runtime.WithRegistry(registry.GetRegistry()),
runtime.WithTraceProvider(traceProvider),
)
gr.Add(runner.NewRevaServiceRunner("storage-users_revad", revaSrv))
); rServer != nil {
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rhttp", rServer))
}
if rServer := runtime.NewDrivenGRPCServerWithOptions(rCfg,
runtime.WithLogger(&logger.Logger),
runtime.WithRegistry(registry.GetRegistry()),
runtime.WithTraceProvider(traceProvider),
); rServer != nil {
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rgrpc", rServer))
}
}
{

View File

@@ -42,11 +42,11 @@ func Server(cfg *config.Config) *cli.Command {
}
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
m := metrics.New()
m.BuildInfo.WithLabelValues(version.GetString()).Set(1)

View File

@@ -71,11 +71,11 @@ func Server(cfg *config.Config) *cli.Command {
}
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
mtrcs := metrics.New()
mtrcs.BuildInfo.WithLabelValues(version.GetString()).Set(1)

View File

@@ -3,11 +3,8 @@ package command
import (
"context"
"fmt"
"os"
"os/signal"
"path"
"github.com/gofrs/uuid"
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
"github.com/opencloud-eu/opencloud/pkg/ldap"
"github.com/opencloud-eu/opencloud/pkg/registry"
@@ -52,25 +49,31 @@ func Server(cfg *config.Config) *cli.Command {
}
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
gr := runner.NewGroup()
{
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
// run the appropriate reva servers based on the config
rCfg := revaconfig.UsersConfigFromStruct(cfg)
reg := registry.GetRegistry()
revaSrv := runtime.RunDrivenServerWithOptions(rCfg, pidFile,
if rServer := runtime.NewDrivenHTTPServerWithOptions(rCfg,
runtime.WithLogger(&logger.Logger),
runtime.WithRegistry(reg),
runtime.WithRegistry(registry.GetRegistry()),
runtime.WithTraceProvider(traceProvider),
)
gr.Add(runner.NewRevaServiceRunner("users_revad", revaSrv))
); rServer != nil {
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rhttp", rServer))
}
if rServer := runtime.NewDrivenGRPCServerWithOptions(rCfg,
runtime.WithLogger(&logger.Logger),
runtime.WithRegistry(registry.GetRegistry()),
runtime.WithTraceProvider(traceProvider),
); rServer != nil {
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rgrpc", rServer))
}
}
{

View File

@@ -49,11 +49,11 @@ func Server(cfg *config.Config) *cli.Command {
}
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
m := metrics.New()

View File

@@ -43,11 +43,11 @@ func Server(cfg *config.Config) *cli.Command {
}
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
metrics := metrics.New()
metrics.BuildInfo.WithLabelValues(version.GetString()).Set(1)

View File

@@ -37,11 +37,11 @@ func Server(cfg *config.Config) *cli.Command {
}
var cancel context.CancelFunc
ctx := cfg.Context
if ctx == nil {
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
if cfg.Context == nil {
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
defer cancel()
}
ctx := cfg.Context
m := metrics.New(metrics.Logger(logger))
m.BuildInfo.WithLabelValues(version.GetString()).Set(1)