Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nats integration improvements, unified TLSConfig for Nats and GRPC client #840

Merged
merged 12 commits into from
Jul 3, 2024

Conversation

FZambia
Copy link
Member

@FZambia FZambia commented Jun 30, 2024

Proposed changes

Nats raw mode

This pull request contains changes to use Nats broker in raw mode. In this mode Centrifugo skips its own message wrapping and just consumes Nats topics as is. In this mode Centrifugo does not use any prefix for channels by default, though it's still possible to define one. Centrifugo still uses its own format for control messages when raw mode is used. To work with namespaces which use : as separator this pr provides a way to define channel replacements mapping for Nats channels. For example, this allows using ns:channel in app but transform it to ns.channel in Nats when subscribing to Nats topic, and then upon consuming from Nats topic publish to the original channel ns:channel.

There is a work to allow using multiple brokers and presence managers in Centrifugo on per-namespace level, it will be a Centrifugo PRO feature. This adds a great level of flexibility to use various channel properties provided by different brokers in different namespaces, new ways to scale – having separate Redis instances for separate namespaces, combining Redis and Nats.

Wildcard subscriptions with Nats

It's also now possible to use wildcard subscriptions with Nats. This must be explicitly turned on using a separate option. In that case though Centrifugo features like presence, join/leave events, history, recovery won't work. But still can be useful for a variety of use cases. Users must be very careful with permissions when using wildcard channels – this should be emphasised in the doc.

TLS for Nats, unified TLSConfig

Also, supporting TLS configuration for Nats here. It uses a new approach using a unified TLSConfig object (see #831 ).

TLS for proxy GRPC client

Also added support for TLS in GRPC client (to address #839 ) – also utilizing a new TLSConfig structure for that.

Misc

Added integration tests for Nats.

I had to fork kelseyhightower/envconfig package to fit the needs of Centrifugo. Configuration is now a bit messy in implementation, but for users it's exposed in a very friendly way - both config file and env vars are supported, and we still have useful warnings in logs about unknown options used in config file or environment.

@FZambia FZambia changed the title Nats integration improvements, TLS v2 for Nats and GRPC client Nats integration improvements, TLS for Nats and GRPC client using unified TLSConfig Jun 30, 2024
@FZambia FZambia changed the title Nats integration improvements, TLS for Nats and GRPC client using unified TLSConfig Nats integration improvements, unified TLSConfig for Nats and GRPC client Jun 30, 2024
@FZambia FZambia marked this pull request as ready for review July 2, 2024 19:52
@FZambia FZambia merged commit c4558e8 into master Jul 3, 2024
4 checks passed
@FZambia FZambia deleted the nats_raw_mode branch July 8, 2024 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant