Skip to content
Open
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
49 changes: 39 additions & 10 deletions helm/plater/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,40 @@ data:
echo " -- Neo4j is unavailable - sleeping"
sleep 3
done
download_data.sh: |-
download_data_neo4j.sh: |-
#!/bin/bash
set -x
wget -O /data/neo4j.dump ${NEO4J_DATA_URL}
touch /data/done

run_memgraph.sh: |-
#!/bin/sh
set -e

echo "Starting Memgraph..."
/usr/lib/memgraph/memgraph \
--bolt-port=7687 \
--bolt-address=0.0.0.0 \
--log-level=INFO \
--also-log-to-stderr \
&
MEMGRAPH_PID=$!

echo "Waiting for Memgraph to accept connections...${MEMGRAPH_PID}"
until echo "RETURN 1;" | /usr/bin/mgconsole --host localhost --port 7687 >/dev/null 2>&1; do
sleep 1
done

if [ -f /data/memgraph.cypher ]; then
echo "Loading Memgraph dump..."
/usr/bin/mgconsole --host localhost --port 7687 < /data/memgraph.cypher
echo "Memgraph dump loaded"
else
echo "No memgraph.cypher found, skipping load"
fi

wait ${MEMGRAPH_PID}

health_check.sh: |-
#!/usr/bin/env bash
response=$(wget --server-response "${PUBLIC_URL}/openapi.json" 2>&1 | awk '/^ HTTP/{print $2}')
Expand Down Expand Up @@ -66,9 +95,9 @@ data:
fi
seed_db.sh: |-
#!/bin/bash
set -x
set -ex
FILE=/data/neo4j.dump
DATADIR=/data/databases
NEO4J_DATA=/data
until [ -f "$FILE" ]; do
echo "$FILE doesn't exist. Please copy to database dump file to $FILE"
echo "sleeping..."
Expand All @@ -77,15 +106,15 @@ data:
echo "$FILE found"
echo "clearing previous database file if any..."
# Make dir if they don't exist
mkdir -p /data/databases
mkdir -p /data/transactions
mkdir -p /data/dbms
mkdir -p ${NEO4J_DATA}/databases
mkdir -p ${NEO4J_DATA}/transactions
mkdir -p ${NEO4J_DATA}/dbms
# clear out data from dir if they were present
rm -rf /data/dbms/*
rm -rf /data/databases/*
rm -rf /data/transactions/*
rm -rf ${NEO4J_DATA}/dbms/*
rm -rf ${NEO4J_DATA}/databases/*
rm -rf ${NEO4J_DATA}/transactions/*
# load dump file
neo4j-admin database load --from-path=/data/ neo4j
neo4j-admin database load --from-path=/data/ neo4j --overwrite-destination=true --verbose
dataset-desc.json: |
{{ .Values.datasetDesc | toJson }}
openapi-config.yaml: |-
Expand Down
9 changes: 2 additions & 7 deletions helm/plater/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,21 @@ spec:
- name: {{ include "plater.fullname" . }}-metadata-pvc
mountPath: /home/plater/Plater/PLATER/metadata
subPath: plater-metadata/
{{- if and (eq .Values.graph.backend "neo4j") (not .Values.graph.external) }}
- name: {{ include "plater.fullname" . }}-init-container
image: "{{ .Values.busybox.image.repository }}:{{ .Values.busybox.image.tag }}"
command:
- './check_neo.sh'
env:
{{ if not .Values.externalNeo4j }}
- name: NEO4J_HOST
value: {{ include "plater.fullname" . }}-neo4j-service
- name: NEO4J_HTTP_PORT
value: "{{ .Values.app.neo4j.httpPort }}"
{{ else }}
- name: NEO4J_HOST
value: {{ .Values.externalNeo4j.hostName }}
- name: NEO4J_HTTP_PORT
value: "{{ .Values.externalNeo4j.port }}"
{{ end }}
volumeMounts:
- name: {{ include "plater.fullname" . }}-config-files
mountPath: /check_neo.sh
subPath: check_neo.sh
{{- end }}
containers:
- name: {{ include "plater.fullname" . }}-web-container
image: "{{ .Values.image.plater.repository }}:{{ .Values.image.plater.tag }}"
Expand Down
31 changes: 23 additions & 8 deletions helm/plater/templates/env-config-map.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,34 @@ metadata:
data:
WEB_HOST: "0.0.0.0"
WEB_PORT: "{{ .Values.app.port }}"
{{ if not .Values.externalNeo4j }}
GRAPH_DB: "{{ .Values.graph.backend }}"
GRAPH_QUERY_TIMEOUT: "{{ .Values.app.GRAPH_QUERY_TIMEOUT }}"
{{- if eq .Values.graph.backend "neo4j" }}
{{- if .Values.graph.external }}
NEO4J_HOST: {{ .Values.externalNeo4j.hostName }}
NEO4J_HTTP_PORT: "{{ .Values.externalNeo4j.httpPort }}"
NEO4J_BOLT_PORT: "{{ .Values.externalNeo4j.boltPort }}"
NEO4J_PASSWORD: "{{ .Values.externalNeo4j.password }}"
NEO4J_USERNAME: "{{ .Values.externalNeo4j.username }}"
{{- else }}
NEO4J_HOST: {{ include "plater.fullname" . }}-neo4j-service
NEO4J_HTTP_PORT: "{{ .Values.app.neo4j.httpPort }}"
NEO4J_BOLT_PORT: "{{ .Values.app.neo4j.boltPort }}"
NEO4J_PASSWORD: "{{ .Values.app.neo4j.password }}"
NEO4J_USERNAME: "{{ .Values.app.neo4j.username }}"
{{ else }}
NEO4J_HOST: {{ .Values.externalNeo4j.hostName }}
NEO4J_HTTP_PORT: "{{ .Values.externalNeo4j.port }}"
NEO4J_PASSWORD: "{{ .Values.externalNeo4j.password }}"
NEO4J_USERNAME: "{{ .Values.externalNeo4j.username }}"
{{ end }}
NEO4J_QUERY_TIMEOUT: "{{ .Values.app.Neo4jQueryTimeout }}"
{{- end }}
{{- end }}

{{- if eq .Values.graph.backend "memgraph" }}
{{- if .Values.graph.external }}
MEMGRAPH_HOST: {{ .Values.externalMemgraph.hostName | quote }}
MEMGRAPH_BOLT_PORT: "{{ .Values.externalMemgraph.boltPort }}"
{{- else }}
MEMGRAPH_HOST: {{ include "plater.fullname" . }}-memgraph-service
MEMGRAPH_BOLT_PORT: "{{ .Values.app.memgraph.boltPort }}"
{{- end }}
{{- end }}

PLATER_SERVICE_ADDRESS: "{{ include "plater.fullname" . }}-plater-service"
AUTOMAT_HOST: {{ .Values.app.automatAddress }}
PLATER_TITLE: {{ .Release.Name }}
Expand Down
92 changes: 92 additions & 0 deletions helm/plater/templates/memgraph-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{{- if and (eq .Values.graph.backend "memgraph") (not .Values.graph.external) }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "plater.fullname" . }}-memgraph
labels:
{{- include "plater.labels" . | nindent 4 }}
spec:
serviceName: {{ include "plater.fullname" . }}-memgraph-service
selector:
matchLabels:
{{- include "plater.selectorLabels" . | nindent 6 }}
service-type: memgraph-database
template:
metadata:
labels:
{{- include "plater.selectorLabels" . | nindent 8 }}
service-type: memgraph-database
spec:
{{- if .Values.app.memgraph.dataUrl }}
initContainers:
- name: {{ include "plater.fullname" . }}-memgraph-download-container
image: curlimages/curl:8.16.0
command:
- sh
- -c
- |
echo "Downloading Memgraph dump..."
curl -L -o /data/memgraph.cypher {{ .Values.app.memgraph.dataUrl }}
volumeMounts:
- name: {{ include "plater.fullname" . }}-memgraph-pvc
mountPath: /data
subPath: memgraph_data
resources:
{{- toYaml .Values.app.memgraph.initresources | nindent 12 }}
{{- end }}

containers:
- name: {{ include "plater.fullname" . }}-memgraph-container
image: "{{ .Values.image.memgraph.repository }}:{{ .Values.image.memgraph.tag }}"
imagePullPolicy: {{ .Values.image.memgraph.imagePullPolicy }}
ports:
- name: memgraph-bolt
containerPort: {{ .Values.app.memgraph.boltPort }}
protocol: TCP
command:
- '/run_memgraph.sh'
{{- with .Values.app.memgraph.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
- name: {{ include "plater.fullname" . }}-memgraph-pvc
mountPath: /data
subPath: memgraph_data
- name: {{ include "plater.fullname" . }}-scripts
mountPath: /run_memgraph.sh
subPath: run_memgraph.sh
startupProbe:
{{ toYaml .Values.app.memgraph.startupProbe | indent 12 }}
readinessProbe:
{{ toYaml .Values.app.memgraph.readinessProbe | indent 12 }}
livenessProbe:
{{ toYaml .Values.app.memgraph.livenessProbe | indent 12 }}

restartPolicy: Always
{{ with .Values.app.memgraph.nodeSelector }}
nodeSelector:
{{ toYaml . | nindent 8 }}
{{ end }}
{{ with .Values.app.memgraph.affinity }}
affinity:
{{ toYaml . | nindent 8 }}
{{ end }}
{{ with .Values.app.memgraph.tolerations }}
tolerations:
{{ toYaml . | nindent 8 }}
{{ end }}
volumes:
- name: {{ include "plater.fullname" . }}-scripts
configMap:
name: {{ include "plater.fullname" . }}-configmap
defaultMode: 0777
volumeClaimTemplates:
- metadata:
name: {{ include "plater.fullname" . }}-memgraph-pvc
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: {{ .Values.app.memgraph.storage.size }}
{{ end }}
18 changes: 18 additions & 0 deletions helm/plater/templates/memgraph-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- if and (eq .Values.graph.backend "memgraph") (not .Values.graph.external) }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "plater.fullname" . }}-memgraph-service
labels:
{{- include "plater.labels" . | nindent 4 }}
spec:
type: {{ .Values.app.memgraph.service.type }}
ports:
- port: {{ .Values.app.memgraph.boltPort }}
targetPort: {{ .Values.app.memgraph.boltPort }}
protocol: TCP
name: memgraph-bolt
selector:
{{- include "plater.selectorLabels" . | nindent 4 }}
service-type: memgraph-database
{{ end }}
14 changes: 7 additions & 7 deletions helm/plater/templates/neo4j-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{ if not .Values.externalNeo4j }}
{{- if and (eq .Values.graph.backend "neo4j") (not .Values.graph.external) }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
Expand All @@ -10,19 +10,19 @@ spec:
selector:
matchLabels:
{{- include "plater.selectorLabels" . | nindent 6 }}
service-type: database
service-type: neo4j-database
template:
metadata:
labels:
{{- include "plater.selectorLabels" . | nindent 8 }}
service-type: database
service-type: neo4j-database
spec:
{{- if .Values.dataUrl }}
initContainers:
- name: {{ include "plater.fullname" . }}-neo4j-download-container
image: {{ .Values.image.neo4j.repository }}:{{ .Values.image.neo4j.tag }}
command:
- '/download_data.sh'
- '/download_data_neo4j.sh'
env:
- name: NEO4J_DATA_URL
value: {{ .Values.dataUrl }}
Expand All @@ -33,8 +33,8 @@ spec:
name: {{ include "plater.fullname" . }}-neo4jkp-pvc
subPath: neo4j_data
- name: {{ include "plater.fullname" . }}-scripts
mountPath: /download_data.sh
subPath: download_data.sh
mountPath: /download_data_neo4j.sh
subPath: download_data_neo4j.sh
- name: {{ include "plater.fullname" . }}-neo4j-seed-container
image: {{ .Values.image.neo4j.repository }}:{{ .Values.image.neo4j.tag }}
command:
Expand Down Expand Up @@ -88,7 +88,7 @@ spec:
- name: NEO4J_server_jvm_additional
value: "-XX:+ExitOnOutOfMemoryError -XX:+UseCompressedOops -Dlog4j2.disable.jmx=true -Dlog4j2.formatMsgNoLookups=true"
- name: NEO4J_db_transaction_timeout
value: "{{ .Values.app.Neo4jQueryTimeout }}s"
value: "{{ .Values.app.GRAPH_QUERY_TIMEOUT }}s"
ports:
- name: neo4j-http
containerPort: 7474
Expand Down
22 changes: 22 additions & 0 deletions helm/plater/templates/neo4j-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{- if and (eq .Values.graph.backend "neo4j") (not .Values.graph.external) }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "plater.fullname" . }}-neo4j-service
labels:
{{- include "plater.labels" . | nindent 4 }}
spec:
type: {{ .Values.app.neo4j.service.type }}
ports:
- port: {{ .Values.app.neo4j.httpPort }}
targetPort: {{ .Values.app.neo4j.httpPort }}
protocol: TCP
name: neo4j-http
- port: {{ .Values.app.neo4j.boltPort }}
targetPort: {{ .Values.app.neo4j.boltPort }}
protocol: TCP
name: neo4j-bolt
selector:
{{- include "plater.selectorLabels" . | nindent 4 }}
service-type: neo4j-database
{{ end }}
21 changes: 0 additions & 21 deletions helm/plater/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,3 @@ spec:
selector:
{{- include "plater.selectorLabels" . | nindent 4 }}
service-type: web-server
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "plater.fullname" . }}-neo4j-service
labels:
{{- include "plater.labels" . | nindent 4 }}
spec:
type: {{ .Values.app.neo4j.service.type }}
ports:
- port: {{ .Values.app.neo4j.httpPort }}
targetPort: {{ .Values.app.neo4j.httpPort }}
protocol: TCP
name: neo4j-http
- port: {{ .Values.app.neo4j.boltPort }}
targetPort: {{ .Values.app.neo4j.boltPort }}
protocol: TCP
name: neo4j-bolt
selector:
{{- include "plater.selectorLabels" . | nindent 4 }}
service-type: database
Loading