State of OSS version is missed

Hello
Could you please help me to understand, how to configure OSS Tyk to keep its state (all APIs, session token created) outside of container?
Default configuration points to Redis. I have set it up. It works. I even can use Pump for statistics.
But as soon as I recreate the pod with tyk gateway - all my APIs are gone and I have to recreate them.
What part of the gateway configuration is about keeping state externally?
Do I need MongoDB for this?
Do you have any examples?

Thank you

Hi!

General idea here is that OSS Tyk works with plain files, e.g. db-less mode.
So with the docker you will need to mount “apps” folder if you want this data to persist.

In this case Tyk Pro offering, and specifically Tyk Dashboard, acts as centralized configuration storage for the gateway nodes connected to it.

Also worth mentioned that we are actively working on GitHub - TykTechnologies/tyk-operator: Tyk Operator for Kubernetes project to provide developer friendly GitOps experience which can address some of the issues you see.
One of the limitations of using Operator with OSS version is that it can work only with one GW node now (discoverability hard to do right), but we are working on supporting multiple nodes [WIP] Multi tenant by gernest · Pull Request #285 · TykTechnologies/tyk-operator · GitHub

Hope it makes sense!

Hi Leon
Thank you for the help and for the Tyk in general. Awesome tool indeed
So, if i got you right, I just need to mount “/mnt/tyk-gateway/apps” (which is a value of the “app_path” property in GW config file) as a k8s Persistent volume?
Thank you!
I will give it a try

Correct!

Also policies folder, and potentially middleware folder if you planning to use plugins.

Let me know if works.

btw, do you have any numbers, how much this can be scaled? I mean
How many files (JSON files in apps folder ) one GW can handle
How many session tokens I can create for 1 API?

and another question
where session tokens are saved? If APIs are saved in /mnt/tyk-gateway/apps, where are saved related session tokens? I saw their metadata in Redis, but not the API key itself

Thank you

We have customers with thousands of APIs and Policies, and frankly can’t think about any limits like this.
API reloads can take a few seconds for such amount of APIs, but after it should work seamlessly.
Tokens count also not limited.

As for tokens, they actually fully stored in the Redis.

1 Like