Tyk Gateway stopped working

Hi, I’ve had Tyk on premise running for about a month and all was well but now I’m getting this error when sudo service tyk-dashboard start

Loaded: loaded (/lib/systemd/system/tyk-dashboard.service; disabled; vendor preset: enabled)
Active: inactive (dead)

Aug 01 10:17:35 KITT tyk-analytics[3133]: /src/github.com/TykTechnologies/tyk-analytics/Main.go:530 +0x42a
Aug 01 10:17:35 KITT tyk-analytics[3133]: main.main()
Aug 01 10:17:35 KITT tyk-analytics[3133]: /src/github.com/TykTechnologies/tyk-analytics/Main.go:943 +0x57
Aug 01 10:17:35 KITT systemd[1]: tyk-dashboard.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Aug 01 10:17:35 KITT systemd[1]: tyk-dashboard.service: Unit entered failed state.
Aug 01 10:17:35 KITT systemd[1]: tyk-dashboard.service: Failed with result ‘exit-code’.
Aug 01 10:17:35 KITT systemd[1]: tyk-dashboard.service: Service hold-off time over, scheduling restart.
Aug 01 10:17:35 KITT systemd[1]: Stopped Tyk API Dashboard.
Aug 01 10:17:35 KITT systemd[1]: tyk-dashboard.service: Start request repeated too quickly.
Aug 01 10:17:35 KITT systemd[1]: Failed to start Tyk API Dashboard.

My gateway was crashed too but after fixing the directory of the templates the error went away and the gateway service seems to be running although I can’t access my API - either it’s still broken or it’s because of the dashboard.

Thank you for your help!

Could it be your dashboard templates folder? (i.e. has it been updated recently, is it readable etc.) This error seems to originate with this section of the code.

Hi, I think you’re right about the templates as this is what I found in the error logs:

time=“Aug 1 10:17:51” level=info msg=“Using /opt/tyk-dashboard/tyk_analytics.conf for configuration”
time=“Aug 1 10:17:51” level=info msg=“Creating new Redis connection pool”
time=“Aug 1 10:17:51” level=info msg=“Creating new Redis connection pool”
time=“Aug 1 10:17:51” level=info msg=“Creating new Redis connection pool”
time=“Aug 1 10:17:51” level=info msg=“Creating new Redis connection pool”
time=“Aug 1 10:17:51” level=info msg=“Adding available nodes…”
time=“Aug 1 10:17:51” level=info msg=“Tyk Analytics Dashboard v1.3.7”
time=“Aug 1 10:17:51” level=info msg=“Copyright Martin Buhr 2016”
time=“Aug 1 10:17:51” level=info msg=“https://www.tyk.io
time=“Aug 1 10:17:51” level=info msg=“Listening on port: 3000”
panic: html/template: pattern matches no files: portal/templates/*.html

goroutine 1 [running]:
html/template.Must(0x0, 0xf7b620, 0xc420253cb0, 0x0)
/usr/local/go/src/html/template/template.go:360 +0x54
main.setupPortalTemplates()
/src/github.com/TykTechnologies/tyk-analytics/Main.go:530 +0x42a
main.main()
/src/github.com/TykTechnologies/tyk-analytics/Main.go:943 +0x57

However I haven’t touched anything since everything was running. Would you mind pointing me in the direction of which files should go where?

Again, thank you for you help!

It should be /opt/tyk-dashboard/portal/templates

But it can be modified in the tyk_analytics.comf, can you share that file? It might pointing at the wrong dir.

I have many files in that folder including index.html. There is no mention of anything in the tyk_analytics.conf file but here it is:
“listen_port”: 3000,
“tyk_api_config”: {
“Host”: “http://localhost”,
“Port”: “5000”,
“Secret”: “352d20ee67be67f6340b4c0605b044b7”
},
“mongo_url”: “mongodb://localhost/tyk_analytics”,
“page_size”: 10,
“admin_secret”: “12345”,
“redis_port”: 6379,
“redis_host”: “localhost”,
“redis_password”: “”,
“force_api_defaults”: true,
“notify_on_change”: true,
“license_owner”: “Your Name”,
“hash_keys”: true,
“dashboard_session_lifetime”: 43200

There seem to be things missing from that listing?

That’s all there is so maybe that’s the problem then? Can I just replace it with the conf file from the install folder?

The best thing to do would be to run the setup script for the dashboard again:

See the configuration section here:

https://tyk.io/docs/get-started/with-tyk-on-premise/installation/on-ubuntu/dashboard/