本文档涉及 Neo4j Labs 旗下不受支持的 NeoDash 版本。如需使用受支持的 NeoDash 产品,请参阅 NeoDash 商业版

构建 & 运行

本文档涉及 Neo4j Labs 旗下不受支持的 NeoDash 版本。如需使用受支持的 NeoDash 产品,请参阅 NeoDash 商业版

要开始开发该应用程序,您需要设置开发环境。

使用 yarn 运行 & 构建

NeoDash 使用 React 构建。您需要安装 yarn 来运行网页应用。

使用最近版本的 yarnnode 来构建 NeoDash。该应用已在 yarn 1.22.17 & node v18.8.0 上测试通过。

在开发模式下运行应用程序

  • 克隆此仓库。

  • 打开终端并进入您刚克隆的目录。

  • 运行 yarn install 安装必要的依赖。

  • 运行 yarn run dev 在开发模式下启动应用。

  • 应用应可在 https://:3000 访问。

为生产环境构建应用

  • 按照上述步骤克隆仓库并安装依赖。

  • 执行 yarn run build。这将在您的项目目录中创建一个 build 文件夹。

  • 将 build 文件夹的内容部署到 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 镜像

A pre-built Docker image is available 在 DockerHub 上. This image is built using the default configuration (running in editor mode, without SSO).

自行构建镜像

确保已安装最近版本的 docker,以构建多阶段 NeoDash 镜像并运行它。

在 Unix(Mac/Linux)系统上

docker build . -t neodash

如果您使用 Windows,可能需要在命令前加上 winpty 前缀

winpty docker build . -t neodash

构建完成后,您可以使用以下方式运行镜像:

docker run -it –rm -p 5005:5005 neodash

在 Kubernetes 上运行

使用 YAML 文件部署

YAML 示例可在 NeoDash 仓库获取。以下是创建集群中 NeoDash pod 的 pod 定义 YAML 文件示例

apiVersion: v1
kind: Pod
metadata:
  name: neodash
  labels:
    project: neodash
spec:
  containers:
    - name: neodash
      image: neo4jlabs/neodash:latest
      ports:
        - containerPort: 5005

创建 Kubernetes Service 以暴露应用程序

apiVersion: v1
kind: Service
metadata:
    name: neodash-svc
spec:
    type: LoadBalancer
    ports:
    - port: 5005
      targetPort: 5005
    selector:
      project: neodash

使用 Helm Chart 部署

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: ''
© . This site is unofficial and not affiliated with Neo4j, Inc.