owncloud / ocis

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

Can I avoid connecting to a NATS cluster? #9834

Closed livingsilver94 closed 3 months ago

livingsilver94 commented 3 months ago

Describe the bug

I'm following the LDAP example using docker-compose. I'm currently stuck because OCIS tries to connect to a NATS cluster. I have many services in my Docker setup but none is a NATS cluster, nor I see why I should have one since it's a simple homelab setup. Apparently, the LDAP example doesn't mention NATS either.

Steps to reproduce

  1. Have this compose.yaml file:

    version: "3.7"
    
    services:
      ocis:
        image: owncloud/ocis:latest
        restart: unless-stopped
        networks:
          - authentication
        entrypoint: /bin/sh
        command: [ "-c", "ocis init --insecure yes || true; exec ocis server" ]
        environment:
          OCIS_JWT_SECRET: "${MY_JWT_SECRET}"
          OCIS_LDAP_BIND_DN: "cn=admin,dc=${MY_3LD},dc=${MY_2LD},dc=${MY_1LD}"
          OCIS_LDAP_BIND_PASSWORD: "${MY_LLDAP_ADMIN_PASSWORD}"
          OCIS_LDAP_URI: "ldap://lldap:3890"
          OCIS_RUN_SERVICES: "web,webdav"
          MICRO_REGISTRY: "memory"
          OCIS_CACHE_STORE: "memory"
          OCIS_PERSISTENT_STORE: "memory"
          PROXY_ENABLE_BASIC_AUTH: "true"
          OCIS_URL: "https://${MY_DOMAIN}/ocis"

    Note that the lldap service is defined in another file and works correctly. Those variables set to "memory" are an attempt to clear all default references to nats-js-kv.

Expected behavior

OCIS starts.

Actual behavior

OCIS exits with {"level":"error","error":"error connecting to nats cluster ocis-cluster: error connecting to nats at 127.0.0.1:9233 with tls enabled (false): nats: no servers available for connection","time":"2024-08-17T13:04:02Z","caller":"github.com/cenkalti/backoff@v2.2.1+incompatible/retry.go:24","message":"can't connect to nats (jetstream) server, retrying in 1m9.42635782s"}.

livingsilver94 commented 3 months ago

Oh, I think I found the solution. It seems "nats" is mandatory, at least for "web" and/or "webdav", but the cluster is internal. This variable makes it work: OCIS_RUN_SERVICES: "nats,web,webdav"

livingsilver94 commented 3 months ago

Note that the above applies to the "gateway" service too. I'm closing the issue since it's solved, but I think a dependency chain is required among services.

micbar commented 2 months ago

This error message is a false positive. During the startup of the service mesh, the nats service is not ready from the beginning while a number of services are trying to connect. That requests are retried, no issue.