Connection Refused on Portal Setup

Hi All,

I tried the tutorial given in this tutorial . I was able to install the Tyk dashboard and Tyk Gateway. But when I run the sudo /opt/tyk-dashboard/install/bootstrap.sh XXX.XXX.XXX.XXX (domain replaced with my instance IP). It throws the below error,

When I tried exploring the bootstrap.sh file, I came to know it’s making cURL request to Admin API. So i tried it directly from the terminal. When I do so, I get Connection Refused error. The same error I’m getting from REST Clients.

That implies that the containers are not running or listening, even without the bootstrap, you should be able to visit the dashboard login page. If you can’t get a login screen by visiting port 3000, then the bootstrap won;t work either.

Also, if you are using the latest quickstart you must have the absolutely latest version of docker installed.

I had installed in Ubuntu Server 14.04 LTS … I didn’t install on Docker… How to debug or find out where is the problem ?

  1. Did you start the services?
  2. Do you see a login screen when you go to port 3000?

I started the services. When I run

service tyk-dashboard status
and
service tyk-gateway status

it says, start/running, pid XXXX

But I couldn’t able to access login screen on 3000 port.

Did you run the setup script step? Looks like a misconfiguration to me.

Take a look in var/log/upstart for the log files for both services, in particular the dashboard log file - tail it, it will tell you why the service isn’t starting.

Output of tail -10 /var/log/upstart/tyk-gateway.log command,

ERRO[0878] Mongo connection failed:no reachable servers
ERRO[0880] Mongo connection failed:no reachable servers
ERRO[0887] Mongo connection failed:no reachable servers
ERRO[0890] Mongo connection failed:no reachable servers
ERRO[0891] Mongo connection failed:no reachable servers
ERRO[0898] Mongo connection failed:no reachable servers
ERRO[0901] Mongo connection failed:no reachable servers
ERRO[0903] Mongo connection failed:no reachable servers

I could able to connect to the local MongoDB through shell.

Right, so you can connect to the mongoDB from shell, but is it configured properly in the tyk.conf and tyk_gateway.conf files? That error implies that it isn’t.

My MongoDB Configuration in /opt/tyk-gateway/tyk.conf file is

I tried replacing “127.0.0.1” with “localhost” also, but didn’t work
Tried without specifying the port number also, didn’t work.

I just followed the steps given in the documentation. How could it be wrong for me alone ? :frowning:

And you can connect with the command line from within the same she’ll that Tyk is running in? Is the port correct? Have you tried connecting to that connection string?

MongoDB is on the same host right (not virtualised or anything)

No not virtualised anything… Executed Tyk from same shell where I can able to connect Mongo.

Ok, what version of tyk and what version of MongoDB are you running?

Also, are you sure there is no username/password on the DB?

I have installed using https://tyk.io/v1.9/setup/install-tyk-ubuntu/ tutorial, so I hope my tyk version is 1.9

And I’m sure there is no username/password for MongoDB access

I used this below command to setup Tyk Gateway,

sudo /opt/tyk-gateway/install/setup.sh --dashboard=1 --listenport=8080 --redishost=localhost --redisport=6379 --domain="" --mongo=mongodb://127.0.0.1:27017/tyk_analytics

Have you tried swapping 127.0.0.1 for localhost across all configs? RHEL/CentOS can be funny about that.

It worked after changing all the localhost to 127.0.0.1

By the way, I’m using Ubuntu Server 14.04 LTS, not CentOS

Ah, ok - we’ve updated all our docs now to use 127.0.0.1 instead of localhost, it’s more stable across distros. We thought it was just CentOS/RHEL :slight_smile:

Cool !! :clap: Hope it would help some other newbies like me. :stuck_out_tongue_winking_eye: