Create API Definition endpoint persistence in Community Edition

Based on current testing in my dev environment, it seems that using the Create API Definition endpoint within the on-prem community edition, followed by a reload request, doesn’t persist the API definitions within the gateway after container deletion and re-creation. Can someone confirm this?

If true, I would recommend adjusting the documentation at https://tyk.io/docs/get-started/with-tyk-on-premise/tutorials/tyk-on-premise-community-edition/create-api/ to not encourage the use of the API to create the API definition but rather to use the file approach from the start.

If the gateway does save the definition into the filesystem, the I would note that using a Dockerized version without mounting a persistent volume for the ./apps dir will result in losing your definitions. And if the volume isn’t shared between container instances, then only one of the container instances will know about the definitions. This isn’t clear in the documentation on how the gateway works when using CE vs. commercial editions that persist to MongoDB.

Thanks!

It will flush them to disk, but in a container that will be ephemeral and be cleared after restart

Most of the time shared volumes for containers isn’t a popular option because of the ops/logistics involved, so in our experience, most users going the docker route will generate their API Definitions once, store them in version control and use CI / CD to re-create those definitions in a CE Gateway after container launch using the Gateway API or a tool like tyk-git.

Thanks for the clarification, that helps. This is a simple standalone gateway setup with CE, so I’m going to use Kubernetes volumes and ConfigMaps to push the file in directly into apps/ for now, along with policies and the config. At some point, I’ll move to the dashboard plus single node gateway so that I can use the API plus store definitions in MongoDB rather than the filesystem so that I don’t lose them after the container goes away.