[docs-only] Update nats and registry related documentation

This commit is contained in:
mmattel
2024-08-26 12:20:06 +02:00
parent 1f6b836217
commit 0fa38b6bd2
3 changed files with 29 additions and 22 deletions
+15 -10
View File
@@ -14,26 +14,31 @@ To be able to communicate with each other, services need to register in a common
The type of registry to use can be configured with the `MICRO_REGISTRY` environment variable. Supported values are:
### `memory`
Setting the environment variable to `memory` starts an in-memory registry. This only works with the single binary deployment.
### `nats-js-kv` (Default)
Set the environment variable to `nats-js-kv` or leave it empty to use a nats-js key value store as registry.
- Note: If not running build-in nats, `MICRO_REGISTRY_ADDRESS` needs to be set to the address of the nats-js cluster, which is the same value as `OCIS_EVENTS_ENDPOINT`.
- Optional: Use `MICRO_REGISTRY_AUTH_USERNAME` and `MICRO_REGISTRY_AUTH_PASSWORD` to authenticate with the nats cluster.
### `kubernetes`
When deploying in a kubernetes cluster, the kubernetes registry can be used. Additionally, the `MICRO_REGISTRY_ADDRESS` environment
variable needs to be set to the url of the kubernetes registry.
When deploying in a kubernetes cluster, the Kubernetes registry can be used. Additionally, the `MICRO_REGISTRY_ADDRESS` environment variable needs to be set to the url of the Kubernetes registry.
### `memory`
Setting the environment variable to `memory` starts an in-memory registry. This only works with the single binary deployment.
### Deprecated Registries
These registries are currently working but will be removed in a later version. It is recommended to switch to a supported one.
- `nats`. Uses a registry based on nats streams. Requires `MICRO_REGISTRY_ADDRESS` to be set.
- `etcd`. Uses an etcd cluster as the registry. Requires `MICRO_REGISTRY_ADDRESS` to be set.
- `consul`. Uses `HashiCorp Consul` as registry. Requires `MICRO_REGISTRY_ADDRESS` to be set.
- `mdns`. Uses multicast dns for registration. This type can have unwanted side effects when other devices in the local network use mdns too.
- `nats`\
Uses a registry based on nats streams. Requires `MICRO_REGISTRY_ADDRESS` to be set.
- `etcd`\
Uses an etcd cluster as the registry. Requires `MICRO_REGISTRY_ADDRESS` to be set.
- `consul`\
Uses `HashiCorp Consul` as registry. Requires `MICRO_REGISTRY_ADDRESS` to be set.
- `mdns`\
Uses multicast dns for registration. This type can have unwanted side effects when other devices in the local network use mdns too.
+7 -11
View File
@@ -1,26 +1,22 @@
# ocis
The ocis package contains the Infinite Scale runtime and the commands for the Infinite Scale cli.
The ocis package contains the Infinite Scale runtime and the commands for the Infinite Scale CLI.
## Service registry
## Service Registry
This package also configures the service registry which will be used to look up the service addresses. It defaults to mDNS. Keep that in mind when using systems with mDNS disabled by default (i.e. SUSE).
This package also configures the service registry which will be used to look up the service addresses.
Available registries are:
- nats
- nats-js-kv (default)
- kubernetes
- etcd
- consul
- memory
- mdns (default)
- etcd (deprecated)
- consul (deprecated)
- mdns (deprecated)
To configure which registry to use, you have to set the environment variable `MICRO_REGISTRY`, and for all except `memory` and `mdns` you also have to set the registry address via `MICRO_REGISTRY_ADDRESS`.
### etcd
To authenticate the connection to the etcd registry, you have to set `ETCD_USERNAME` and `ETCD_PASSWORD`.
## Memory limits
oCIS will automatically set the go native `GOMEMLIMIT` to `0.9`. To disable the limit set `AUTOMEMEMLIMIT=off`. For more information take a look at the official [Guide to the Go Garbage Collector](https://go.dev/doc/gc-guide).
+7 -1
View File
@@ -4,10 +4,16 @@ The nats service is the event broker of the system. It distributes events among
Services can `Publish` events to the nats service and nats will store these events on disk and distribute these events to other services eventually. Services can `Consume` events from the nats service by registering to a `ConsumerGroup`. Each `ConsumerGroup` is guaranteed to get each event exactly once. In most cases, each service will register its own `ConsumerGroup`. When there are multiple instances of a service, those instances will usually use that `ConsumerGroup` as common resource.
## Underlying technology
## Underlying Technology
As the service name suggests, this service is based on [NATS](https://nats.io/) specifically on [NATS Jetstream](https://docs.nats.io/nats-concepts/jetstream) to enable persistence.
## Default Registry
By default, `nats-js-kv` is configured as embedded default registry via the `MICRO_REGISTRY` environment variable. If you do not want using the build-in nats registry, set `MICRO_REGISTRY_ADDRESS` to the address of the nats-js cluster, which is the same value as `OCIS_EVENTS_ENDPOINT`. Optionally use `MICRO_REGISTRY_AUTH_USERNAME` and `MICRO_REGISTRY_AUTH_PASSWORD` to authenticate with the external nats cluster.
Note that when `MICRO_REGISTRY` is configured using `kubernetes`, the NATS service will not be used but the Kubernetes registry. In this case, the `MICRO_REGISTRY_ADDRESS` environment variable needs to be set to the url of the Kubernetes registry.
## Persistance
To be able to deliver events even after a system or service restart, nats will store events in a folder on the local filesystem. This folder can be specified by setting the `NATS_NATS_STORE_DIR` enviroment variable. If not set, the service will fall back to `$OCIS_BASE_DATA_PATH:/nats`.