Skip to content

Commit

Permalink
Add multimedia pvc (#36)
Browse files Browse the repository at this point in the history
* add pvc for multimedia storage

* make selector optional

* add doc on multimedia storage

* fix variable naming
  • Loading branch information
bennsimon authored Sep 24, 2021
1 parent 100f1d0 commit 5841e87
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/opensrp-server-web/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.2.0
version: 0.2.1

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
30 changes: 30 additions & 0 deletions charts/opensrp-server-web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,3 +317,33 @@ The following table lists the configurable parameters of the Opensrp-server-web
| `sentry.minimumEventLevel` | | `"error"` |
| `sentry.minimumBreadcrumbLevel` | | `"info"` |
| `sentry.tags` | | `{}` |
| `extraVolumeMounts` | | `null` |
| `extraVolumes` | | `null` |
| `multimediaPvc.enabled` | | `false` |
| `multimediaPvc.volumeMode` | | `"Filesystem"` |
| `multimediaPvc.storageClassName` | | `null` |
| `multimediaPvc.resources.requests.storage` | | `"2Gi"` |
| `multimediaPvc.accessModes` | | `["ReadWriteOnce"]` |
| `multimediaPvc.selector` | | `{}` |

## Multimedia Storage
By default, multimedia (patient images, csv import files, e.t.c) collected on the opensrp server are stored on an S3 bucket. The S3 credentials have the following configurations:
````yaml
object_storage:
access_key_id: dummy
secret_access_key: dummy
region: dummy
bucket_name: dummy
bucket_folder_path: dummy
````
If S3 storage is not available one can volumes instead. The configurations are as follows:
1. Enable PVC mode.
- ````yaml
multimediaPvc:
enabled: true
````
2. Set multimedia file manager to FileSystem Manager.
- ````yaml
opensrp:
multimedia_file_manager: FileSystemMultimediaFileManager
````
15 changes: 15 additions & 0 deletions charts/opensrp-server-web/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ spec:
- name: opensrp-server-config-web
configMap:
name: {{ include "opensrp-server-web.fullname" . }}
{{- if .Values.multimediaPvc.enabled }}
- name: opensrp-server-multimedia-dir
persistentVolumeClaim:
claimName: {{ include "opensrp-server-web.fullname" . }}
{{- end }}
{{- if .Values.extraVolumes }}
{{- toYaml .Values.extraVolumes | nindent 8 -}}
{{- end }}
initContainers:
- name: {{ .Chart.Name }}-mybatis
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
Expand Down Expand Up @@ -69,6 +77,13 @@ spec:
- name: opensrp-server-config-web
mountPath: /usr/local/tomcat/webapps/opensrp/WEB-INF/web.xml
subPath: opensrp.web.xml
{{- if .Values.multimediaPvc.enabled }}
- name: opensrp-server-multimedia-dir
mountPath: /opt/multimedia
{{- end }}
{{- if .Values.extraVolumeMounts }}
{{- toYaml .Values.extraVolumeMounts | nindent 12 }}
{{- end }}
ports:
- name: http
containerPort: 8080
Expand Down
21 changes: 21 additions & 0 deletions charts/opensrp-server-web/templates/pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{- if .Values.multimediaPvc.enabled -}}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "opensrp-server-web.fullname" . }}
labels:
{{- include "opensrp-server-web.labels" . | nindent 4 }}
spec:
accessModes:
{{- toYaml .Values.multimediaPvc.accessModes | nindent 4 }}
volumeMode: {{ .Values.multimediaPvc.volumeMode }}
resources:
{{- toYaml .Values.multimediaPvc.resources | nindent 4 }}
{{- if .Values.multimediaPvc.storageClassName }}
storageClassName: {{ .Values.multimediaPvc.storageClassName }}
{{- end }}
{{- if .Values.multimediaPvc.selector }}
selector:
{{- toYaml .Values.multimediaPvc.selector | nindent 4 }}
{{- end }}
{{- end -}}
23 changes: 23 additions & 0 deletions charts/opensrp-server-web/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -256,3 +256,26 @@ sentry:
minimumEventLevel: "error"
minimumBreadcrumbLevel: "info"
tags: {}

extraVolumeMounts:

extraVolumes:

# PVC for multimedia stored on the server disabled by default.
# To use this enable it and update the multimedia file manager like below
# ...
# opensrp:
# multimedia_file_manager: FileSystemMultimediaFileManager
# ...
# Default multimedia file manager is S3MultimediaFileManager
multimediaPvc:
enabled: false
volumeMode: Filesystem
storageClassName:
resources:
requests:
# update accordingly
storage: 2Gi
accessModes:
- ReadWriteOnce
selector: {}

0 comments on commit 5841e87

Please sign in to comment.