Here is my problem : I cannot connect Internally (but externally it works) a bloom docker container to the neo4j docker container through the bolt port (7687).
Summary
I’m setting up a docker based project with :
- a Neo4j (GraphQL) as the database, in a docker container
- a Bloom server as the neo4j visualiser, that I’m including in an iframe (for lack of a better option now) in a react app
- a react app hosted on a node:14-alpine docker image.
Its all hosted in a AWS EC2 Linux instance. All containers are on the same docker network, and when I ping them, either using their ip address of their docker name, or use curl to see if they can talk to each other, the connections all appear to work fine.
What I tried
- If I go to http://my.aws.ec.instance:7474 : I can see and use the Neo4j browser app, no problem.
- If I go to http://my.aws.ec.instance:7687 (the direct bolt connection), I get the message not «a WebSocket handshake request: missing upgrade» but it doesn’t appear to be a problem even though that where I’m supposed to get connected.
- From inside my bloom container, when I do ‘curl my.aws.ec.instance:7687, I get the same message.
- ‘db’ is my docker-compose service, ‘neo4j_c’ is the neo4j container name.
- When I do ‘curl db:7687' of 'curl 172.30.0.2:7687' (the ip of my neo4j container) or curl neo4j_c:7687 , i get the same message («a WebSocket handshake request: missing upgrade»). I then assume that theses connections are working the same way.
If I go to http://my.aws.ec.instance:8000, the bloom ‘app’ is up and running, but that is where I’m stuck.
To tell bloom where to find the database, I have to put the address in the ‘discovery.json’ file at / of the container, like this.
"bolt": "bolt://my_db_address:7687"
If I use the public address "bolt": "bolt://my_ec2_instance_address:7687», it work and connect to the neo4j database container, but externally, which is definitely not what I want.
After trying to connect ‘internally’, using either the container IP address, or its name, I would just not connect, and I just can’t figure out why. I tried :
"bolt": "bolt://db:7687"
"bolt": "bolt://neo4j_c:7687"
"bolt": "bolt://172.30.0.2:7687"
and many more combinaisons, with and without ports number, protocals etc... the only one working being :
"bolt": "bolt://my_aws_ec2_public_instance:7687"
but I'm can't work with that, there are on the same network and should connect locally.
Can you guys help me out ? I probably set up something wrong... Please ask me for any other informations you might need.
I hope I made it clear enough. Thanks in advance for any contribution.
Additional informations
Docker version 19.03.6-ce, build 369ce74.
docker-compose version 1.27.0, build 980ec85b
the docker-compose file :
services:
db:
container_name: neo4j_c
image: neo4j:4.1.1-enterprise
environment:
- NEO4J_ACCEPT_LICENSE_AGREEMENT=yes
ports:
- 7473:7473
- 7474:7474
- 7687:7687
volumes:
- $HOME/neo4j/data:/data
networks:
- ggnet
bloom:
container_name: bloom_c
build:
context: ./
dockerfile: bloom_dockerfile
volumes:
- ./bloom:/usr/share/nginx/html
ports:
- 8000:80
depends_on:
- db
networks:
- ggnet
networks:
ggnet:
name: ggnet_n
driver: bridge
And the simple bloom dockerfile :
FROM nginx
COPY ./bloom/discovery.json /
bloom nginx container default.conf :
listen 80;
listen [::]:80;
listen 7687; #JUST ADDED THAT but it didn't change anything from previous tests..
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
bloom nginx container nginx.conf :
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
include /etc/nginx/conf.d/*.conf;
}