Have managed to get everything up and running perfectly except that the dash board cannot find any nodes that are running.
Things I have checked:
Redis is running
Mongo Db is running
secrets have been set in both tyk.conf and tyk_analytics.conf
APIs have been created
port 5000 (tyk port) is open and accepting connections
License is active and shows Total Available as 1 and Total Remaining as 1
Other than this, I am not sure what else to look at.
The only other information is that all requests currently wind up at the dashboard (there is a dedicated domain served by NGINX with the upstream of 5000 but this just winds up at the dashboard for some reason. Tyk is NOT serving or managing hosts.
When users hit this domain on NGINX via port 80, NGINX proxy_passes the request to an upstream server called tyke which is running on 5000 which then serves the request.
dashboard.mydomain.com
This is where admin access the dashboard. This is also served by NGINX with an upstream to :3000
Short version: while the dash and gateway URLS will be ok, the portal needs a special rewrite rule, templates for which you can find in the dashboard/host-manager sub directory on your server.
Basically, because you are running via NGinX, you need to go back to pre-1.8 style of domain management, which involved managed NGinX templates using or host manager app (still bundled, still works):
In your case, since Tyk Dashboard is no longer binding to domains, the portal domain is now also no longer used, instead it uses the OrgID to target the correct portal (Tyk is multi-tenant).
Setting the CNAME via the dashboard will cause Tyk Dash to assume the domain is also being used for the gateway and all the published URLs in the dash will use the CNAME (they won’t be live though, because you aren’t domain binding, so it’s just incorrect)
We’ve already written all the templates for NGinX to make this kind of config work (lots of people still use the host manager) - in the Tyk Dashboard directory there is a host manager directory, in there are some templates for NGinX that show you how to manage rewrites for a non-domain bound install.
Thanks for that. For some reason (my love of inflicting self harm via code) I really want to maintain the transparency by running NGINX as a standalone.
I checked the tyk --help flag but it does not list how to grab the organisation IDs in v2. Maybe I am missing the place in the dashboard?
It think the amount of work you have done since is really great by the way. Not sure I understand why NGINX was bundled in with Tyk though but I am sure I will get the hang of it soon.
I will keep hammering away to get this working. Thank you for your dedication and responses to my noob questions.
Nada! Have no been able to get this working. The portal is fine now, the gateway just return “not found” for any combination of paths it is passed.
If I swop out the upstream for “httpbin.org” redirects with no 404 unless I add a path. If I push this to the upstream I just get a 404 which to me seems like TYK-GATEWAY does not have access to the API definitions which may be why I am getting that no nodes running error. NGINX is picking up the rewrites and throwing them the right way (logging rewrites at INFO level).
At a total loss. This is the last step (I hope ) Any advice much appreciated.
You are rewriting the root to a fixed API slug, I’m not sure that’s what you want, the rewrite isn’t very flexible, try:
rewrite /(.*) /$1 break;
I think this is what you had before for your gateway, what you want to achieve is that everything gets proxied to Tyk for processing, you need the listen path to reach Tyk.
You may be correct in assuming that Tyk doesn’t have an API to listen to, in which case it will always 404.
If there’s no nodes listed in the dashboard, I have a feeling Tyk isn’t bootstrapping and registering, so I’d suggest tailing the log files of the gateway (/var/log or /var/log/upstart).
You’ll need to solve that before your NGinX rewrite.
Thanks for your patience Martin. This was totally a ID 10 T operator error.
PORT 5000 was for some reason being eaten by another process. I changed that and everything stabilised. Nodes are being picked up. For those who follow this path.
check you /var/log/tyk-gateway.stderr file
if you are getting something that looks like this:
you most likely have something fighting with tyke on the ports.
check the processes you have running and on which ports. I would recommend you stop the tyk-gateway and tyk-dashboard services first just so the results are definitive.