Hi,
I need help. I am not able to configure TLS on server and connect to server with Javascript client.
I use self-signed certificates generated with:
openssl genrsa -aes256 -out dgraph_key.pem 4096
openssl req -new -key dgraph_key.pem -out dgraph.csr
cp dgraph_key.pem dgraph_key.pem.org
openssl rsa -in dgraph_key.pem.org -out dgraph_key.pem
openssl x509 -req -days 7300 -in dgraph.csr -signkey dgraph_key.pem -out dgraph.crt
I run dGraph with docker compose:
version: "3.2"
services:
zero:
image: dgraph/dgraph:master
volumes:
- type: bind
source: /data/dgraph/data
target: /dgraph
ports:
- 5080:5080
- 6080:6080
restart: on-failure
command: dgraph zero --my=zero:5080
server:
image: dgraph/dgraph:master
volumes:
- type: bind
source: /data/dgraph/data
target: /dgraph
- type: bind
source: /data/dgraph/ssl
target: /etc/ssl/private
ports:
- 8080:8080
- 9080:9080
restart: on-failure
command: dgraph server --my=server:7080 --lru_mb=2048 --zero=zero:5080 --tls_on --tls_cert='/etc/ssl/private/dgraph.crt' --tls_cert_key='/etc/ssl/private/dgraph_key.pem' --tls_client_auth='REQUEST'
ratel:
image: dgraph/dgraph:master
volumes:
- type: volume
source: dgraph
target: /dgraph
volume:
nocopy: true
ports:
- 8000:8000
command: dgraph-ratel
volumes:
dgraph:
My configuration for client is:
const dgraph = require("dgraph-js");
const grpc = require("grpc");
const fs = require("fs");
const clientStub = new dgraph.DgraphClientStub(
"localhost:9080",
grpc.credentials.createSsl(fs.readFileSync('/data/dgraph/ssl/dgraph.crt'))
);
const dgraphClient = new dgraph.DgraphClient(clientStub);
When I run query I get only this error:
Error: 14 UNAVAILABLE: Connect Failed
What I am doing wrong?
Thank you