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

add nats deployment example #345

Merged
merged 3 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/ocis/docs/values-desc-table.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ a| [subs=-attributes]
+string+
a| [subs=-attributes]
`"kubernetes"`
| Configure the service registry type. Defaults to "kubernetes". Can be set to "etcd", then the address of etcd node(s) needs to be set to `registry.nodes`.
| Configure the service registry type. Defaults to "kubernetes". Can be set to "etcd" or "nats", then the address of etcd / nats node(s) needs to be set to `registry.nodes`.
| replicas
a| [subs=-attributes]
+int+
Expand Down
2 changes: 1 addition & 1 deletion charts/ocis/docs/values.adoc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ store:
registry:
# -- Configure the service registry type.
# Defaults to "kubernetes".
# Can be set to "etcd", then the address of etcd node(s) needs to be set to `registry.nodes`.
# Can be set to "etcd" or "nats", then the address of etcd / nats node(s) needs to be set to `registry.nodes`.
type: kubernetes
# -- Nodes of the service registry to use.
nodes: []
Expand Down
2 changes: 1 addition & 1 deletion charts/ocis/templates/_common/registry/registry.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
oCIS service registry
*/}}
{{- define "ocis.serviceRegistry" -}}
{{- $valid := list "kubernetes" "etcd" -}}
{{- $valid := list "kubernetes" "etcd" "nats" -}}
{{- if not (has .Values.registry.type $valid) -}}
{{- fail "invalid registry.type set" -}}
{{- end -}}
Expand Down
2 changes: 1 addition & 1 deletion charts/ocis/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ store:
registry:
# -- Configure the service registry type.
# Defaults to "kubernetes".
# Can be set to "etcd", then the address of etcd node(s) needs to be set to `registry.nodes`.
# Can be set to "etcd" or "nats", then the address of etcd / nats node(s) needs to be set to `registry.nodes`.
type: kubernetes
# -- Nodes of the service registry to use.
nodes: []
Expand Down
48 changes: 48 additions & 0 deletions deployments/ocis-nats/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# oCIS with NATS deployment example

## Introduction

This example shows how to deploy NATS with NATS as message bus and store.
It will deploy an oCIS instance and NATS, preconfigured to work together.

***Note***: This example is not intended for production use. It is intended to get a working oCIS
with NATS running in Kubernetes as quickly as possible. It is not hardened in any way.

## Getting started
Comment on lines +1 to +11
Copy link
Contributor

@mmattel mmattel Jul 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# oCIS with NATS deployment example
## Introduction
This example shows how to deploy NATS with NATS as message bus and store.
It will deploy an oCIS instance and NATS, preconfigured to work together.
***Note***: This example is not intended for production use. It is intended to get a working oCIS
with NATS running in Kubernetes as quickly as possible. It is not hardened in any way.
## Getting started
# oCIS with NATS Deployment Example
## Introduction
This example shows how to deploy NATS with NATS as message bus and store.
It will deploy an oCIS instance and NATS, preconfigured to work together.
***Note***: This example is not intended for production use and is not hardened in any way. It is intended as template to get a working oCIS instance running with NATS in Kubernetes as quickly as possible.
## Getting started

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will do this in a subsequent PR, because this feedback can be applied to all deployment examples. Tracker ticket, so it doesn't get lost: #354


### Prerequisites

This example requires the following things to be installed:

- [Kubernetes](https://kubernetes.io/) cluster, with an ingress controller installed.
- [Helm](https://helm.sh/) v3
- [Helmfile](https://github.com/helmfile/helmfile)

### End result

After following the steps in this guide, you should be able to access the following endpoint, you
may want to add these to your `/etc/hosts` file pointing to your ingress controller IP:

- https://ocis.kube.owncloud.test

Note that if you want to use your own hostname and domain, you will have to change the `externalDomain` value.
Comment on lines +21 to +28
Copy link
Contributor

@mmattel mmattel Jul 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### End result
After following the steps in this guide, you should be able to access the following endpoint, you
may want to add these to your `/etc/hosts` file pointing to your ingress controller IP:
- https://ocis.kube.owncloud.test
Note that if you want to use your own hostname and domain, you will have to change the `externalDomain` value.
### Final Result
After following the steps in this guide, you should be able to access the following endpoint which you may want to add to your `/etc/hosts` file pointing to your ingress controller IP:
- https://ocis.kube.owncloud.test
Note that if you want to use your own hostname and domain, you will have to change the `externalDomain` value.

...should be able to access the following endpoint...

but where is the endpoint mentioned?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The endpoint is the the url down below, so https://ocis.kube.owncloud.test.

Copy link
Contributor

@mmattel mmattel Jul 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THX, will adapt the suggestion - done.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will do this in a subsequent PR, because this feedback can be applied to all deployment examples. Tracker ticket, so it doesn't get lost: #354


### Deploying

In this directory, run the following commands:

```bash
$ helmfile sync
```

This will deploy oCIS and NATS.

### Logging in

You can get the admin password with the following command:

```bash
$ kubectl -n ocis get secret admin-user -o go-template --template="{{.data.password | base64decode }}"
```

You can use this password to login with the user `admin`.
84 changes: 84 additions & 0 deletions deployments/ocis-nats/helmfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
repositories:
- name: nats
url: https://nats-io.github.io/k8s/helm/charts

releases:
- name: nats
chart: nats/nats
namespace: ocis-nats
values:
- cluster:
enabled: true
name: "ocis-cluster"
- nats:
jetstream:
enabled: true

- name: ocis
chart: ../../charts/ocis
namespace: ocis
values:
- externalDomain: ocis.kube.owncloud.test
- ingress:
enabled: true
ingressClassName: nginx
annotations:
nginx.ingress.kubernetes.io/proxy-body-size: 1024m
tls:
- secretName: ocis-dev-tls
hosts:
- ocis.kube.owncloud.test

- insecure:
oidcIdpInsecure: true
ocisHttpApiInsecure: true

- messagingSystem:
external:
enabled: true
endpoint: nats.ocis-nats.svc.cluster.local:4222
tls:
enabled: false

- registry:
type: nats
nodes:
- nats.ocis-nats.svc.cluster.local:4222

- store:
type: nats-js
nodes:
- nats.ocis-nats.svc.cluster.local:4222

- services:
idm:
persistence:
enabled: true

nats:
persistence:
enabled: true

search:
persistence:
enabled: true

storagesystem:
persistence:
enabled: true

storageusers:
persistence:
enabled: true

store:
persistence:
enabled: true

thumbnails:
persistence:
enabled: true

web:
persistence:
enabled: true