Use of Azure Cosmos DB with tyk

Hi all,

I’d like to know if someone tried to setup tyk with a Azure Cosmos DB service instead of MongoDB.
I need to install it on Azure but they don’t have a MongoDB managed service, but they have that Cosmos DB service responding to MongoDB api, so… I need your help to know if it works :wink:

Thanks!
Max

1 Like

Hey Max,

I don’t think anyone currently has that set up (open to be proved wrong!), but we’d be interested to hear if you find a way round it.

If you’re looking for a managed service Hybrid might work for you - https://tyk.io/api-gateway/hybrid/

Thank you for answer.
But I won’t use the hybrid mode, I have to use it with a HA cluster in azure or with their managed service…

Hey Max,

have you tried setting it up already?

I’m going to try it out asap, too. Maybe we could get in contact about what works and what not.

1 Like

Hi Bernhard,

I havn’t tried yet, I’ll do it in the next few weeks.
If you have made it, I’m interested!

Thanks.

Sounds like a really interesting option, do post any questions/progress here. I’m sure the Tyk engineering team will be able to provide some answers to help get this moving!

Well, finally I tried, and it doesn’t work.
Boot sequence of tyk is looping over :

– Unit tyk-dashboard.service has finished starting up.
– >
– The start-up result is RESULT.
août 16 10:32:28 beaver tyk-analytics[6218]: time=“Aug 16 10:32:28” level=info msg=“Using /opt/tyk-dashboard/tyk_analytics.conf for configuration”
août 16 10:32:28 beaver tyk-analytics[6218]: time=“Aug 16 10:32:28” level=info msg=“connecting to MongoDB: [tfex-cosmos-db-70176.documents.azure.com:10255]”
août 16 10:32:39 beaver tyk-analytics[6218]: time=“Aug 16 10:32:39” level=fatal msg=“Couldn’t establish a connection with Mongo: no reachable servers”
août 16 10:32:39 beaver systemd[1]: tyk-dashboard.service: Main process exited, code=exited, status=1/FAILURE
août 16 10:32:39 beaver systemd[1]: tyk-dashboard.service: Failed with result ‘exit-code’.
août 16 10:32:39 beaver systemd[1]: tyk-dashboard.service: Service hold-off time over, scheduling restart.
août 16 10:32:39 beaver systemd[1]: tyk-dashboard.service: Scheduled restart job, restart counter is at 45.
– Subject: Automatic restarting of a unit has been scheduled
– Defined-By: systemd
– Support: http://www.ubuntu.com/support

– Automatic restarting of the unit tyk-dashboard.service has been scheduled, as the result for
– the configured Restart= setting for the unit.
août 16 10:32:39 beaver systemd[1]: Stopped Tyk API Dashboard.
– Subject: Unit tyk-dashboard.service has finished shutting down
– Defined-By: systemd
– Support: http://www.ubuntu.com/support

– Unit tyk-dashboard.service has finished shutting down.
août 16 10:32:39 beaver systemd[1]: Started Tyk API Dashboard.
– Subject: Unit tyk-dashboard.service has finished start-up
– Defined-By: systemd
– Support: http://www.ubuntu.com/support

But I successfully logged on the cosmosDB with mongo shell client.
Please Tyk, fix it :slight_smile: I don’t want to manage a mongodb cluster by myself :wink:

Hi I replied on GitHub as well https://docs.microsoft.com/en-us/azure/cosmos-db/connect-mongodb-account#GetCustomConnection

The connection string needs some extra parameters for security reasons - you may also be forces to use SSL

1 Like

Yep, I saw that and closed the issue.
Thank you for the help. Finally, it works.

Hey Max

Would you be able to post an overview of how you have found using Tyk API Management with Cosmos DB on Azure? It would be of interest to lots of users.

Thanks