Tyk and docker


#1

Imported Google Group message. Original thread at: https://groups.google.com/forum/#!topic/tyk-community-support/q2Kbgro7JIE Import Date: 2016-01-19 21:26:59 +0000.
Sender:Luis Valladares.
Date:Thursday, 15 October 2015 22:46:45 UTC+1.

Hello

I’ve recently donwloaded and configured tyk with docker following this guide (https://tyk.io/blog/running-tyk-with-docker/) using this bash (https://gist.github.com/lonelycode/4f645c4733faaa74d8fd) and using this docker image for redis cluster (https://github.com/Grokzen/docker-redis-cluster).

So i’ve followed all the instructions and do some test to check conectivity and functionality of all processes, everything SEEMS to work fine. Also i’ve succesfully entered into tyk dashboard, created an api (using httpbin.org) and created a Policy to access this api, and in my hosts file of the host machine (my machine) i’ve added the domain of tyk, like this:

127.0.0.1 test-org.tyk.docker
127.0.0.1 http-bin.test-org.tyk.docker.

but when i try to access to this url from my navigator and it returns to me invalid request, i’ve checked docker logs of each container and there is no error in any of my docker containers, the only thing i’ve found until now is:

If i’m inside of tyk gateway container and do ping google.com it cant resolve the DNS, but if i do this in any other container it routes it okay, in all the containers the resolv.conf has the same DNS (google DNS BTW)

Only to clarify: I can access to the dashboard without issues, the problem is when i try to acces the api i created.

So, im out of solutions, any sugestions?

Thanks for any help you can provide!


#2

Imported Google Group message.
Sender:Martin Buhr.
Date:Thursday, 15 October 2015 23:18:49 UTC+1.

Ok cool, so it’s not a docker IP issue :slight_smile:
You say you used the blog post to get set up with docker, that’s a pretty old guide, we’ve since updated things to use docker compose and it’s quite a smooth set up procedure, here’s the canonical guide:
https://tyk.io/v1.8/setup/docker/
Might be worth giving that a go (you may need to remove the old containers) as it might work better, it’s very odd that you can’t resolve domains from the gateway container.
I know it’s not a diagnosis of the issue you are facing, but that gist has always had problems (which is why we replaced it). The domain not working can be down to an issue in the host manager (tyk_nginx) container.
I have a feeling it may have something to do with how the domains are being set in the host manager container (it’s an environment value replacement using a container variable called DOMAINALIAS that needs to be set correctly).
Try the docker compose based setup (you won’t need the Redis cluster image for that one either) and let me know if you have more success.
If all else fails, Tyk has only two real dependencies: redis, and mongodb if you want dashboard. Setting it up without docker is very very strainghtforward, let me know directly if you get super stuck and I can walk you through it :wink: my email is [email protected].
Cheers,
Martin


#3

Imported Google Group message.
Sender:Luis Valladares.
Date:Thursday, 15 October 2015 22:50:09 UTC+1.

Hi Luis,
Are you running on Linux or OSX?
Cheers,
Martin


#4

Imported Google Group message.
Sender:Martin Buhr.
Date:Thursday, 15 October 2015 23:00:42 UTC+1.

Hello!

I use Linux

Thanks martin!

  • show quoted text -

#5

Imported Google Group message.
Sender:Luis Valladares.
Date:Thursday, 15 October 2015 23:18:49 UTC+1.

Ok cool, so it’s not a docker IP issue :slight_smile:
You say you used the blog post to get set up with docker, that’s a pretty old guide, we’ve since updated things to use docker compose and it’s quite a smooth set up procedure, here’s the canonical guide:
https://tyk.io/v1.8/setup/docker/
Might be worth giving that a go (you may need to remove the old containers) as it might work better, it’s very odd that you can’t resolve domains from the gateway container.
I know it’s not a diagnosis of the issue you are facing, but that gist has always had problems (which is why we replaced it). The domain not working can be down to an issue in the host manager (tyk_nginx) container.
I have a feeling it may have something to do with how the domains are being set in the host manager container (it’s an environment value replacement using a container variable called DOMAINALIAS that needs to be set correctly).
Try the docker compose based setup (you won’t need the Redis cluster image for that one either) and let me know if you have more success.
If all else fails, Tyk has only two real dependencies: redis, and mongodb if you want dashboard. Setting it up without docker is very very strainghtforward, let me know directly if you get super stuck and I can walk you through it :wink: my email is [email protected].
Cheers,
Martin


#6

Imported Google Group message.
Sender:Martin Buhr.
Date:Friday, 16 October 2015 02:21:14 UTC+1.

Hello, thanks for your fast answer i will give it a try asap, but i have one doubt:
You say i dont need redis cluster in the docker compose but as far as i see the script use classic redis and i need to simulate a redis cluster architecture to do some testing. So, I do need to use a specific image of redis cluster in this case right?
Thanks!


#7

Imported Google Group message.
Sender:Luis Valladares.
Date:Friday, 16 October 2015 02:22:06 UTC+1.

  • show quoted text -

#8

Imported Google Group message.
Sender:Luis Valladares.
Date:Friday, 16 October 2015 06:23:23 UTC+1.

Hi Luis,
If that’s the case you will need to modify the compose files to set up with the cluster image instead of classic Redis - simply edit the compose file
You will also need to modify the Tyk.conf and Tyk-analytics conf file to use a clustered setup, so your docker configuration will look a bit different.
The compose QuickStart is just a bit more stable than the gist and is using the latest images, so it’s definitely the place to start.
Cheers,
Martin