Skip to content

Commit

Permalink
Merge pull request #22 from memgraph/release-0.1.3
Browse files Browse the repository at this point in the history
Release 0.1.3
  • Loading branch information
katarinasupe authored May 23, 2024
2 parents c1cc606 + ed537e4 commit 4cf43e8
Show file tree
Hide file tree
Showing 30 changed files with 1,259 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @antejavor @katarinasupe
* @antejavor @katarinasupe @as51340
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ repos:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
exclude: ^charts/memgraph/templates/
exclude: ^charts/(memgraph|memgraph-lab|memgraph-high-availability)/templates/
- id: check-json
- id: mixed-line-ending
- id: check-merge-conflict
Expand Down
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Welcome to the Memgraph Helm Charts repository. This repository provides Helm ch

## Available charts
- [**Memgraph standalone**](#memgraph-standalone)
- [**Memgraph Lab**](#memgraph-lab)
- [**Memgraph high availability](#memgraph-high-availability)

## Prerequisites
Helm version 3 or above installed.
Expand Down Expand Up @@ -42,6 +44,41 @@ Once Memgraph is installed, you can access it using the provided services and en

To upgrade or uninstall a deployed Memgraph release, you can use the `helm upgrade` or `helm uninstall` commands, respectively. Refer to the [Helm documentation](https://helm.sh/docs/) for more details on these commands.

## Memgraph lab
Deploys Memgraph Lab.
For detailed information and usage instructions, please refer to the [chart's individual README file](./charts/memgraph-lab/README.md).

To install Memgraph Lab, run the following command:

```
helm install my-release memgraph/memgraph-lab
```
Replace `my-release` with a name of your choice for the release.


Refer to the [Data visualization in Memgraph Lab](https://memgraph.com/docs/data-visualization) for details on how to connect to and interact with Memgraph.

To upgrade or uninstall a deployed Memgraph release, you can use the `helm upgrade` or `helm uninstall` commands, respectively. Refer to the [Helm documentation](https://helm.sh/docs/) for more details on these commands.


## Memgraph high availability
Deploys high available Memgraph cluster, that includes two data instances and three coordinators.

For detailed information and usage instructions, please refer to the [chart's individual README file](./charts/memgraph/README.md).

To install Memgraph standalone, run the following command:

```
helm install my-release memgraph/memgraph-high-availability --set memgraph.env.MEMGRAPH_ENTERPRISE_LICENSE=<your-license>,memgraph.env.MEMGRAPH_ORGANIZATION_NAME=<your-organization-name>
```
Replace `my-release` with a name of your choice for the release.


Once Memgraph cluster is up and running, you can access it using the provided services and endpoints. Refer to the [Memgraph documentation](https://memgraph.com/docs/memgraph/connect-to-memgraph) for details on how to connect to and interact with Memgraph.

To upgrade or uninstall a deployed Memgraph release, you can use the `helm upgrade` or `helm uninstall` commands, respectively. Refer to the [Helm documentation](https://helm.sh/docs/) for more details on these commands.


## Contributing
Contributions are welcome! If you have any improvements, bug fixes, or new charts to add, please follow the contribution guidelines outlined in the [`CONTRIBUTING.md`](https://github.com/memgraph/helm-charts/blob/main/CONTRIBUTING.md) file. If you have questions and are unsure of how to contribute, please join our Discord server to get in touch with us.

Expand Down
23 changes: 23 additions & 0 deletions charts/memgraph-high-availability/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
29 changes: 29 additions & 0 deletions charts/memgraph-high-availability/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: v2
name: memgraph-high-availability
description: A Helm chart for Kubernetes with Memgraph High availabiliy capabilites

version: 0.1.0
appVersion: "2.17.0"

type: application

keywords:
- memgraph
- graph
- database
- cypher
- analytics
- high-availability

icon: https://public-assets.memgraph.com/memgraph-logo/logo-large.png

home: https://memgraph.com/

sources:
- "https://github.com/memgraph/memgraph"
- "https://github.com/memgraph/helm-charts"


maintainers:
- name: Memgraph
email: [email protected]
72 changes: 72 additions & 0 deletions charts/memgraph-high-availability/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
## Helm chart for Memgraph high availability cluster
A Helm Chart for deploying Memgraph in [high availability setup](https://memgraph.com/docs/clustering/high-availability).

Memgraph HA cluster includes 3 coordinators, 2 data instances by default. The cluster setup is performed via the cluster-setup job. The HA cluster is still work in progress and started with "--experimental-enabled=high-availability".
The cluster is started in the configuration without the node selector, which means that in the current configuration, it is not highly available if the node fails.

## Installing the Memgraph HA Helm Chart
To install the Memgraph HA Helm Chart, follow the steps below:
```
helm install <release-name> memgraph/memgraph-high-availability --set memgraph.env.MEMGRAPH_ENTERPRISE_LICENSE=<your-license>,memgraph.env.MEMGRAPH_ORGANIZATION_NAME=<your-organization-name>
```
Replace `<release-name>` with a name of your choice for the release and set the enterprise license.

## Changing the default chart values
To change the default chart values, run the command with the specified set of flags:
```
helm install <resource-name> memgraph/memgraph-high-availability --set <flag1>=<value1>,<flag2>=<value2>,...
```
Or you can modify a `values.yaml` file and override the desired values:
```
helm install <resource-name> memgraph/memgraph-high-availability-f values.yaml
```


## Configuration Options

The following table lists the configurable parameters of the Memgraph chart and their default values.

| Parameter | Description | Default |
|---------------------------------------------|-----------------------------------------------------------------------------------------------------|-----------------------------------------|
| `memgraph.image.repository` | Memgraph Docker image repository | `memgraph/memgraph` |
| `memgraph.image.tag` | Specific tag for the Memgraph Docker image. Overrides the image tag whose default is chart version. | `2.17.0` |
| `memgraph.image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `memgraph.env.MEMGRAPH_ENTERPRISE_LICENSE` | Memgraph enterprise license | `<your-license>` |
| `memgraph.env.MEMGRAPH_ORGANIZATION_NAME` | Organization name | `<your-organization-name>` |
| `memgraph.probes.startup.failureThreshold` | Startup probe failure threshold | `30` |
| `memgraph.probes.startup.periodSeconds` | Startup probe period in seconds | `10` |
| `memgraph.probes.readiness.initialDelaySeconds` | Readiness probe initial delay in seconds | `5` |
| `memgraph.probes.readiness.periodSeconds` | Readiness probe period in seconds | `5` |
| `memgraph.probes.liveness.initialDelaySeconds` | Liveness probe initial delay in seconds | `30` |
| `memgraph.probes.liveness.periodSeconds` | Liveness probe period in seconds | `10` |
| `memgraph.data.volumeClaim.storagePVC` | Enable storage PVC | `true` |
| `memgraph.data.volumeClaim.storagePVCSize` | Size of the storage PVC | `1Gi` |
| `memgraph.data.volumeClaim.logPVC` | Enable log PVC | `false` |
| `memgraph.data.volumeClaim.logPVCSize` | Size of the log PVC | `256Mi` |
| `memgraph.coordinators.volumeClaim.storagePVC` | Enable storage PVC for coordinators | `true` |
| `memgraph.coordinators.volumeClaim.storagePVCSize` | Size of the storage PVC for coordinators | `1Gi` |
| `memgraph.coordinators.volumeClaim.logPVC` | Enable log PVC for coordinators | `false` |
| `memgraph.coordinators.volumeClaim.logPVCSize` | Size of the log PVC for coordinators | `256Mi` |
| `data` | Configuration for data instances | See `data` section |
| `coordinators` | Configuration for coordinator instances | See `coordinators` section |

For the `data` and `coordinators` sections, each item in the list has the following parameters:

| Parameter | Description | Default |
|---------------------------------------------|-----------------------------------------------------------------------------------------------------|-----------------------------------------|
| `id` | ID of the instance | `0` for data, `1` for coordinators |
| `boltPort` | Bolt port of the instance | `7687` |
| `managementPort` (data only) | Management port of the data instance | `10000` |
| `replicationPort` (data only) | Replication port of the data instance | `20000` |
| `coordinatorPort` (coordinators only) | Coordinator port of the coordinator instance | `12000` |
| `args` | List of arguments for the instance | See `args` section |

The `args` section contains a list of arguments for the instance. The default values are the same for all instances:

```markdown
- "--also-log-to-stderr"
- "--log-level=TRACE"
- "--replication-restore-state-on-startup=true"
```

For all available database settings, refer to the [Configuration settings reference guide](https://memgraph.com/docs/memgraph/reference-guide/configuration).
15 changes: 15 additions & 0 deletions charts/memgraph-high-availability/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Thank you for installing the Memgraph High-availability cluster! 🎉

Memgraph HA cluster includes 3 coordinators, 2 data instances by default. The cluster setup is performed via the cluster-setup job. The HA cluster is still work in progress and started with "--experimental-enabled=high-availability".
The cluster is started in the configuration without the node selector, which means that in the current configuration, it is not highly available if the node fails.

The cluster setup requires the proper enterprise license to work since HA is an enterprise feature.

You can connect to Memgraph instances via Lab, mgconsole, or any other client. By default, all Memgraph instances (coordinators and data instances) listen on port 7687 for a bolt connection.
Make sure your are connecting to the correct ip address and port. For details check the configuration on your cloud provider(aws, gcp, azure, etc.)

If you are connecting via mgconsole, you can use the following command:

mgconsole --host <your-instance-ip> --port <your-instance-port>

If you are connecting via Lab, specify your instance IP address and port in Memgraph Lab GUI.
44 changes: 44 additions & 0 deletions charts/memgraph-high-availability/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

{{/* Full name of the application */}}
{{- define "memgraph.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end -}}
{{- end -}}



{{/* Define the chart version and app version */}}
{{- define "memgraph.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end -}}


{{/* Define the name of the application */}}
{{- define "memgraph.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end -}}


{{/* Common labels */}}
{{- define "memgraph.labels" -}}
app.kubernetes.io/name: {{ include "memgraph.name" . }}
helm.sh/chart: {{ include "memgraph.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}


{{/*
Create the name of the service account to use
*/}}
{{- define "memgraph.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "memgraph.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
51 changes: 51 additions & 0 deletions charts/memgraph-high-availability/templates/cluster-setup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
apiVersion: batch/v1
kind: Job
metadata:
name: memgraph-setup
spec:
template:
spec:
containers:
- name: memgraph-setup
image: memgraph/memgraph:2.17.0
command: ["/bin/bash", "-c"]
args:
- |
# Install netcat
echo "Installing netcat..."
apt-get update && apt-get install -y netcat-openbsd
# Wait until the pods are available
echo "Waiting for pods to become available for Bolt connection..."
until nc -z memgraph-coordinator-1.default.svc.cluster.local 7687; do sleep 1; done
until nc -z memgraph-coordinator-2.default.svc.cluster.local 7687; do sleep 1; done
until nc -z memgraph-coordinator-3.default.svc.cluster.local 7687; do sleep 1; done
until nc -z memgraph-data-0.default.svc.cluster.local 7687; do sleep 1; done
until nc -z memgraph-data-1.default.svc.cluster.local 7687; do sleep 1; done
echo "Pods are available for Bolt connection!"
sleep 5
# Run the mgconsole commands
echo "Running mgconsole commands..."
echo 'ADD COORDINATOR 2 WITH CONFIG {"bolt_server": "memgraph-coordinator-2.default.svc.cluster.local:7687", "coordinator_server": "memgraph-coordinator-2.default.svc.cluster.local:12000"};' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 7687
echo 'ADD COORDINATOR 3 WITH CONFIG {"bolt_server": "memgraph-coordinator-3.default.svc.cluster.local:7687", "coordinator_server": "memgraph-coordinator-3.default.svc.cluster.local:12000"};' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 7687
echo 'REGISTER INSTANCE instance_1 WITH CONFIG {"bolt_server": "memgraph-data-0.default.svc.cluster.local:7687", "management_server": "memgraph-data-0.default.svc.cluster.local:10000", "replication_server": "memgraph-data-0.default.svc.cluster.local:20000"};' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 7687
echo 'REGISTER INSTANCE instance_2 WITH CONFIG {"bolt_server": "memgraph-data-1.default.svc.cluster.local:7687", "management_server": "memgraph-data-1.default.svc.cluster.local:10000", "replication_server": "memgraph-data-1.default.svc.cluster.local:20000"};' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 7687
echo 'SET INSTANCE instance_1 TO MAIN;' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 7687
sleep 3
echo "SHOW INSTANCES on coord1"
echo 'SHOW INSTANCES;' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 7687
echo "SHOW INSTANCES on coord2"
echo 'SHOW INSTANCES;' | mgconsole --host memgraph-coordinator-2.default.svc.cluster.local --port 7687
echo "SHOW INSTANCES on coord3"
echo 'SHOW INSTANCES;' | mgconsole --host memgraph-coordinator-3.default.svc.cluster.local --port 7687
echo "RETURN 0 on 1st data instance"
echo 'RETURN 0;' | mgconsole --host memgraph-data-0.default.svc.cluster.local --port 7687
echo "RETURN 0 on 2nd data instance"
echo 'RETURN 0;' | mgconsole --host memgraph-data-1.default.svc.cluster.local --port 7687
securityContext:
runAsUser: 0

restartPolicy: Never
backoffLimit: 4
Loading

0 comments on commit 4cf43e8

Please sign in to comment.