Skip to content

Commit ca72d8c

Browse files
committed
Initial support helm deployment.
- add helm chart for nebula-studio. Resolve issue: vesoft-inc#20 Signed-off-by: Ji Bin <[email protected]>
1 parent 7b89b3e commit ca72d8c

11 files changed

+430
-0
lines changed

deployment/helm/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.un~

deployment/helm/.helmignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

deployment/helm/Chart.yaml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: v2
2+
name: nebula-studio
3+
description: A Helm chart for nebula-studio
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.
9+
#
10+
# Library charts provide useful utilities or functions for the chart developer. They're included as
11+
# a dependency of application charts to inject those utilities and functions into the rendering
12+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
13+
type: application
14+
15+
# This is the chart version. This version number should be incremented each time you make changes
16+
# to the chart and its templates, including the app version.
17+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18+
version: 0.1.2
19+
20+
# This is the version number of the application being deployed. This version number should be
21+
# incremented each time you make changes to the application. Versions are not expected to
22+
# follow Semantic Versioning. They should reflect the version the application is using.
23+
# It is recommended to use it with quotes.
24+
appVersion: "v3.0.0"

deployment/helm/README.md

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Nebula Graph Studio Helm Chart
2+
3+
## Introduction
4+
This chart bootstraps Nebula Graph Studio deployment on a Kubernetes cluster using the Helm.
5+
6+
## Prerequisites
7+
8+
- Kubernetes 1.14+
9+
- Helm >= 3.2.0
10+
11+
## Install
12+
13+
First, clone repo.
14+
```sh
15+
$ git clone https://github.com/vesoft-inc/nebula-studio.git
16+
```
17+
18+
The chart is under deployment/helm
19+
20+
### Install with a default configurations
21+
22+
Assume using release name: `my-studio`
23+
24+
```
25+
$ cd nebula-studio
26+
$ helm upgrade --install my-studio deployment/helm
27+
```
28+
29+
### Install with a NodePort for external visit
30+
31+
```
32+
$ cd nebula-studio
33+
$ helm upgrade --install my-studio --set service.type=NodePort --set service.port=30070 deployment/helm
34+
```
35+
36+
After success installed, we could visit nebula-studio via http://address-of-node:30070/
37+
38+
## Uninstall
39+
40+
```
41+
$ helm uninstall my-studio
42+
```
43+
44+
## Configuration
45+
46+
47+
| Parameter | Description | Default |
48+
|-----------|-------------|---------|
49+
| replicaCount | Replica Count for StatefulSet | 0 |
50+
| image.httpGateway.repository | The repository for http grateway's image | vesoft/nebula-http-gateway |
51+
| image.nebulaImporter.repository | The repository for nebula-importer ateway's image | vesoft/nebula-importer |
52+
| image.nebulaStudio.repository | The repository for nebula graph studio's image | vesoft/nebula-graph-studio |
53+
| image.nginx.repository | The repository for nginx's image | nginx |
54+
| image.httpGateway.tag | The tag for http grateway's image | v2 |
55+
| image.nebulaImporter.tag | The tag for nebula-importer ateway's image | v2 |
56+
| image.nebulaStudio.tag | The tag for nebula graph studio's image | v3 |
57+
| image.nginx.tag | The tag for nginx's image | alpine |
58+
| service.type | The service type, should be one of ['NodePort', 'ClusterIP', 'LoadBalancer'] | ClusterIP |
59+
| service.port | The expose port for nebula-graph-studio's web | 7001 |
60+
| resources.httpGateway | The resource limits/requests for http gateway | {} |
61+
| resources.nebulaImporter | The resource limits/requests for nebular importer | {} |
62+
| resources.nebulaStudio | The resource limits/requests for nebula studio | {} |
63+
| resources.nginx | The resource limits/requests for nginx | {} |
64+
| persistent.storageClassName | The storageClassName for PVC if not using default | "" |
65+
| persistent.size | The size for upload-data persistent storage | 5Gi |
66+

deployment/helm/templates/NOTES.txt

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
1. Get the application URL by running these commands:
2+
{{- if contains "NodePort" .Values.service.type }}
3+
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "nebula-studio.fullname" . }})
4+
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
5+
echo http://$NODE_IP:$NODE_PORT
6+
{{- else if contains "LoadBalancer" .Values.service.type }}
7+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
8+
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "nebula-studio.fullname" . }}'
9+
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "nebula-studio.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
10+
echo http://$SERVICE_IP:{{ .Values.service.port }}
11+
{{- else if contains "ClusterIP" .Values.service.type }}
12+
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "nebula-studio.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
13+
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
14+
echo "Visit http://127.0.0.1:8080 to use your application"
15+
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
16+
{{- end }}
+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "nebula-studio.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "nebula-studio.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "nebula-studio.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "nebula-studio.labels" -}}
37+
helm.sh/chart: {{ include "nebula-studio.chart" . }}
38+
{{ include "nebula-studio.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "nebula-studio.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "nebula-studio.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: {{ include "nebula-studio.fullname" . }}-nginx-config
5+
data:
6+
nginx.conf: |
7+
server {
8+
listen 7000;
9+
server_name 127.0.0.1;
10+
11+
location / {
12+
proxy_pass http://127.0.0.1:7001;
13+
proxy_redirect off;
14+
proxy_set_header Host $host;
15+
proxy_set_header X-Real-IP $remote_addr;
16+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
17+
proxy_set_header X-Forwarded-Host $server_name;
18+
client_max_body_size 1024M;
19+
}
20+
21+
location /upload-dir/ {
22+
root /;
23+
autoindex on;
24+
}
25+
26+
location ~ ^/api-nebula/([A-Za-z0-9\/]+) {
27+
proxy_pass http://127.0.0.1:8080/api/$1;
28+
}
29+
30+
location ~ ^/api-import/([A-Za-z0-9\/]+) {
31+
proxy_pass http://127.0.0.1:5699/$1;
32+
}
33+
}
+140
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "nebula-studio.fullname" . }}
5+
labels:
6+
{{- include "nebula-studio.labels" . | nindent 4 }}
7+
spec:
8+
replicas: {{ .Values.replicaCount }}
9+
selector:
10+
matchLabels:
11+
{{- include "nebula-studio.selectorLabels" . | nindent 6 }}
12+
template:
13+
metadata:
14+
{{- with .Values.podAnnotations }}
15+
annotations:
16+
{{- toYaml . | nindent 8 }}
17+
{{- end }}
18+
labels:
19+
{{- include "nebula-studio.selectorLabels" . | nindent 8 }}
20+
spec:
21+
{{- with .Values.imagePullSecrets }}
22+
imagePullSecrets:
23+
{{- toYaml . | nindent 8 }}
24+
{{- end }}
25+
containers:
26+
- name: http-gateway
27+
image: "{{ .Values.image.httpGateway.repository }}:{{ .Values.image.httpGateway.tag | default .Chart.AppVersion }}"
28+
imagePullPolicy: {{ .Values.image.pullPolicy }}
29+
env:
30+
- name: USER
31+
value: root
32+
ports:
33+
- containerPort: 8080
34+
protocol: TCP
35+
livenessProbe:
36+
httpGet:
37+
path: /
38+
port: 8080
39+
readinessProbe:
40+
httpGet:
41+
path: /
42+
port: 8080
43+
resources:
44+
{{- toYaml .Values.resources.httpGateway | nindent 12 }}
45+
- name: nebula-importer
46+
image: "{{ .Values.image.nebulaImporter.repository }}:{{ .Values.image.nebulaImporter.tag | default .Chart.AppVersion }}"
47+
imagePullPolicy: {{ .Values.image.pullPolicy }}
48+
ports:
49+
- containerPort: 5699
50+
protocol: TCP
51+
livenessProbe:
52+
httpGet:
53+
path: /tasks
54+
port: 5699
55+
readinessProbe:
56+
httpGet:
57+
path: /tasks
58+
port: 5699
59+
resources:
60+
{{- toYaml .Values.resources.nebulaImporter | nindent 12 }}
61+
command:
62+
- nebula-importer
63+
- "--port=5699"
64+
- "--callback=http://127.0.0.1:7000/api/import/finish"
65+
volumeMounts:
66+
- name: upload-data
67+
mountPath: /uploads
68+
- name: nebula-studio
69+
image: "{{ .Values.image.nebulaStudio.repository }}:{{ .Values.image.nebulaStudio.tag | default .Chart.AppVersion }}"
70+
imagePullPolicy: {{ .Values.image.pullPolicy }}
71+
env:
72+
- name: UPLOAD_DIR
73+
value: /uploads
74+
ports:
75+
- containerPort: 7001
76+
protocol: TCP
77+
livenessProbe:
78+
httpGet:
79+
path: /
80+
port: 7001
81+
readinessProbe:
82+
httpGet:
83+
path: /
84+
port: 7001
85+
# Patch due to https://github.com/vesoft-inc/nebula-studio/issues/22
86+
command:
87+
- sh
88+
- -c
89+
- |
90+
sed 's/\(.*docker-start.*studio\)",/\1 --workers=3",/' -i package.json
91+
npm run docker-start
92+
resources:
93+
{{- toYaml .Values.resources.nebulaStudio | nindent 12 }}
94+
volumeMounts:
95+
- name: upload-data
96+
mountPath: /uploads
97+
- name: nginx
98+
image: "{{ .Values.image.nginx.repository }}:{{ .Values.image.nginx.tag | default .Chart.AppVersion }}"
99+
imagePullPolicy: {{ .Values.image.pullPolicy }}
100+
ports:
101+
- containerPort: 7000
102+
protocol: TCP
103+
livenessProbe:
104+
httpGet:
105+
path: /
106+
port: 7000
107+
readinessProbe:
108+
httpGet:
109+
path: /
110+
port: 7000
111+
resources:
112+
{{- toYaml .Values.resources.nginx | nindent 12 }}
113+
volumeMounts:
114+
- name: upload-data
115+
mountPath: /uploads
116+
- name: nginx-config
117+
mountPath: /etc/nginx/conf.d/nebula.conf
118+
subPath: nginx.conf
119+
volumes:
120+
- name: nginx-config
121+
configMap:
122+
name: {{ include "nebula-studio.fullname" . }}-nginx-config
123+
items:
124+
- key: nginx.conf
125+
path: nginx.conf
126+
- name: upload-data
127+
persistentVolumeClaim:
128+
claimName: {{ include "nebula-studio.fullname" . }}-upload-data
129+
{{- with .Values.nodeSelector }}
130+
nodeSelector:
131+
{{- toYaml . | nindent 8 }}
132+
{{- end }}
133+
{{- with .Values.affinity }}
134+
affinity:
135+
{{- toYaml . | nindent 8 }}
136+
{{- end }}
137+
{{- with .Values.tolerations }}
138+
tolerations:
139+
{{- toYaml . | nindent 8 }}
140+
{{- end }}

deployment/helm/templates/pvc.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: v1
2+
kind: PersistentVolumeClaim
3+
metadata:
4+
name: {{ include "nebula-studio.fullname" . }}-upload-data
5+
spec:
6+
accessModes: ["ReadWriteOnce"]
7+
{{- if .Values.persistent.storageClassName }}
8+
storageClassName: {{ .Values.persistent.storageClassName }}
9+
{{- end }}
10+
resources:
11+
requests:
12+
{{- if .Values.persistent.size }}
13+
storage: {{ .Values.persistent.size }}
14+
{{- else }}
15+
storage: 5Gi
16+
{{- end }}
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "nebula-studio.fullname" . }}-web
5+
labels:
6+
{{- include "nebula-studio.labels" . | nindent 4 }}
7+
spec:
8+
type: {{ .Values.service.type }}
9+
ports:
10+
- port: {{ .Values.service.port }}
11+
targetPort: 7000
12+
{{- if eq .Values.service.type "NodePort" }}
13+
nodePort: {{ .Values.service.port }}
14+
{{- end }}
15+
protocol: TCP
16+
selector:
17+
{{- include "nebula-studio.selectorLabels" . | nindent 4 }}

0 commit comments

Comments
 (0)