Skip to content

Commit

Permalink
Merge pull request #345 from owncloud/nats-deployment-example
Browse files Browse the repository at this point in the history
add nats deployment example
  • Loading branch information
wkloucek authored Jul 6, 2023
2 parents 5d10256 + 9b38041 commit 1368902
Show file tree
Hide file tree
Showing 6 changed files with 136 additions and 4 deletions.
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

### 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.

### 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

0 comments on commit 1368902

Please sign in to comment.