Tyk Sync Feature | Tyk Dashboard (Licensed) |
---|---|
Backup objects from Tyk to a directoryIf you want to backup your API definitions, policies and templates in Tyk, you can use thedump command. It allows you to save the objects in transportable files. You can use this command to backup important API configurations before upgrading Tyk, or to save API configurations from one Dashboard instance and then use update , publish , or sync commands to update the API configurations to another Dashboard instance. | ✅ |
Synchronise objects from Git (or any VCS) to TykTo implement GitOps for API management, store your API definitions, policies and templates in Git or any version control system. Use thesync command to synchronise those objects to Tyk. During this operation, Tyk Sync will delete any objects in the Dashboard that cannot be found in the VCS, and update those that can be found and create those that are missing. | ✅ |
Update objectsTheupdate command will read from VCS or file system and will attempt to identify matching API definitions, policies and templates in the target Dashboard, and update them. Unmatched objects will not be created. | ✅ |
Publish objectsThepublish command will read from VCS or file system and create API definitions, policies, and templates in target Dashboard. This will not update any existing objects. If it detects a collision, the command will stop. | ✅ |
Show and import Tyk examplesTheexamples command allow you to show and import Tyk examples. An easy way to load up your Tyk installation with some interesting examples! | ✅ |
--allow-unsafe-oas
flag when invoking Tyk Sync. Note that Tyk Sync versions v1.4.1 to 1.4.3 do not support API Category for Tyk OAS APIs.
Working with Tyk Streams APIs
Tyk Streams API support was introduced in Tyk Dashboard v5.7.0. Tyk Sync v2.0 and later is compatible with Tyk Streams APIs and manages them similarly to Tyk OAS APIs. With Tyk Sync, you can seamlessly sync, publish, update, and dump Tyk Streams APIs just like OAS APIs.
Note: The Streams API validator is not applied during these operations.
Working with Open Source Gateway
From Sync v2.0, compatibility with the Open Source Tyk Gateway has been removed, making Tyk Sync v2.0 compatible exclusively with licensed Tyk Dashboard. As a result, Tyk Sync is no longer usable with the Open Source (OSS) version of the Tyk Gateway.
--dashboard
and --secret
options.
http://localhost:3000
) and SECRET refers to the API access key use to access your Dashboard API. For dashboard users, you can get it from the “Users” page under “Tyk Dashboard API Access Credentials”.
If you prefer not to provide the secret via the command line, you can set the environment variable TYKGIT_DB_SECRET
instead. This method keeps your secret secure and avoids exposure in command history.
--gateway
and --secret
options.
http://localhost:8080
) and SECRET refers to the API secret (secret
parameter in your tyk.conf file) used to access your Gateway API.
If you prefer not to provide the secret via the command line, you can set the environment variable TYKGIT_GW_SECRET
instead. This method keeps your secret secure and avoids exposure in command history.
dev-backup
.
dev-backup
directory to your staging Tyk Dashboard.
sync
, update
, and publish
commands, you need to specify where Tyk Sync can get the source API configurations to update the target Tyk installation. You can store the source files either in a Git repository or the local file system.
master
branch. To specify a different branch, use the --branch
or -b
flag. If the Git repository requires connection using Secure Shell Protocol (SSH), you can specify SSH keys with --key
or -k
flag.
--path
or -p
flag to specify the source directory for your API configuration files.
.tyk.json
index file is required at the root of the source Git repository or the specified path. This .tyk.json
file lists all the files that should be processed by Tyk Sync.
Example .tyk.json
:
.github/workflows/tyk-backup.yml
.tyk-backup.yml
file:TYK_SYNC_VERSION
: The version of Tyk Sync you want to use.TYK_DASHBOARD_URL
: The URL of your Tyk Dashboard.TYK_DASHBOARD_SECRET
: The secret key for your Tyk Dashboard.AWS_S3_BUCKET
: The name of your AWS S3 bucket.AWS_ACCESS_KEY_ID
: Your AWS access key ID.AWS_SECRET_ACCESS_KEY
: Your AWS secret access key.tyk-backup.yml
file and push it to the main branch of your repository.
/apis/
for API definition files./policies/
for security policy files./assets/
for API template files..github/workflows/tyk-sync.yml
.tyk-sync.yml
file:TYK_SYNC_VERSION
: The version of Tyk Sync you want to use (e.g., v2.0.0).TYK_DASHBOARD_URL
: The URL of your Tyk Dashboard.TYK_DASHBOARD_SECRET
: The secret key for your Tyk Dashboard.tyk-sync.yml
file and push it to the main branch of your repository.
.tyk.json
file including all JSON files in the repository and use the sync
command to update the Tyk installation.
.tyk.json
file to list all API definition files that Tyk Sync should process.
Example .tyk.json
:
publish
command to upload your local API definitions to Tyk. Use Docker bind mounts to access your local files.
Aspect | Details |
---|---|
Command | tyk-sync dump |
Usage | tyk-sync dump -d DASHBOARD_URL [-s SECRET] [-t PATH] |
Flags | -d, --dashboard DASHBOARD_URL : Tyk Dashboard URL (required)-h, --help : Help for the dump command-t, --target PATH : Target directory for output files (optional)-s, --secret SECRET : API secret for Dashboard access (optional)--apis IDS : Specific API IDs to dump--oas-apis IDS : Specific OAS API IDs to dump--policies IDS : Specific policy IDs to dump--templates IDS : Specific template IDs to dump |
Example | tyk-sync dump --dashboard http://tyk-dashboard:3000 --secret your-secret |
Example | tyk-sync dump --dashboard http://tyk-dashboard:3000 --secret your-secret --target /path/to/backup --apis c2ltcGxlLWdyYXBoLWRldi90eWthcGktc2NoZW1h,baa5d2b65f1b45385dac3aeb658fa04c |
Aspect | Details |
---|---|
Command | tyk-sync examples |
Usage | tyk-sync examples [flags] tyk-sync examples [command] |
Subcommands | publish : Publish a specific exampleshow : Show details of a specific example |
Flags | -h, --help : Help for examples command |
Example | tyk-sync examples |
Aspect | Details |
---|---|
Command | tyk-sync examples show |
Usage | tyk-sync examples show [flags] |
Flags | -h, --help : Help for show command-l, --location string : Location of the example |
Example | tyk-sync examples show --location="udg/vat-checker" |
Aspect | Details |
---|---|
Command | tyk-sync examples publish |
Usage | tyk-sync examples publish [flags] |
Flags | -b, --branch string : Branch to use (default “refs/heads/main”)-d, --dashboard string : Dashboard target URL-g, --gateway string : Gateway target URL-h, --help : Help for publish command-k, --key string : Key file location for auth-l, --location string : Location of the example-s, --secret string : API secret--test : Use test publisher, output to stdio |
Example | tyk-sync examples publish -d="http://localhost:3000" -s="b2d420ca5302442b6f20100f76de7d83" -l="udg/vat-checker" |
Aspect | Details |
---|---|
Command | tyk-sync publish |
Usage | tyk-sync publish {-d DASHBOARD_URL | -g GATEWAY_URL} [-s SECRET] [-b BRANCH] [-k SSHKEY] [-o ORG_ID] REPOSITORY_URL tyk-sync publish {-d DASHBOARD_URL | -g GATEWAY_URL} [-s SECRET] [-o ORG_ID] -p PATH |
Flags | -b, --branch BRANCH : Git branch (default “refs/heads/master”)-d, --dashboard DASHBOARD_URL : Dashboard URL-g, --gateway GATEWAY_URL : Gateway URL-h, --help : Help for publish command-k, --key SSHKEY : SSH key file location-p, --path PATH : Source file directory-s, --secret SECRET : API secret--no-delete : Skip deletion of resources during synchronisation --test : Use test publisher--allow-duplicate-listenpaths : Allow duplicate listen paths--apis IDS : Specific API IDs to publish--oas-apis IDS : Specific OAS API IDs to publish--policies IDS : Specific policy IDs to publish--templates IDS : Specific template IDs to publish |
Example | tyk-sync publish -d http://tyk-dashboard:3000 -s your-secret -p /app/data --apis 726e705e6afc432742867e1bd898cb23 |
Example | tyk-sync publish -d http://tyk-dashboard:3000 -s your-secret -b develop https://github.com/your-repo/your-apis |
Aspect | Details |
---|---|
Command | tyk-sync sync |
Usage | tyk-sync sync {-d DASHBOARD_URL | -g GATEWAY_URL} [-s SECRET] [-b BRANCH] [-k SSHKEY] [-o ORG_ID] REPOSITORY_URL tyk-sync sync {-d DASHBOARD_URL | -g GATEWAY_URL} [-s SECRET] [-o ORG_ID] -p PATH |
Flags | -b, --branch BRANCH : Git branch (default “refs/heads/master”)-d, --dashboard DASHBOARD_URL : Dashboard URL-g, --gateway GATEWAY_URL : Gateway URL-h, --help : Help for sync command-k, --key SSHKEY : SSH key file location-o, --org ORG_ID : Override organization ID-p, --path PATH : Source file directory-s, --secret SECRET : API secret--test : Use test publisher--apis IDS : Specific API IDs to sync (to be deprecated)--policies IDS : Specific policy IDs to sync (to be deprecated) |
Example | tyk-sync sync -d http://tyk-dashboard:3000 -s your-secret https://github.com/your-repo/your-apis |
Example | tyk-sync sync -d http://tyk-dashboard:3000 -s your-secret -p /path/to/your/apis |
Aspect | Details |
---|---|
Command | tyk-sync update |
Usage | tyk-sync update {-d DASHBOARD_URL | -g GATEWAY_URL} [-s SECRET] [-b BRANCH] [-k SSHKEY] [-o ORG_ID] REPOSITORY_URL tyk-sync update {-d DASHBOARD_URL | -g GATEWAY_URL} [-s SECRET] [-o ORG_ID] -p PATH |
Flags | -b, --branch BRANCH : Git branch (default “refs/heads/master”)-d, --dashboard DASHBOARD_URL : Dashboard URL-g, --gateway GATEWAY_URL : Gateway URL-h, --help : Help for update command-k, --key SSHKEY : SSH key file location-p, --path PATH : Source file directory-s, --secret SECRET : API secret--test : Use test publisher--apis IDS : Specific API IDs to update--oas-apis IDS : Specific OAS API IDs to update--policies IDS : Specific policy IDs to update--templates IDS : Specific template IDs to update |
Example | tyk-sync update -d http://tyk-dashboard:3000 -s your-secret -p /app/data --apis 726e705e6afc432742867e1bd898cb23 |
Example | tyk-sync update -d http://tyk-dashboard:3000 -s your-secret -b develop https://github.com/your-repo/your-apis |
tyk-sync dump -d http://dashboard:3000 -s secret -t ./configs