to separate controll ower the http and grpc driven services
This commit is contained in:
committed by
Jörn Friedrich Dreyer
parent
65d05bbd5c
commit
9a3fc08dd4
@@ -85,8 +85,6 @@ type Service struct {
|
|||||||
Log log.Logger
|
Log log.Logger
|
||||||
|
|
||||||
serviceToken map[string][]suture.ServiceToken
|
serviceToken map[string][]suture.ServiceToken
|
||||||
context context.Context
|
|
||||||
cancel context.CancelFunc
|
|
||||||
cfg *occfg.Config
|
cfg *occfg.Config
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,16 +106,12 @@ func NewService(ctx context.Context, options ...Option) (*Service, error) {
|
|||||||
log.Level(opts.Config.Log.Level),
|
log.Level(opts.Config.Log.Level),
|
||||||
)
|
)
|
||||||
|
|
||||||
globalCtx, cancelGlobal := context.WithCancel(ctx)
|
|
||||||
|
|
||||||
s := &Service{
|
s := &Service{
|
||||||
Services: make([]serviceFuncMap, len(_waitFuncs)),
|
Services: make([]serviceFuncMap, len(_waitFuncs)),
|
||||||
Additional: make(serviceFuncMap),
|
Additional: make(serviceFuncMap),
|
||||||
Log: l,
|
Log: l,
|
||||||
|
|
||||||
serviceToken: make(map[string][]suture.ServiceToken),
|
serviceToken: make(map[string][]suture.ServiceToken),
|
||||||
context: globalCtx,
|
|
||||||
cancel: cancelGlobal,
|
|
||||||
cfg: opts.Config,
|
cfg: opts.Config,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -362,8 +356,11 @@ func Start(ctx context.Context, o ...Option) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// cancel the context when a signal is received.
|
// cancel the context when a signal is received.
|
||||||
notifyCtx, cancel := signal.NotifyContext(ctx, runner.StopSignals...)
|
var cancel context.CancelFunc
|
||||||
defer cancel()
|
if ctx == nil {
|
||||||
|
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
|
defer cancel()
|
||||||
|
}
|
||||||
|
|
||||||
// tolerance controls backoff cycles from the supervisor.
|
// tolerance controls backoff cycles from the supervisor.
|
||||||
tolerance := 5
|
tolerance := 5
|
||||||
@@ -416,12 +413,12 @@ func Start(ctx context.Context, o ...Option) error {
|
|||||||
// prepare the set of services to run
|
// prepare the set of services to run
|
||||||
s.generateRunSet(s.cfg)
|
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
|
// Calling ServeBackground will CORRECTLY start the supervisor running in a new goroutine. It is risky to directly run
|
||||||
// go supervisor.Serve()
|
// go supervisor.Serve()
|
||||||
// because that will briefly create a race condition as it starts up, if you try to .Add() services immediately afterward.
|
// 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
|
// 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 {
|
for i, service := range s.Services {
|
||||||
scheduleServiceTokens(s, service)
|
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 will block on the context-done channel for interruptions.
|
||||||
trapShutdownCtx(s, srv, notifyCtx)
|
trapShutdownCtx(s, srv, ctx)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -516,8 +513,7 @@ func trapShutdownCtx(s *Service, srv *http.Server, ctx context.Context) {
|
|||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
// TODO: To discuss the default timeout
|
ctx, cancel := context.WithTimeout(context.Background(), runner.DefaultInterruptDuration)
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
if err := srv.Shutdown(ctx); err != nil {
|
if err := srv.Shutdown(ctx); err != nil {
|
||||||
s.Log.Error().Err(err).Msg("could not shutdown tcp listener")
|
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] {
|
for i := range s.serviceToken[sName] {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
s.Log.Warn().Msgf("=== RemoveAndWait for %s", sName)
|
s.Log.Warn().Msgf("call supervisor RemoveAndWait for %s", sName)
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
// TODO: To discuss the default timeout
|
if err := s.Supervisor.RemoveAndWait(s.serviceToken[sName][i], runner.DefaultInterruptDuration); err != nil && !errors.Is(err, suture.ErrSupervisorNotRunning) {
|
||||||
if err := s.Supervisor.RemoveAndWait(s.serviceToken[sName][i], 20*time.Second); err != nil && !errors.Is(err, suture.ErrSupervisorNotRunning) {
|
|
||||||
s.Log.Error().Err(err).Str("service", sName).Msgf("terminating with signal: %+v", s)
|
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 {
|
select {
|
||||||
// TODO: To discuss the default timeout
|
case <-time.After(runner.DefaultGroupInterruptDuration):
|
||||||
case <-time.After(30 * time.Second):
|
|
||||||
s.Log.Fatal().Msg("ocis graceful shutdown timeout reached, terminating")
|
s.Log.Fatal().Msg("ocis graceful shutdown timeout reached, terminating")
|
||||||
case <-done:
|
case <-done:
|
||||||
s.Log.Info().Msg("all ocis services gracefully stopped")
|
s.Log.Info().Msg("all ocis services gracefully stopped")
|
||||||
|
|||||||
+10
-4
@@ -5,7 +5,6 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
|
||||||
|
|
||||||
ogrpc "github.com/opencloud-eu/opencloud/pkg/service/grpc"
|
ogrpc "github.com/opencloud-eu/opencloud/pkg/service/grpc"
|
||||||
ohttp "github.com/opencloud-eu/opencloud/pkg/service/http"
|
ohttp "github.com/opencloud-eu/opencloud/pkg/service/http"
|
||||||
@@ -102,9 +101,8 @@ func NewGolangHttpServerRunner(name string, server *http.Server, opts ...Option)
|
|||||||
}, func() {
|
}, func() {
|
||||||
// Since Shutdown might take some time, don't block
|
// Since Shutdown might take some time, don't block
|
||||||
go func() {
|
go func() {
|
||||||
// give 5 secs for the shutdown to finish
|
// TODO: Provide the adjustable TimeoutDuration
|
||||||
// TODO: To discuss the default timeout
|
shutdownCtx, cancel := context.WithTimeout(context.Background(), DefaultInterruptDuration)
|
||||||
shutdownCtx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
debugCh <- server.Shutdown(shutdownCtx)
|
debugCh <- server.Shutdown(shutdownCtx)
|
||||||
@@ -135,6 +133,14 @@ func NewGolangGrpcServerRunner(name string, server *grpc.Server, listener net.Li
|
|||||||
return r
|
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 {
|
func NewRevaServiceRunner(name string, server runtime.RevaDrivenServer, opts ...Option) *Runner {
|
||||||
httpCh := make(chan error, 1)
|
httpCh := make(chan error, 1)
|
||||||
r := New(name, func() error {
|
r := New(name, func() error {
|
||||||
|
|||||||
@@ -7,11 +7,9 @@ import (
|
|||||||
var (
|
var (
|
||||||
// DefaultInterruptDuration is the default value for the `WithInterruptDuration`
|
// DefaultInterruptDuration is the default value for the `WithInterruptDuration`
|
||||||
// for the "regular" runners. This global value can be adjusted if needed.
|
// for the "regular" runners. This global value can be adjusted if needed.
|
||||||
// TODO: To discuss the default timeout
|
|
||||||
DefaultInterruptDuration = 20 * time.Second
|
DefaultInterruptDuration = 20 * time.Second
|
||||||
// DefaultGroupInterruptDuration is the default value for the `WithInterruptDuration`
|
// DefaultGroupInterruptDuration is the default value for the `WithInterruptDuration`
|
||||||
// for the group runners. This global value can be adjusted if needed.
|
// for the group runners. This global value can be adjusted if needed.
|
||||||
// TODO: To discuss the default timeout
|
|
||||||
DefaultGroupInterruptDuration = 25 * time.Second
|
DefaultGroupInterruptDuration = 25 * time.Second
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -28,11 +28,11 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
},
|
},
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
logger := log.NewLogger(
|
logger := log.NewLogger(
|
||||||
log.Name(cfg.Service.Name),
|
log.Name(cfg.Service.Name),
|
||||||
|
|||||||
@@ -3,11 +3,8 @@ package command
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"path"
|
|
||||||
|
|
||||||
"github.com/gofrs/uuid"
|
|
||||||
"github.com/opencloud-eu/reva/v2/cmd/revad/runtime"
|
"github.com/opencloud-eu/reva/v2/cmd/revad/runtime"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
|
|
||||||
@@ -40,26 +37,31 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
gr := runner.NewGroup()
|
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)
|
rCfg := revaconfig.AppProviderConfigFromStruct(cfg)
|
||||||
reg := registry.GetRegistry()
|
if rServer := runtime.NewDrivenHTTPServerWithOptions(rCfg,
|
||||||
|
|
||||||
revaSrv := runtime.RunDrivenServerWithOptions(rCfg, pidFile,
|
|
||||||
runtime.WithLogger(&logger.Logger),
|
runtime.WithLogger(&logger.Logger),
|
||||||
runtime.WithRegistry(reg),
|
runtime.WithRegistry(registry.GetRegistry()),
|
||||||
runtime.WithTraceProvider(traceProvider),
|
runtime.WithTraceProvider(traceProvider),
|
||||||
)
|
); rServer != nil {
|
||||||
|
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rhttp", rServer))
|
||||||
gr.Add(runner.NewRevaServiceRunner("app-provider_revad", revaSrv))
|
}
|
||||||
|
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))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,11 +3,8 @@ package command
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"path"
|
|
||||||
|
|
||||||
"github.com/gofrs/uuid"
|
|
||||||
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
|
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
|
||||||
"github.com/opencloud-eu/opencloud/pkg/registry"
|
"github.com/opencloud-eu/opencloud/pkg/registry"
|
||||||
"github.com/opencloud-eu/opencloud/pkg/runner"
|
"github.com/opencloud-eu/opencloud/pkg/runner"
|
||||||
@@ -39,27 +36,31 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
gr := runner.NewGroup()
|
gr := runner.NewGroup()
|
||||||
|
|
||||||
{
|
{
|
||||||
|
// run the appropriate reva servers based on the config
|
||||||
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
|
|
||||||
rCfg := revaconfig.AppRegistryConfigFromStruct(cfg, logger)
|
rCfg := revaconfig.AppRegistryConfigFromStruct(cfg, logger)
|
||||||
reg := registry.GetRegistry()
|
if rServer := runtime.NewDrivenHTTPServerWithOptions(rCfg,
|
||||||
|
|
||||||
revaSrv := runtime.RunDrivenServerWithOptions(rCfg, pidFile,
|
|
||||||
runtime.WithLogger(&logger.Logger),
|
runtime.WithLogger(&logger.Logger),
|
||||||
runtime.WithRegistry(reg),
|
runtime.WithRegistry(registry.GetRegistry()),
|
||||||
runtime.WithTraceProvider(traceProvider),
|
runtime.WithTraceProvider(traceProvider),
|
||||||
)
|
); rServer != nil {
|
||||||
|
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rhttp", rServer))
|
||||||
gr.Add(runner.NewRevaServiceRunner("app-registry_revad", revaSrv))
|
}
|
||||||
|
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))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -31,11 +31,11 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
},
|
},
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
logger := logging.Configure(cfg.Service.Name, cfg.Log)
|
logger := logging.Configure(cfg.Service.Name, cfg.Log)
|
||||||
gr := runner.NewGroup()
|
gr := runner.NewGroup()
|
||||||
|
|||||||
@@ -3,11 +3,8 @@ package command
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"path"
|
|
||||||
|
|
||||||
"github.com/gofrs/uuid"
|
|
||||||
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
|
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
|
||||||
"github.com/opencloud-eu/opencloud/pkg/registry"
|
"github.com/opencloud-eu/opencloud/pkg/registry"
|
||||||
"github.com/opencloud-eu/opencloud/pkg/runner"
|
"github.com/opencloud-eu/opencloud/pkg/runner"
|
||||||
@@ -47,26 +44,30 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
gr := runner.NewGroup()
|
gr := runner.NewGroup()
|
||||||
{
|
{
|
||||||
|
// run the appropriate reva servers based on the config
|
||||||
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
|
|
||||||
rCfg := revaconfig.AuthAppConfigFromStruct(cfg)
|
rCfg := revaconfig.AuthAppConfigFromStruct(cfg)
|
||||||
reg := registry.GetRegistry()
|
if rServer := runtime.NewDrivenHTTPServerWithOptions(rCfg,
|
||||||
|
|
||||||
revaSrv := runtime.RunDrivenServerWithOptions(rCfg, pidFile,
|
|
||||||
runtime.WithLogger(&logger.Logger),
|
runtime.WithLogger(&logger.Logger),
|
||||||
runtime.WithRegistry(reg),
|
runtime.WithRegistry(registry.GetRegistry()),
|
||||||
runtime.WithTraceProvider(traceProvider),
|
runtime.WithTraceProvider(traceProvider),
|
||||||
)
|
); rServer != nil {
|
||||||
gr.Add(runner.NewRevaServiceRunner("auth-app_revad", revaSrv))
|
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))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,11 +3,8 @@ package command
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"path"
|
|
||||||
|
|
||||||
"github.com/gofrs/uuid"
|
|
||||||
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
|
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
|
||||||
"github.com/opencloud-eu/opencloud/pkg/ldap"
|
"github.com/opencloud-eu/opencloud/pkg/ldap"
|
||||||
"github.com/opencloud-eu/opencloud/pkg/registry"
|
"github.com/opencloud-eu/opencloud/pkg/registry"
|
||||||
@@ -40,11 +37,11 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
gr := runner.NewGroup()
|
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)
|
rCfg := revaconfig.AuthBasicConfigFromStruct(cfg)
|
||||||
reg := registry.GetRegistry()
|
if rServer := runtime.NewDrivenHTTPServerWithOptions(rCfg,
|
||||||
|
|
||||||
revaSrv := runtime.RunDrivenServerWithOptions(rCfg, pidFile,
|
|
||||||
runtime.WithLogger(&logger.Logger),
|
runtime.WithLogger(&logger.Logger),
|
||||||
runtime.WithRegistry(reg),
|
runtime.WithRegistry(registry.GetRegistry()),
|
||||||
runtime.WithTraceProvider(traceProvider),
|
runtime.WithTraceProvider(traceProvider),
|
||||||
)
|
); rServer != nil {
|
||||||
gr.Add(runner.NewRevaServiceRunner("auth-basic_revad", revaSrv))
|
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))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,11 +3,8 @@ package command
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"path"
|
|
||||||
|
|
||||||
"github.com/gofrs/uuid"
|
|
||||||
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
|
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
|
||||||
"github.com/opencloud-eu/opencloud/pkg/registry"
|
"github.com/opencloud-eu/opencloud/pkg/registry"
|
||||||
"github.com/opencloud-eu/opencloud/pkg/runner"
|
"github.com/opencloud-eu/opencloud/pkg/runner"
|
||||||
@@ -39,25 +36,31 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
gr := runner.NewGroup()
|
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)
|
rCfg := revaconfig.AuthBearerConfigFromStruct(cfg)
|
||||||
reg := registry.GetRegistry()
|
if rServer := runtime.NewDrivenHTTPServerWithOptions(rCfg,
|
||||||
|
|
||||||
revaSrv := runtime.RunDrivenServerWithOptions(rCfg, pidFile,
|
|
||||||
runtime.WithLogger(&logger.Logger),
|
runtime.WithLogger(&logger.Logger),
|
||||||
runtime.WithRegistry(reg),
|
runtime.WithRegistry(registry.GetRegistry()),
|
||||||
runtime.WithTraceProvider(traceProvider),
|
runtime.WithTraceProvider(traceProvider),
|
||||||
)
|
); rServer != nil {
|
||||||
gr.Add(runner.NewRevaServiceRunner("auth-bearer_revad", revaSrv))
|
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))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,11 +3,8 @@ package command
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"path"
|
|
||||||
|
|
||||||
"github.com/gofrs/uuid"
|
|
||||||
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
|
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
|
||||||
"github.com/opencloud-eu/opencloud/pkg/registry"
|
"github.com/opencloud-eu/opencloud/pkg/registry"
|
||||||
"github.com/opencloud-eu/opencloud/pkg/runner"
|
"github.com/opencloud-eu/opencloud/pkg/runner"
|
||||||
@@ -39,25 +36,31 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
gr := runner.NewGroup()
|
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)
|
rCfg := revaconfig.AuthMachineConfigFromStruct(cfg)
|
||||||
reg := registry.GetRegistry()
|
if rServer := runtime.NewDrivenHTTPServerWithOptions(rCfg,
|
||||||
|
|
||||||
revaSrv := runtime.RunDrivenServerWithOptions(rCfg, pidFile,
|
|
||||||
runtime.WithLogger(&logger.Logger),
|
runtime.WithLogger(&logger.Logger),
|
||||||
runtime.WithRegistry(reg),
|
runtime.WithRegistry(registry.GetRegistry()),
|
||||||
runtime.WithTraceProvider(traceProvider),
|
runtime.WithTraceProvider(traceProvider),
|
||||||
)
|
); rServer != nil {
|
||||||
gr.Add(runner.NewRevaServiceRunner("auth-machine_revad", revaSrv))
|
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))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,11 +3,8 @@ package command
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"path"
|
|
||||||
|
|
||||||
"github.com/gofrs/uuid"
|
|
||||||
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
|
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
|
||||||
"github.com/opencloud-eu/opencloud/pkg/registry"
|
"github.com/opencloud-eu/opencloud/pkg/registry"
|
||||||
"github.com/opencloud-eu/opencloud/pkg/runner"
|
"github.com/opencloud-eu/opencloud/pkg/runner"
|
||||||
@@ -39,25 +36,31 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
gr := runner.NewGroup()
|
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
|
||||||
reg := registry.GetRegistry()
|
rCfg := revaconfig.AuthMachineConfigFromStruct(cfg)
|
||||||
rcfg := revaconfig.AuthMachineConfigFromStruct(cfg)
|
if rServer := runtime.NewDrivenHTTPServerWithOptions(rCfg,
|
||||||
|
|
||||||
revaSrv := runtime.RunDrivenServerWithOptions(rcfg, pidFile,
|
|
||||||
runtime.WithLogger(&logger.Logger),
|
runtime.WithLogger(&logger.Logger),
|
||||||
runtime.WithRegistry(reg),
|
runtime.WithRegistry(registry.GetRegistry()),
|
||||||
runtime.WithTraceProvider(traceProvider),
|
runtime.WithTraceProvider(traceProvider),
|
||||||
)
|
); rServer != nil {
|
||||||
gr.Add(runner.NewRevaServiceRunner("auth-service_revad", revaSrv))
|
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))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -63,11 +63,11 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
mtrcs := metrics.New()
|
mtrcs := metrics.New()
|
||||||
mtrcs.BuildInfo.WithLabelValues(version.GetString()).Set(1)
|
mtrcs.BuildInfo.WithLabelValues(version.GetString()).Set(1)
|
||||||
|
|||||||
@@ -43,11 +43,11 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
// prepare components
|
// prepare components
|
||||||
if err := helpers.RegisterOpenCloudService(ctx, cfg, logger); err != nil {
|
if err := helpers.RegisterOpenCloudService(ctx, cfg, logger); err != nil {
|
||||||
|
|||||||
@@ -48,11 +48,11 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
m := metrics.New()
|
m := metrics.New()
|
||||||
m.BuildInfo.WithLabelValues(version.GetString()).Set(1)
|
m.BuildInfo.WithLabelValues(version.GetString()).Set(1)
|
||||||
|
|||||||
@@ -3,11 +3,8 @@ package command
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"path"
|
|
||||||
|
|
||||||
"github.com/gofrs/uuid"
|
|
||||||
"github.com/opencloud-eu/reva/v2/cmd/revad/runtime"
|
"github.com/opencloud-eu/reva/v2/cmd/revad/runtime"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
|
|
||||||
@@ -40,11 +37,11 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
gr := runner.NewGroup()
|
gr := runner.NewGroup()
|
||||||
|
|
||||||
@@ -53,15 +50,22 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
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.WithLogger(&logger.Logger),
|
||||||
runtime.WithRegistry(reg),
|
runtime.WithRegistry(registry.GetRegistry()),
|
||||||
runtime.WithTraceProvider(traceProvider),
|
runtime.WithTraceProvider(traceProvider),
|
||||||
)
|
); rServer != nil {
|
||||||
gr.Add(runner.NewRevaServiceRunner("frontend_revad", revaSrv))
|
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))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,11 +3,8 @@ package command
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"path"
|
|
||||||
|
|
||||||
"github.com/gofrs/uuid"
|
|
||||||
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
|
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
|
||||||
"github.com/opencloud-eu/opencloud/pkg/registry"
|
"github.com/opencloud-eu/opencloud/pkg/registry"
|
||||||
"github.com/opencloud-eu/opencloud/pkg/runner"
|
"github.com/opencloud-eu/opencloud/pkg/runner"
|
||||||
@@ -39,26 +36,31 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
gr := runner.NewGroup()
|
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)
|
rCfg := revaconfig.GatewayConfigFromStruct(cfg, logger)
|
||||||
reg := registry.GetRegistry()
|
if rServer := runtime.NewDrivenHTTPServerWithOptions(rCfg,
|
||||||
|
|
||||||
revaSrv := runtime.RunDrivenServerWithOptions(rCfg, pidFile,
|
|
||||||
runtime.WithLogger(&logger.Logger),
|
runtime.WithLogger(&logger.Logger),
|
||||||
runtime.WithRegistry(reg),
|
runtime.WithRegistry(registry.GetRegistry()),
|
||||||
runtime.WithTraceProvider(traceProvider),
|
runtime.WithTraceProvider(traceProvider),
|
||||||
)
|
); rServer != nil {
|
||||||
|
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rhttp", rServer))
|
||||||
gr.Add(runner.NewRevaServiceRunner("gateway_revad", revaSrv))
|
}
|
||||||
|
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))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,11 +35,11 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
mtrcs := metrics.New()
|
mtrcs := metrics.New()
|
||||||
mtrcs.BuildInfo.WithLabelValues(version.GetString()).Set(1)
|
mtrcs.BuildInfo.WithLabelValues(version.GetString()).Set(1)
|
||||||
|
|||||||
@@ -3,11 +3,8 @@ package command
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"path"
|
|
||||||
|
|
||||||
"github.com/gofrs/uuid"
|
|
||||||
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
|
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
|
||||||
"github.com/opencloud-eu/opencloud/pkg/ldap"
|
"github.com/opencloud-eu/opencloud/pkg/ldap"
|
||||||
"github.com/opencloud-eu/opencloud/pkg/registry"
|
"github.com/opencloud-eu/opencloud/pkg/registry"
|
||||||
@@ -52,26 +49,31 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
gr := runner.NewGroup()
|
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)
|
rCfg := revaconfig.GroupsConfigFromStruct(cfg)
|
||||||
reg := registry.GetRegistry()
|
if rServer := runtime.NewDrivenHTTPServerWithOptions(rCfg,
|
||||||
|
|
||||||
revaSrv := runtime.RunDrivenServerWithOptions(rCfg, pidFile,
|
|
||||||
runtime.WithLogger(&logger.Logger),
|
runtime.WithLogger(&logger.Logger),
|
||||||
runtime.WithRegistry(reg),
|
runtime.WithRegistry(registry.GetRegistry()),
|
||||||
runtime.WithTraceProvider(traceProvider),
|
runtime.WithTraceProvider(traceProvider),
|
||||||
)
|
); rServer != nil {
|
||||||
|
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rhttp", rServer))
|
||||||
gr.Add(runner.NewRevaServiceRunner("groups_revad", revaSrv))
|
}
|
||||||
|
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))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -38,11 +38,11 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
},
|
},
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
logger := logging.Configure(cfg.Service.Name, cfg.Log)
|
logger := logging.Configure(cfg.Service.Name, cfg.Log)
|
||||||
|
|
||||||
|
|||||||
@@ -60,11 +60,11 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
metrics := metrics.New()
|
metrics := metrics.New()
|
||||||
metrics.BuildInfo.WithLabelValues(version.GetString()).Set(1)
|
metrics.BuildInfo.WithLabelValues(version.GetString()).Set(1)
|
||||||
|
|||||||
@@ -36,11 +36,11 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
metrics := metrics.New(metrics.Logger(logger))
|
metrics := metrics.New(metrics.Logger(logger))
|
||||||
metrics.BuildInfo.WithLabelValues(version.GetString()).Set(1)
|
metrics.BuildInfo.WithLabelValues(version.GetString()).Set(1)
|
||||||
|
|||||||
@@ -31,11 +31,11 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
logger := logging.Configure(cfg.Service.Name, cfg.Log)
|
logger := logging.Configure(cfg.Service.Name, cfg.Log)
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
gr := runner.NewGroup()
|
gr := runner.NewGroup()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -59,11 +59,11 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
gr := runner.NewGroup()
|
gr := runner.NewGroup()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -38,11 +38,11 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
gr := runner.NewGroup()
|
gr := runner.NewGroup()
|
||||||
|
|
||||||
|
|||||||
@@ -3,11 +3,8 @@ package command
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"path"
|
|
||||||
|
|
||||||
"github.com/gofrs/uuid"
|
|
||||||
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
|
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
|
||||||
"github.com/opencloud-eu/opencloud/pkg/registry"
|
"github.com/opencloud-eu/opencloud/pkg/registry"
|
||||||
"github.com/opencloud-eu/opencloud/pkg/runner"
|
"github.com/opencloud-eu/opencloud/pkg/runner"
|
||||||
@@ -39,26 +36,31 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
gr := runner.NewGroup()
|
gr := runner.NewGroup()
|
||||||
|
|
||||||
{
|
{
|
||||||
|
// run the appropriate reva servers based on the config
|
||||||
rCfg := revaconfig.OCMConfigFromStruct(cfg, logger)
|
rCfg := revaconfig.OCMConfigFromStruct(cfg, logger)
|
||||||
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
|
if rServer := runtime.NewDrivenHTTPServerWithOptions(rCfg,
|
||||||
reg := registry.GetRegistry()
|
|
||||||
|
|
||||||
revaSrv := runtime.RunDrivenServerWithOptions(rCfg, pidFile,
|
|
||||||
runtime.WithLogger(&logger.Logger),
|
runtime.WithLogger(&logger.Logger),
|
||||||
runtime.WithRegistry(reg),
|
runtime.WithRegistry(registry.GetRegistry()),
|
||||||
runtime.WithTraceProvider(traceProvider),
|
runtime.WithTraceProvider(traceProvider),
|
||||||
)
|
); rServer != nil {
|
||||||
|
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rhttp", rServer))
|
||||||
gr.Add(runner.NewRevaServiceRunner("ocm_revad", revaSrv))
|
}
|
||||||
|
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))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -41,11 +41,11 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
metrics := metrics.New()
|
metrics := metrics.New()
|
||||||
metrics.BuildInfo.WithLabelValues(version.GetString()).Set(1)
|
metrics.BuildInfo.WithLabelValues(version.GetString()).Set(1)
|
||||||
|
|||||||
@@ -35,11 +35,11 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
},
|
},
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
logger := log.NewLogger(
|
logger := log.NewLogger(
|
||||||
log.Name(cfg.Service.Name),
|
log.Name(cfg.Service.Name),
|
||||||
|
|||||||
@@ -37,11 +37,11 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
logger := logging.Configure(cfg.Service.Name, cfg.Log)
|
logger := logging.Configure(cfg.Service.Name, cfg.Log)
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
traceProvider, err := tracing.GetServiceTraceProvider(cfg.Tracing, cfg.Service.Name)
|
traceProvider, err := tracing.GetServiceTraceProvider(cfg.Tracing, cfg.Service.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -109,9 +109,8 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
)
|
)
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,7 +191,7 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
server, err := proxyHTTP.Server(
|
server, err := proxyHTTP.Server(
|
||||||
proxyHTTP.Handler(lh.Handler()),
|
proxyHTTP.Handler(lh.Handler()),
|
||||||
proxyHTTP.Logger(logger),
|
proxyHTTP.Logger(logger),
|
||||||
proxyHTTP.Context(ctx),
|
proxyHTTP.Context(cfg.Context),
|
||||||
proxyHTTP.Config(cfg),
|
proxyHTTP.Config(cfg),
|
||||||
proxyHTTP.Metrics(metrics.New()),
|
proxyHTTP.Metrics(metrics.New()),
|
||||||
proxyHTTP.Middlewares(middlewares),
|
proxyHTTP.Middlewares(middlewares),
|
||||||
@@ -212,7 +211,7 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
{
|
{
|
||||||
debugServer, err := debug.Server(
|
debugServer, err := debug.Server(
|
||||||
debug.Logger(logger),
|
debug.Logger(logger),
|
||||||
debug.Context(ctx),
|
debug.Context(cfg.Context),
|
||||||
debug.Config(cfg),
|
debug.Config(cfg),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -223,7 +222,7 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
gr.Add(runner.NewGolangHttpServerRunner("proxy_debug", debugServer))
|
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
|
// return the first non-nil error found in the results
|
||||||
for _, grResult := range grResults {
|
for _, grResult := range grResults {
|
||||||
|
|||||||
@@ -43,11 +43,11 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
mtrcs := metrics.New()
|
mtrcs := metrics.New()
|
||||||
mtrcs.BuildInfo.WithLabelValues(version.GetString()).Set(1)
|
mtrcs.BuildInfo.WithLabelValues(version.GetString()).Set(1)
|
||||||
|
|||||||
@@ -44,11 +44,11 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
mtrcs := metrics.New()
|
mtrcs := metrics.New()
|
||||||
mtrcs.BuildInfo.WithLabelValues(version.GetString()).Set(1)
|
mtrcs.BuildInfo.WithLabelValues(version.GetString()).Set(1)
|
||||||
|
|||||||
@@ -5,10 +5,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"path"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/gofrs/uuid"
|
|
||||||
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
|
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
|
||||||
"github.com/opencloud-eu/opencloud/pkg/registry"
|
"github.com/opencloud-eu/opencloud/pkg/registry"
|
||||||
"github.com/opencloud-eu/opencloud/pkg/runner"
|
"github.com/opencloud-eu/opencloud/pkg/runner"
|
||||||
@@ -52,29 +50,35 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
gr := runner.NewGroup()
|
gr := runner.NewGroup()
|
||||||
|
|
||||||
{
|
{
|
||||||
pidFile := path.Join(os.TempDir(), "revad-"+cfg.Service.Name+"-"+uuid.Must(uuid.NewV4()).String()+".pid")
|
|
||||||
rCfg, err := revaconfig.SharingConfigFromStruct(cfg, logger)
|
rCfg, err := revaconfig.SharingConfigFromStruct(cfg, logger)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
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.WithLogger(&logger.Logger),
|
||||||
runtime.WithRegistry(reg),
|
runtime.WithRegistry(registry.GetRegistry()),
|
||||||
runtime.WithTraceProvider(traceProvider),
|
runtime.WithTraceProvider(traceProvider),
|
||||||
)
|
); rServer != nil {
|
||||||
|
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rhttp", rServer))
|
||||||
gr.Add(runner.NewRevaServiceRunner("sharing_revad", revaSrv))
|
}
|
||||||
|
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))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -36,11 +36,11 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
},
|
},
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
logger := log.NewLogger(
|
logger := log.NewLogger(
|
||||||
log.Name(cfg.Service.Name),
|
log.Name(cfg.Service.Name),
|
||||||
|
|||||||
@@ -3,11 +3,8 @@ package command
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"path"
|
|
||||||
|
|
||||||
"github.com/gofrs/uuid"
|
|
||||||
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
|
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
|
||||||
"github.com/opencloud-eu/opencloud/pkg/registry"
|
"github.com/opencloud-eu/opencloud/pkg/registry"
|
||||||
"github.com/opencloud-eu/opencloud/pkg/runner"
|
"github.com/opencloud-eu/opencloud/pkg/runner"
|
||||||
@@ -39,26 +36,31 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
gr := runner.NewGroup()
|
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)
|
rCfg := revaconfig.StoragePublicLinkConfigFromStruct(cfg)
|
||||||
reg := registry.GetRegistry()
|
if rServer := runtime.NewDrivenHTTPServerWithOptions(rCfg,
|
||||||
|
|
||||||
revaSrv := runtime.RunDrivenServerWithOptions(rCfg, pidFile,
|
|
||||||
runtime.WithLogger(&logger.Logger),
|
runtime.WithLogger(&logger.Logger),
|
||||||
runtime.WithRegistry(reg),
|
runtime.WithRegistry(registry.GetRegistry()),
|
||||||
runtime.WithTraceProvider(traceProvider),
|
runtime.WithTraceProvider(traceProvider),
|
||||||
)
|
); rServer != nil {
|
||||||
|
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rhttp", rServer))
|
||||||
gr.Add(runner.NewRevaServiceRunner("storage-publiclink_revad", revaSrv))
|
}
|
||||||
|
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))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,11 +3,8 @@ package command
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"path"
|
|
||||||
|
|
||||||
"github.com/gofrs/uuid"
|
|
||||||
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
|
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
|
||||||
"github.com/opencloud-eu/opencloud/pkg/registry"
|
"github.com/opencloud-eu/opencloud/pkg/registry"
|
||||||
"github.com/opencloud-eu/opencloud/pkg/runner"
|
"github.com/opencloud-eu/opencloud/pkg/runner"
|
||||||
@@ -39,26 +36,31 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
gr := runner.NewGroup()
|
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)
|
rCfg := revaconfig.StorageSharesConfigFromStruct(cfg)
|
||||||
reg := registry.GetRegistry()
|
if rServer := runtime.NewDrivenHTTPServerWithOptions(rCfg,
|
||||||
|
|
||||||
revaSrv := runtime.RunDrivenServerWithOptions(rCfg, pidFile,
|
|
||||||
runtime.WithLogger(&logger.Logger),
|
runtime.WithLogger(&logger.Logger),
|
||||||
runtime.WithRegistry(reg),
|
runtime.WithRegistry(registry.GetRegistry()),
|
||||||
runtime.WithTraceProvider(traceProvider),
|
runtime.WithTraceProvider(traceProvider),
|
||||||
)
|
); rServer != nil {
|
||||||
|
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rhttp", rServer))
|
||||||
gr.Add(runner.NewRevaServiceRunner("storage-shares_revad", revaSrv))
|
}
|
||||||
|
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))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,11 +3,8 @@ package command
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"path"
|
|
||||||
|
|
||||||
"github.com/gofrs/uuid"
|
|
||||||
"github.com/opencloud-eu/reva/v2/cmd/revad/runtime"
|
"github.com/opencloud-eu/reva/v2/cmd/revad/runtime"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
|
|
||||||
@@ -40,26 +37,31 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
gr := runner.NewGroup()
|
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)
|
rCfg := revaconfig.StorageSystemFromStruct(cfg)
|
||||||
reg := registry.GetRegistry()
|
if rServer := runtime.NewDrivenHTTPServerWithOptions(rCfg,
|
||||||
|
|
||||||
revaSrv := runtime.RunDrivenServerWithOptions(rCfg, pidFile,
|
|
||||||
runtime.WithLogger(&logger.Logger),
|
runtime.WithLogger(&logger.Logger),
|
||||||
runtime.WithRegistry(reg),
|
runtime.WithRegistry(registry.GetRegistry()),
|
||||||
runtime.WithTraceProvider(traceProvider),
|
runtime.WithTraceProvider(traceProvider),
|
||||||
)
|
); rServer != nil {
|
||||||
|
gr.Add(runner.NewRevaServiceRunner(cfg.Service.Name+".rhttp", rServer))
|
||||||
gr.Add(runner.NewRevaServiceRunner("storage-system_revad", revaSrv))
|
}
|
||||||
|
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))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,11 +3,8 @@ package command
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"path"
|
|
||||||
|
|
||||||
"github.com/gofrs/uuid"
|
|
||||||
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
|
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
|
||||||
"github.com/opencloud-eu/opencloud/pkg/registry"
|
"github.com/opencloud-eu/opencloud/pkg/registry"
|
||||||
"github.com/opencloud-eu/opencloud/pkg/runner"
|
"github.com/opencloud-eu/opencloud/pkg/runner"
|
||||||
@@ -41,25 +38,31 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
gr := runner.NewGroup()
|
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)
|
rCfg := revaconfig.StorageUsersConfigFromStruct(cfg)
|
||||||
reg := registry.GetRegistry()
|
if rServer := runtime.NewDrivenHTTPServerWithOptions(rCfg,
|
||||||
|
|
||||||
revaSrv := runtime.RunDrivenServerWithOptions(rCfg, pidFile,
|
|
||||||
runtime.WithLogger(&logger.Logger),
|
runtime.WithLogger(&logger.Logger),
|
||||||
runtime.WithRegistry(reg),
|
runtime.WithRegistry(registry.GetRegistry()),
|
||||||
runtime.WithTraceProvider(traceProvider),
|
runtime.WithTraceProvider(traceProvider),
|
||||||
)
|
); rServer != nil {
|
||||||
gr.Add(runner.NewRevaServiceRunner("storage-users_revad", revaSrv))
|
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))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -42,11 +42,11 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
m := metrics.New()
|
m := metrics.New()
|
||||||
m.BuildInfo.WithLabelValues(version.GetString()).Set(1)
|
m.BuildInfo.WithLabelValues(version.GetString()).Set(1)
|
||||||
|
|||||||
@@ -71,11 +71,11 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
mtrcs := metrics.New()
|
mtrcs := metrics.New()
|
||||||
mtrcs.BuildInfo.WithLabelValues(version.GetString()).Set(1)
|
mtrcs.BuildInfo.WithLabelValues(version.GetString()).Set(1)
|
||||||
|
|||||||
@@ -3,11 +3,8 @@ package command
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"path"
|
|
||||||
|
|
||||||
"github.com/gofrs/uuid"
|
|
||||||
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
|
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
|
||||||
"github.com/opencloud-eu/opencloud/pkg/ldap"
|
"github.com/opencloud-eu/opencloud/pkg/ldap"
|
||||||
"github.com/opencloud-eu/opencloud/pkg/registry"
|
"github.com/opencloud-eu/opencloud/pkg/registry"
|
||||||
@@ -52,25 +49,31 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
gr := runner.NewGroup()
|
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)
|
rCfg := revaconfig.UsersConfigFromStruct(cfg)
|
||||||
reg := registry.GetRegistry()
|
if rServer := runtime.NewDrivenHTTPServerWithOptions(rCfg,
|
||||||
|
|
||||||
revaSrv := runtime.RunDrivenServerWithOptions(rCfg, pidFile,
|
|
||||||
runtime.WithLogger(&logger.Logger),
|
runtime.WithLogger(&logger.Logger),
|
||||||
runtime.WithRegistry(reg),
|
runtime.WithRegistry(registry.GetRegistry()),
|
||||||
runtime.WithTraceProvider(traceProvider),
|
runtime.WithTraceProvider(traceProvider),
|
||||||
)
|
); rServer != nil {
|
||||||
gr.Add(runner.NewRevaServiceRunner("users_revad", revaSrv))
|
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))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -49,11 +49,11 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
m := metrics.New()
|
m := metrics.New()
|
||||||
|
|
||||||
|
|||||||
@@ -43,11 +43,11 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
metrics := metrics.New()
|
metrics := metrics.New()
|
||||||
metrics.BuildInfo.WithLabelValues(version.GetString()).Set(1)
|
metrics.BuildInfo.WithLabelValues(version.GetString()).Set(1)
|
||||||
|
|||||||
@@ -37,11 +37,11 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
ctx := cfg.Context
|
if cfg.Context == nil {
|
||||||
if ctx == nil {
|
cfg.Context, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
||||||
ctx, cancel = signal.NotifyContext(context.Background(), runner.StopSignals...)
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
}
|
}
|
||||||
|
ctx := cfg.Context
|
||||||
|
|
||||||
m := metrics.New(metrics.Logger(logger))
|
m := metrics.New(metrics.Logger(logger))
|
||||||
m.BuildInfo.WithLabelValues(version.GetString()).Set(1)
|
m.BuildInfo.WithLabelValues(version.GetString()).Set(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user