Search code examples
mongodbdockercontainerstyk

Tyk dashboard app - Couldn't establish a connection with Mongo: no reachable servers


I am trying to set up a Tyk dashboard Docker container for an API gateway. There is a configuration file that is used by Tyk to, among other things, connect to a Redis, and Mongo using JSON. I set up a MongoDB cluster using MongoDB Atlas. I took the connection string, and put it into the Tyk config JSON for the "mongo_url" key.

mongodb://<username>:<password>@cluster0-shard-00-00-to2hv.mongodb.net:27017,cluster0-shard-00-01-to2hv.mongodb.net:27017,cluster0-shard-00-02-to2hv.mongodb.net:27017/admin 

I can successfully connect to my NoSQL cluster using the MongoDB Compass app, but when I try to run the Tyk Dashboard container, I get an error

time="Nov 7 20:12:09" level=info msg="connecting to MongoDB: [cluster0-shard-00-00-to2hv.mongodb.net:27017 cluster0-shard-00-01-to2hv.mongodb.net:27017 cluster0-shard-00-02-to2hv.mongodb.net:27017]"

time="Nov 7 20:12:21" level=fatal msg="Couldn't establish a connection with Mongo: no reachable servers"

Has anyone ever run into this issue before?


Solution

  • I believe for Atlas you need an ssl connection, have you set "mongo-use_ssl":true in the tyk_analytics.conf?