Error creating key (tyk_quickstart 1.9.1)

Imported Google Group message. Original thread at: Redirecting to Google Groups Import Date: 2016-01-19 21:35:33 +0000.
Sender:Gian Luca Farina Perseu.
Date:Monday, 14 December 2015 11:24:49 UTC.

Hi to all,

I just installed the latest tyk_quickstart in a Docker 1.9 env

Where creating a key I receive the error:

Failed to save new session object to Tyk: Failed to create key: Post http://ambassador_1:8080/tyk/keys/create: dial tcp 172.17.0.2:8080: getsockopt: connection refused

The API (in Open auth mode) works well.

Here my docker-compose.yml:

ambassador:
image: cpuguy83/docker-grand-ambassador
volumes:
- /var/run/docker.sock:/run/docker.sock
command: “-name tykquickstart_tyk_gateway_1 -name tykquickstart_tyk_dashboard_1”
tyk_gateway:
image: tykio/tyk-gateway:latest
links:
- tyk_redis:redis
- tyk_mongo:mongo
- ambassador:tyk_dashboard
ports:
- “80:8080”
- “8080:8080”
volumes:
- ./tyk.conf:/opt/tyk-gateway/tyk.conf
tyk_dashboard:
image: tykio/tyk-dashboard:latest
links:
- tyk_redis:redis
- tyk_mongo:mongo
- tyk_gateway:tyk_gateway
- ambassador:tyk_gateway
ports:
- “3000:3000”
volumes:
- ./tyk_analytics.conf:/opt/tyk-dashboard/tyk_analytics.conf
tyk_redis:
image: redis:latest
hostname: redis
tyk_mongo:
image: mongo:latest
command: [“mongod”, “–smallfiles”]
hostname: mongo

Thanks in advance for any support !

Gian Luca (Turin, Italy)

Imported Google Group message.
Sender:Martin Buhr.
Date:Monday, 14 December 2015 14:56:31 UTC.

Hi Gian Luca,

There’s the problem:

If you look at the compose yal, we specify the services for the ambassador as:

command: “-name tykquickstart_tyk_gateway_1 -name tykquickstart_tyk_dashboard_1”

And your docker-compose is starting them as a different name:

tykquickstartmaster_tyk_dashboard_1

tykquickstartmaster_tyk_gateway_1

You will need to edit the compose yaml to use these in the “command” section, so change it to:

command: “-name tykquickstartmaster_tyk_dashboard_1 -name tykquickstartmaster_tyk_gateway_1”

This should work, though I’m not sure what the ambassador is called internally, with any luck it will still be the same name.

Cheers,
Martin

Imported Google Group message.
Sender:Gian Luca Farina Perseu.
Date:Monday, 14 December 2015 14:01:47 UTC.

Hi Gian Luca,

Have you docker pulled the :latest tag for tyk-gateway and tyk-dashboard?

Are all of the docker containers running? Which ones are running?

What you are seeing is Tyk Dashboard trying to communicate with the gateway to generate a key, but it can’t connect via the ambassador.

Not sure how to resolve this - have you changed anything in the setup? How did you bootstrap the instance? have you modified the tyk.conf file in any way?

Cheers,
Martin

Imported Google Group message.
Sender:Martin Buhr.
Date:Monday, 14 December 2015 14:40:32 UTC.

Hi Martin,

I deploy a new Tyk instance using docker composer just on last friday:

docker-compose up -d

and setup using

./setup.sh 127.0.0.1 myhost.mydomain.com

My current container situation is (docker ps):

0c8ac3be44e1 tykio/tyk-dashboard:latest “/opt/tyk-dashboard/t” 3 days ago Up 4 hours 0.0.0.0:3000->3000/tcp tykquickstartmaster_tyk_dashboard_1
47613c4f45f6 tykio/tyk-gateway:latest “/opt/tyk-gateway/tyk” 3 days ago Up 4 hours 0.0.0.0:8080->8080/tcp, 0.0.0.0:80->8080/tcp tykquickstartmaster_tyk_gateway_1
e52ff70bc8c5 redis:latest “/entrypoint.sh redis” 3 days ago Up 4 hours 6379/tcp tykquickstartmaster_tyk_redis_1
ee4a986ae634 mongo:latest “/entrypoint.sh mongo” 3 days ago Up 4 hours 27017/tcp tykquickstartmaster_tyk_mongo_1
24e4fcc3a6cc cpuguy83/docker-grand-ambassador “/usr/bin/grand-ambas” 3 days ago Up 4 hours tykquickstartmaster_ambassador_1

I didn’t make any modifications at configuration (tyk.conf), but it seems that ambassador have no port configured …

Hope this helps !

Imported Google Group message.
Sender:Gian Luca Farina Perseu.
Date:Monday, 14 December 2015 14:56:31 UTC.

Hi Gian Luca,

There’s the problem:

If you look at the compose yal, we specify the services for the ambassador as:

command: “-name tykquickstart_tyk_gateway_1 -name tykquickstart_tyk_dashboard_1”

And your docker-compose is starting them as a different name:

tykquickstartmaster_tyk_dashboard_1

tykquickstartmaster_tyk_gateway_1

You will need to edit the compose yaml to use these in the “command” section, so change it to:

command: “-name tykquickstartmaster_tyk_dashboard_1 -name tykquickstartmaster_tyk_gateway_1”

This should work, though I’m not sure what the ambassador is called internally, with any luck it will still be the same name.

Cheers,
Martin

Imported Google Group message.
Sender:Martin Buhr.
Date:Monday, 14 December 2015 15:46:34 UTC.

Hi Martin,

your suggestion works perfectly !!

Take into account that the original yml at

https://github.com/lonelycode/tyk_quickstart/blob/master/docker-compose.yml

is wrong :wink:

Thank you for your support !

Best Regards.

Gian Luca

Imported Google Group message.
Sender:Gian Luca Farina Perseu.
Date:Monday, 14 December 2015 16:20:17 UTC.

Hi Gian Luca,

It might be wrong for your OS, seems to be that docker-compose is inconsistent across distros, so the sample works fine for Kitematic / OSX, and older versions of docker_compose, so it’s dependent on what you are running.

Cheers,
M.

Imported Google Group message.
Sender:Gian Luca Farina Perseu.
Date:Monday, 14 December 2015 17:10:47 UTC.

My current OS is CentOS 7 64bit.

Docker is latest 1.9.1.

here the Docker Info:

Containers: 6
Images: 113
Server Version: 1.9.1
Storage Driver: devicemapper
Pool Name: docker-253:0-590742-pool
Pool Blocksize: 65.54 kB
Base Device Size: 107.4 GB
Backing Filesystem:
Data file: /dev/loop0
Metadata file: /dev/loop1
Data Space Used: 2.661 GB
Data Space Total: 107.4 GB
Data Space Available: 2.925 GB
Metadata Space Used: 5.915 MB
Metadata Space Total: 2.147 GB
Metadata Space Available: 2.142 GB
Udev Sync Supported: true
Deferred Removal Enabled: false
Deferred Deletion Enabled: false
Deferred Deleted Device Count: 0
Data loop file: /var/lib/docker/devicemapper/devicemapper/data
Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
Library Version: 1.02.93-RHEL7 (2015-01-28)
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 3.10.0-229.el7.x86_64
Operating System: CentOS Linux 7 (Core)
CPUs: 1
Total Memory: 3.703 GiB