owncloud / ocis

:atom_symbol: ownCloud Infinite Scale Stack
https://doc.owncloud.com/ocis/next/
Apache License 2.0
1.4k stars 182 forks source link

Update of deployment examples necessary #5623

Open mmattel opened 1 year ago

mmattel commented 1 year ago

The deployment examples, in particular but not exclusive the ocis_ldap example contains the setting OCIS_RUN_SERVICES defining which services to run.

As in the meanwhile services have been added like the postprocessing or eventhistory service, the list is incomplete and I highly doubt this is by purpose.

Someone (tm) needs to update all examples affected, latest before a new release gets published.

@wkloucek @micbar @butonic (maybe to add to the Infinite Scale Team Board)

kobergj commented 1 year ago

Maybe we could get rid of this configuration completely? Not specifying it will simply start all services.

If some services should not be started one could use OCIS_EXCLUDE_RUN_SERVICES to avoid starting specific ones.

butonic commented 3 months ago

I really want to be able to start a dedicated ocis instance to act as my IdP that reads users from my oc10 database using OCIS_RUN_SERVICES="idp,gateway,users" ...

currently OCIS_RUN_SERVICES seems to be completely ignored ...

kobergj commented 3 months ago

currently OCIS_RUN_SERVICES seems to be completely ignored ...

Please elaborate. OCIS_RUN_SERVICES works fine for me.

butonic commented 3 months ago

Found it: OCIS_RUN_SERVICES="idp,gateway,users" is parsed correctly, but the runtime still tries to ensure nats and the gateway are up and running, when starting the service. The runset only contains 'idp', 'gateway' and 'users'. But we still iterate over all _waitFuncs. This is a crude hack, but it lets me start only thes three services (which do not have a dependency on nats):

diff --git a/ocis/pkg/runtime/service/service.go b/ocis/pkg/runtime/service/service.go
index 311d6f7c1e..abe57eb9f4 100644
--- a/ocis/pkg/runtime/service/service.go
+++ b/ocis/pkg/runtime/service/service.go
@@ -520,6 +520,9 @@ func trap(s *Service, ctx context.Context) {

 // pingNats will attempt to connect to nats, blocking until a connection is established
 func pingNats(cfg *ociscfg.Config) error {
+       if _, ok := runset["nats"]; !ok {
+               return nil
+       }
        // We need to get a natsconfig from somewhere. We can use any one.
        evcfg := cfg.Postprocessing.Postprocessing.Events
        _, err := stream.NatsFromConfig("initial", true, stream.NatsConfig(evcfg))
@@ -527,6 +530,9 @@ func pingNats(cfg *ociscfg.Config) error {
 }

 func pingGateway(_ *ociscfg.Config) error {
+       if _, ok := runset["gateway"]; !ok {
+               return nil
+       }
        // init grpc connection
        _, err := ogrpc.NewClient()
        if err != nil {

but this is not a good solution, because it would also skip the nats check if a service was started thad depends on nats.

Maybe a new OCIS_RUN_WAITS="nats,gateway,sleep=5" env var that can be used to configure the wait funcs makes sense?

kobergj commented 3 months ago

No. Please do NOT an additional envvar that noone understands and noone dares to set.

Maybe we can skip the checks if OCIS_RUN_SERVICES is set? But that is not good either. If nats isn't running most services won't run anyways.

However I see two workarounds: