I just wonder if this works, could you try to run fmeserver from f.ex: 127.0.0.2 to see if it solves the issue? just pop 127.0.0.2 in the browser window. I have no experience with mongoDb so its just a guess if there is some interference between fmeserver and mongodb on ip 127.0.0.1.
I just wonder if this works, could you try to run fmeserver from f.ex: 127.0.0.2 to see if it solves the issue? just pop 127.0.0.2 in the browser window. I have no experience with mongoDb so its just a guess if there is some interference between fmeserver and mongodb on ip 127.0.0.1.
I am not so sure how can I do that, since I have the containers already created. I tried stopping the FME-nginx container &
docker run -h 127.0.0.2 <image> <container-name>
But it failed to run. I think that in order to do so I have to change the docker-compose.yaml and re-compose. Can I avoid that?
Hi @stratos.tso
When you set up your mongo database connection, have you specified the MongoDB Server as localhost? If your computer that you have MongoDB installed locally on has a hostname can you try to use that instead of localhost?
I'm thinking that when it's running on FME Server with localhost it's looking inside the FME Server container (it's own localhost) and correctly not finding MongoDB because it doesn't exist there.
Hi @stratos.tso
The easiest option is to use the internal or external IP of your host instead of localhost or 127.0.0.1 as the Mongo DB hostname in the FME Server Web Connection.
Another option to do this is to join an existing network of the FME Server deployment with your new Mongo DB container. Here is an example of a Mongo DB docker-compose file that joins the web network of an existing FME Server deployment:
# Use root/example as user/password credentials
version: '3.1'
services:
ÂÂÂ mongo:
ÂÂÂ ÂÂÂ image: mongo
ÂÂÂ ÂÂÂ restart: always
ÂÂÂ ÂÂÂ environment:
ÂÂÂ ÂÂÂ ÂÂÂ MONGO_INITDB_ROOT_USERNAME: root
ÂÂÂ ÂÂÂ ÂÂÂ MONGO_INITDB_ROOT_PASSWORD: example
networks:
ÂÂÂ default:
ÂÂÂ ÂÂÂ external:
ÂÂÂ ÂÂÂ ÂÂÂ name: 2019_web
I chose the web network because the fmeserverengine service needs to be part of the network to successfully connect to the Mongo DB. The prefix will be different for you but you can search for an existing FME Server web network with the docker network ls. In the Database connection on FME Server you can now use mongo as hostname (default) for your Mongo DB.
The overall important part is that the fmeserverengine service shares a network with your Mongo DB service. Using the existing web container is one way but obviously, you could also create a network specifically for the communication between the Mongo DB & FME Server and add it to the fmeserverengine service in the FME Server compose file.
Here are little more details which might help with this too:
https://docs.docker.com/compose/networking/
If anyone face this problem, here is a proposed solution:
Like jlutherthomas said FME Server with Host: localhost or even 127.0.0.1. is looking inside the FME Server container. To make it connect to your local host you can use host.docker.internal, it's documented here.
So when setting up a database connection set a host name (or MongoDB Server in your case) to host.docker.internal.