EOX GitLab Instance

Skip to content
Snippets Groups Projects
Commit 2abc07d1 authored by Nikola Jankovic's avatar Nikola Jankovic :computer: Committed by Fabian Schindler-Strauss
Browse files

Readme updates for helm chart local run

parent 7e576a5f
No related branches found
No related tags found
2 merge requests!82Staging to master,!69Readme updates for helm chart local run
Chart for the View Server (VS) bundling all services
All the commands must be ran from the charts folder. Must have `kubectl` and `helm` utilities and one of `k3s` or `minikube` clusters. The following commands also use `yq`, which is `jq`, but for yaml (`python3 -m pip install yq`). The guide also assumes everything runs in the default namespace.
Useful commands:
```bash
helm dependency update
helm template testing . --output-dir ../tmp/ -f values.yaml
```
The template command outputs the rendered yaml files for debugging and checking.
## Installing chart locally [DRAFT]
In order to test the services together, here's a way to install the chart locally in your `k3s`/`minicube`. This install is based on the helm values in the eoepca repo and customizes them.
### Prerequisites
When running k3s and minikube in docker, the paths doesn't refer to your machine, but the docker container where k3s runs. The following display how to setup each solution.
#### Minikube
Minikube needs to be started with the following:
```bash
minikube start --mount-string /home/$user/:/minikube-host/
minikube addons enable ingress
```
Here the full home directory is bound to the cluster at `/minikube-host` in order to bind mounts necessary for development. Also the ingress addon is enabled.
#### k3s
k3s is also started creating with specifying a volume
``` bash
k3s cluster create --volume /home/$user/:/k3s-host/
```
Here the full home directory is bound to the cluster at `/k3s-host` in order to bind mounts necessary for development.
#### values.yaml
The values yaml file should be setup with:
```bash
cat ~/path/to/eoepca/system/clusters/develop/resource-management/hr-data-access.yaml | yq .spec.values -y > /tmp/values.yaml
```
#### Persistent volume claims
For the services to start, you're going to need the pvcs as below. Create a file `pvc.yaml` and run `kubectl apply -f pvc.yaml`
```yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: data-access-db
namespace: <your-namespace>
spec:
accessModes:
- ReadWriteOnce
storageClassName: local-path # this should be `standard` for minikube
resources:
requests:
storage: 2Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: data-access-redis
namespace: <your-namespace>
spec:
accessModes:
- ReadWriteOnce
storageClassName: local-path # this should be `standard` for minikube
resources:
requests:
storage: 2Gi
```
### Deploying the stack
Install:
```bash
helm install test . --values /tmp/values.yaml
```
Upgrade with overrides values:
```bash
helm upgrade test . --values /tmp/values.yaml --values your-values-override-file.yaml>
```
If you specify multiple values files, helm will merge them together. [You can even delete keys by setting them to `null` in the override file a](https://helm.sh/docs/chart_template_guide/values_files/) .
A useful override is to set the ingress host e.g. to nip.io:
```yaml
ingress:
enabled: true
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/proxy-read-timeout: '600'
nginx.ingress.kubernetes.io/enable-cors: 'true'
# cert-manager.io/cluster-issuer: letsencrypt
hosts:
- host: data-access.<IP-ADDRESS>.nip.io
```
Where `<IP-ADDRESS>` is one of
* 127.0.0.1
* Output of `minikube ip`
You might also want to reduce the number of replicas:
```yaml
renderer:
replicaCount: 1
```
For development, it's useful to mount the code as volume. This cannot just be done via a values override since this customization option is not present in the chart template.
When using k3s & minikube, it's enough to define a volume like this:
```yaml
volumes:
- name: eoxserver
hostPath:
path: /<app>-host/path/to/eoxserver
type: DirectoryOrCreate
```
where `app` is `k3s` or `minikube` and a `volumeMount` for the container:
```yaml
volumeMounts:
- mountPath: /usr/local/lib/python3.8/dist-packages/eoxserver/
name: eoxserver
```
# Useful overrides
For now, these can be added to their respective templates `.yaml` files for development. Make sure not to commit them to the repo and have them only locally changed.
Alternatively, these can be added to the file output of the `helm templates` command and upgraded with the `helm upgrade` command.
## Registrar
```yaml
volumes:
- name: registrar
hostPath:
path: /minikube-host/path/to/vs/core/registrar/
type: DirectoryOrCreate
- name: instance-registrar
hostPath:
path: /minikube-host/path/to/eoxserver/instances/registrar/
type: DirectoryOrCreate
- name: eoxserver-registrar
hostPath:
path: /minikube-host/path/to/eoxserver/eoxserver/ # important to bind to the eoxserver directory which is inside the eoxserver repo
type: DirectoryOrCreate
volumeMounts:
- name: instance-registrar
mountPath: >-
/var/www/
- name: eoxserver-registrar
mountPath: >-
/usr/local/lib/python3.8/dist-packages/eoxserver/
- name: registrar
mountPath: >-
/usr/local/lib/python3.8/dist-packages/registrar-1.2.0-py3.8.egg/registrar/
```
## Renderer
```yaml
volumes:
- name: eoxserver-renderer
hostPath:
path: /minikube-host/path/to/eoxserver/eoxserver/ # important to bind to the eoxserver directory which is inside the eoxserver repo
type: DirectoryOrCreate
- name: instance-renderer
hostPath:
path: /minikube-host/path/eoxserver/instances/renderer/
type: DirectoryOrCreate
volumeMounts:
- name: eoxserver-renderer
mountPath: >-
/usr/local/lib/python3.8/dist-packages/eoxserver/
- name: instance-renderer
mountPath: >-
/var/www/
```
## Client
&#35; TODO: fill in the client overrides
## Preprocessor
&#35; TODO: fill in the preprocessor overrides
## Ingestor
&#35; TODO: fill in the ingestor overrides
## Publishing chart
Currently this approach does not work 100% such repos cannot be declared [in dependencies of other charts](https://github.com/helm/helm/issues/6593)
```bash
helm registry login registry.gitlab.eox.at
helm chart save . registry.gitlab.eox.at/esa/prism/vs/chart
helm chart push registry.gitlab.eox.at/esa/prism/vs/chart:0.1.0-beta.1
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment