构建与运行
|
本文档适用于 Neo4j Labs 中不受支持的 NeoDash 版本。对于受支持的 NeoDash 版本用户,请参阅NeoDash 商业版。 |
要开始开发应用程序,您需要设置开发环境。
使用 yarn 运行和构建
NeoDash 使用 React 构建。您需要安装 yarn 才能运行 Web 应用程序。
请使用最新版本的
yarn和node来构建 NeoDash。该应用程序已使用 yarn 1.22.17 和 node v18.8.0 进行测试。
要在开发模式下运行应用程序
-
打开终端并导航到您刚克隆的目录。
-
运行
yarn install以安装必要的依赖项。 -
运行
yarn run dev以在开发模式下运行应用程序。 -
应用程序应在 https://:3000 可用。
要构建用于生产的应用程序
-
按照上述步骤克隆存储库并安装依赖项。
-
执行
yarn run build。这将在您的项目目录中创建一个名为build的文件夹。 -
将 build 文件夹的内容部署到 Web 服务器。然后您应该能够运行 Web 应用程序。
使用 Docker 本地运行
从 Docker Hub 拉取最新镜像以在本地运行应用程序
# Run the application on https://:5005 docker pull neo4jlabs/neodash:latest docker run -it --rm -p 5005:5005 neo4jlabs/neodash # If you want to run on a custom port, set an environment variable export NGINX_PORT=5008 docker run -it --rm -e NGINX_PORT=5008 -p 5008:5008 neo4jlabs/neodash
Windows 用户可能需要在
docker run命令前加上winpty。
构建 Docker 镜像
预构建的 Docker 镜像可在 DockerHub 上获取。此镜像使用默认配置构建(以编辑器模式运行,不带 SSO)。
在 Kubernetes 上运行
要使用 YAML 文件进行部署
YAML 示例可在 NeoDash 存储库 中找到。以下是一个 pod 定义 YAML 文件的示例,用于在集群中创建 NeoDash pod
apiVersion: v1
kind: Pod
metadata:
name: neodash
labels:
project: neodash
spec:
containers:
- name: neodash
image: neo4jlabs/neodash:latest
ports:
- containerPort: 5005
创建 Kubernetes 服务以暴露应用程序
apiVersion: v1
kind: Service
metadata:
name: neodash-svc
spec:
type: LoadBalancer
ports:
- port: 5005
targetPort: 5005
selector:
project: neodash
要使用 Helm Charts 进行部署
Kubernetes Helm chart 可在 NeoDash 存储库 中找到,以下是 Helm chart values.yaml 文件的完整示例,
# Name override or full name override
nameOverride: ''
fullnameOverride: neodash-test
# Number of pods
replicaCount: 1
# Image Details
image:
repository: neo4jlabs/neodash
pullPolicy: IfNotPresent
tag: 'latest'
imagePullSecrets: [] # Image pull secret if any
# Pod annotations, labels and security context
podAnnotations: {}
podLabels: {}
podSecurityContext: {}
# Mode configuration using environment variables
# Set reader mode environment variables when enable_reader_mode is true
enable_reader_mode: true
env:
- name: "ssoEnabled"
value: "false"
- name: "standalone"
value: "true"
- name: "standaloneProtocol"
value: "neo4j+s"
- name: "standaloneHost"
value: "localhost"
- name: "standalonePort"
value: "7687"
- name: "standaloneDatabase"
value: neo4j
- name: "standaloneDashboardName"
value: "test"
- name: "standaloneDashboardDatabase"
value: neo4j
- name: "standaloneAllowLoad"
value: "false"
- name: "standaloneLoadFromOtherDatabases"
value: "false"
- name: "standaloneMultiDatabase"
value: "false"
# Environment variable from secret
envFromSecrets: []
# standaloneUsername:
# secretName: "neo4j-connection-secrets"
# key: "username"
# standalonePassword:
# secretName: "neo4j-connection-secrets"
# key: "password"
# Service details
service:
type: LoadBalancer # Can also be ClusterIP or NodePort
port: 5005 # For the service to listen in for Traffic
targetPort: 5005 # Target port is the container port
annotations: {} # Service annotations for the LoadBalance
# Ingress
ingress:
enabled: false # Enable Kubernetes Ingress
className: 'alb' # Class Name
annotations: {} # Cloud LoadBalancer annotations
hosts: []
# - host: neodash.example.com
# paths:
# - path: '/'
# pathType: Prefix
tls: []
# Pod resources request, limits and health check
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "128Mi"
cpu: "500m"
livenessProbe:
httpGet:
path: /*
port: 5005
readinessProbe:
httpGet:
path: /*
port: 5005
# Pod Autoscaler
autoscaling:
enabled: false
# minReplicas: 1
# maxReplicas: 100
# targetCPUUtilizationPercentage: 80
# Pod Volumes
volumes: []
volumeMounts: []
# Service Account
serviceAccount:
create: true
automount: true
# annotations: {}
# name: ''