Neo4j - 如何使用Docker镜像从安全连接访问bolt?

时间:2017-08-21 05:19:55

标签: angular docker neo4j google-kubernetes-engine

Docker的新手。所以我设法将官方的Neo4j EE Docker映像部署到Google容器引擎,当从localhost运行我的Angular应用程序时,一切都很好(因为它不是来自安全连接)。

但是,当我将应用程序部署到Firebase时,应用程序会从安全连接中对DB / Docker容器进行所有调用,这会导致以下错误:

Mixed Content: The page at 'https://luminate-testing-24112016.firebaseapp.com/dashboard'
was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint
'ws://35.196.251.244:7687/'. This request has been blocked; this endpoint must be available
over WSS.

请注意,无论Docker镜像是部署到GKE还是AWS,都会发生这种情况。

以下是我的yaml文件:

apiVersion: v1
kind: Service
metadata:
  name: neo4j
spec:
  type: LoadBalancer
  loadBalancerSourceRanges:
  - 0.0.0.0/0
  ports:
  - name: browser
    port: 7474
    protocol: TCP
  - name: bolt
    port: 7687
    protocol: TCP
  - name: https
    port: 7473
    protocol: TCP
  selector:
    app: neo4j

apiVersion: "apps/v1beta1"
kind: StatefulSet
metadata:
  name: neo4j
spec:
  serviceName: neo4j
  replicas: 1
  template:
    metadata:
      labels:
        app: neo4j
    spec:
      containers:
      - name: neo4j
        image: luminateqr/neo4j-with-apoc:latest
        imagePullPolicy: Always
        ports:
        - name: browser
          containerPort: 7474
        - name: bolt
          containerPort: 7687
        - name: https
          containerPort: 7473
        volumeMounts:
        - name: neo4j-data
          mountPath: /data
  volumeClaimTemplates:
  - metadata:
      name: neo4j-data
      annotations:
        volume.beta.kubernetes.io/storage-class: slow
    spec:
      accessModes: [ "ReadWriteOnce" ]
      resources:
        requests:
          storage: 50Gi

kind: StorageClass
apiVersion: storage.k8s.io/v1beta1
metadata:
  name: slow
provisioner: kubernetes.io/gce-pd
parameters:
  type: pd-standard
  zone: us-east1-c

有几个问题和答案浮出水面似乎相似,但我无法弄清楚哪些适用,哪些不适用。我知道在TLS上设置一个websocket与它有关,但是没有关于如何做到这一点的一致和/或明确的答案(这看起来很奇怪,因为这可能是一种常见的情况)

1 个答案:

答案 0 :(得分:0)

您应该在neo4j.conf中设置此参数

dbms.connector.bolt.tls_level=REQUIRED

如果是泊坞窗,您可以选择此处所述的选项:Config file for Neo4j Docker Image