Getting started
Docker Compose, Helm, and a first subscription
Upgrading? UPGRADING.md tells what each major release changes, and how to upgrade, e.g. from 0.x to 1.0.
The easiest way to start the solution is using Docker Compose.
To do this, clone the repository:
git clone https://github.com/neuroglia-io/cloud-streams.git
Navigate to the resulting /cloud-streams/ directory, then run the following command:
docker compose -f "deployments/docker-compose/docker-compose.yml" up --build
This development stack authenticates nothing, and runs KurrentDB without TLS. To run it secured, add the secure overlay:
- KurrentDB runs over TLS, with certificates generated on first start, and requires credentials.
- Users sign in to the dashboard through Keycloak, at
http://localhost:8180, as thedemouser. - Publishers must send an
X-Api-Keyheader.
The overlay reads its secrets from the environment, and never stores them in the repository:
export KURRENTDB_ADMIN_PASSWORD=... KEYCLOAK_ADMIN_PASSWORD=... CLOUDSTREAMS_DEMO_PASSWORD=... CLOUDSTREAMS_INGESTION_API_KEY=...
docker compose -f "deployments/docker-compose/docker-compose.yml" -f "deployments/docker-compose/docker-compose.secure.yml" up --build
Now that everything is up and running, you can start publishing cloud events using POST requests on the gateway’s ingestion endpoint, at http://localhost:8080/api/events/pub:
curl -X 'POST' \
'http://localhost:8080/api/events/pub' \
-H 'accept: */*' \
-H 'Content-Type: application/cloudevents+json' \
-d '{
"id": "1234567890",
"specversion": "1.0",
"source": "https://foo.bar.com",
"type": "bar.foo",
"subject": "foobar",
"dataschema": "string",
"data": {
"foo": "bar"
}
}'
You can start consuming cloud events by creating a new subscription, which can be done via Dashboard, or by executing a simple POST request:
curl -X 'POST' \
'http://localhost:8080/api/resources/v1/namespaces/default/subscriptions?dryRun=false' \
-H 'accept: text/plain' \
-H 'Content-Type: text/json' \
-d '{
"metadata": {
"name": "my-subscription"
},
"spec": {
"subscriber": {
"endpoint": "https://webhook.site/00000000-0000-0000-0000-000000000000"
},
"stream":{
"offset": 0
}
}
}'
The preceding sample creates a new subscription to all events (no partition has been defined and no filter has been set). Because the stream offset is ‘0’, it will start receiving all events ever published, even the ones published before the creation of the subscription.
Note that, by default, subscriptions will only process cloud events published after their creation.
For more information on subscriptions, see Subscriptions.
The Dashboard UI is served by the gateway and is reachable at http://localhost:8080.
The Swagger UI, also served by the gateway, is reachable at http://localhost:8080/api/doc.
Kubernetes
A Helm chart, published with every release, deploys gateways and brokers. KurrentDB and Redis are not part of it: point it at existing ones.
helm install cloud-streams oci://ghcr.io/neuroglia-io/charts/cloud-streams --version <release> \
--set kurrentdb.connectionString='kurrentdb://kurrentdb:2113?tls=false' \
--set redis.connectionString='redis:6379'
- Kubernetes mode: with
resources.store=kubernetes, resources are Kubernetes custom resources, and an operator deploys gateways and brokers from them (see Kubernetes-native mode). The settings below describe the default, Redis mode. - Defaults: 2 replicas of each, non-root containers listening on 8080, pod disruption budgets, and probes on
/healthz/liveand/healthz. - Namespaces: by default, one gateway and one broker serve the
defaultnamespace.gatewaysandbrokerslist instead the gateways and brokers to deploy, each with itsnameandnamespace, and any setting ofgatewayorbrokerto override, e.g.gateways: [ { name: orders, namespace: tenant-a, replicaCount: 3 } ](see Namespaces). Each gets its own deployment, service and pod disruption budget, named<release>-cloud-streams-gateway-<namespace>-<name>. - Connection strings: they are kept in a secret. Pass
kurrentdb.existingSecretandredis.existingSecretto use secrets of your own instead. - Endpoints:
gateway.endpointstakes the shape of a gateway resource’sspec.workload.endpoints(see Exposure):- Public: ingestion, acknowledgements and health checks, served on
gateway.portand the service’s port 80. - Management: the management API and the dashboard, on
gateway.endpoints.management.port(8081), never on the public port.gateway.endpoints.management.enabled=falseturns it off on ingestion-only gateways. - Exposure: each endpoint is exposed by a Gateway API HTTPRoute (
httpRoute), an ingress (ingress), both, or only through the service, e.g. the public endpoint on a public Kubernetes Gateway and the management one on an internal ingress class.
- Public: ingestion, acknowledgements and health checks, served on
- Retention:
retention.maxAgeandretention.maxCountset the policy described under Retention. - Other settings, such as authentication, are environment variables, set with
gateway.envandbroker.env, e.g.{ name: Authentication__Dashboard__Enabled, value: "true" }. - Secrets of authenticated endpoints are read by the providers
secrets.providerslists (see Transports).secrets.filesmounts Kubernetes secrets for thefileprovider.secrets.kubernetes.rbaclets thekubernetesprovider read the release namespace’s secrets.secrets.vaultconfigures thevaultprovider.secrets.sharedWithlists the namespaces that may read shared secrets. Pods only mount their service account token when a provider needs it.
See values.yaml for every setting.