Docker compose deployment to run Tyk OSS Gateway
Docker compose deployment to run Tyk OSS Gateway
This repository serves as a playground to help you experiment with Tyk Gateway. It includes a Docker Compose file that allows you to quickly set up Tyk Gateway and Redis. Additionally, the repository provides several example API definitions and plugins to showcase the gateway's capabilities and help you learn some of its features.
Click here to get up and running but please remember to revisit the next section later as it provides valuable yet concise insights on how to make the most of your time while using this repository and learning to know Tyk
These settings apply to any Tyk OSS deployment, for development as well as production environments.
docker compose, the config of the gateway is already set up to connect to the Redis service. As soon as it's up the gateway is ready to use.tyk.conf is set up appropriately and ready to use, including the API key to access/config the gateway via its APIs.This repo has a few libraries that contain the file required to demo some of the Tyk gateway capabilities:
./apps. You can also find in it example API definitions ready to use.These settings apply to any Tyk OSS deployment, this one using Docker Compose as well as test and production environments.
docker compose, the config of the gateway is already set up to connect to the Redis service. As soon as it's up the gateway is ready to use.tyk.conf is set up appropriately and ready to use, including the API key to access/config the gateway via its APIs.To spin up Tyk deployment - Please continue reading
In this section, you will spin up a full Tyk OSS Deployment Using Docker Compose
Before you start, please install the following binaries:
docker composecurl, jq will help you to beautify the returned JSON.Use docker-compose.yml to spin up a Tyk OSS environment with one command. This will start two services, Tyk gateway and Redis use the following command
$ docker-compose up -dIn the example below we call the /hello endpoint using curl (you can use any HTTP client you want):
curl http://localhost:8080/hello -iIt returns the gateway's version and the connection status of Redis.
HTTP/1.1 200 OK
Content-Type: application/json
Date: Mon, 25 Jul 2022 19:16:45 GMT
Content-Length: 156
{
"status": "pass",
"version": "v3.2.1",
"description": "Tyk GW",
"details": {
"redis": {
"status": "pass",
"componentType": "datastore",
"time": "2022-07-25T19:16:16Z"
}
}
}
To get the list of APIs that Tyk gateway services, run the following:
curl http://localhost:8080/tyk/apis -H "X-Tyk-Authorization: foo"or in VS Code in a some-file.http:
http://localhost:8080/tyk/apis
X-Tyk-Authorization: fooThe response is a JSON array of the API definitions.
To beautify the list, use jq:
curl http://localhost:8080/tyk/apis -H "X-Tyk-Authorization: foo" | jq .Notice that we used the API key (secret) to connect to the gateway.
/tyk/apis is the way to configure or check the configuration of Tyk Gateway via APIs and as such it must be protected so only you can connect it.
If you want to run docker (not docker compose), use these instructions.
For production, in which you use docker (not docker compose), check the instructions on our docs website.
To you want to build an image yourself please use this Dockerfile
Tyk Hybrid Gateway is the same Tyk OSS gateway but here it's connecting to a control plane layer (specifically to a component called MDCB). The control plane can be self-managed or via the SaaS offering on Tyk cloud. As such, this option can be used only by paying clients (including users that trial the paying option).
FYI Tyk cloud has also a Cloud Free plan but Hybrid gateways are not part of it.
To set up a Hybrid gateway/cluster of gateways, do the following:
"slave_options": {
"rpc_key": "",
"api_key": "",
"connection_string": ":443",it should look like this:
"slave_options": {
"rpc_key": "j3jf8as9991ad881349",
"api_key": "adk12k9d891j48df824",
"connection_string": "persistent-bangalore-hyb.aws-usw2.cloud-ara.tyk.io:443",docker compose by mounting it into the Gateway in docker-compose.ymlChange from
- ./tyk.standalone.conf:/opt/tyk-gateway/tyk.confTo:
- ./tyk.hybrid.conf:/opt/tyk-gateway/tyk.confThat's it! Now run docker-compose up
PRs with new examples and fixes are most welcome. A contributor guide will be added in the future but for the time being, please explain your PR in the description and provide evidence for manual testing of the code.
First response (clarifying questions/guidance on improvements/answering questions) - Target: 48 hours Detailed review and feedback on PRs - Target: 7 days
We'd love to know about any bug or defect you find, no matter how small it is.
First response (clarifying questions/guidance on improvements/answering questions) - Target: 48 hours
We'd love to hear from you. Any feedback, idea or feature request is most welcomed.
First response (clarifying questions/guidance on improvements/answering questions) - Target: 72 hours
Add Tyk pump to the docker compose so we can stream analytics to a data sink.
For question on products, please use Tyk Community forum.
Clients can also use [email protected].
Potential clients and evaluators, please use [email protected].
No open issues yet, or sync has not completed.