This document provides detailed information about the Tyk Demo architecture and its components. It is intended for developers and users working with Tyk Demo.
Tyk Demo implements a modular architecture with two types of deployments:
-
Base Deployment (mandatory)
- Located in
deployments/tykdirectory - Provides standard Tyk components (Gateway, Dashboard, Pump)
- Includes supporting databases (Redis and MongoDB)
- Implements a wide range of core Tyk features and capabilities
- Serves as the foundation for all feature deployments
- Located in
-
Feature Deployments (optional)
- Extend the base deployment functionality
- Focus on specific Tyk capabilities or use cases
- Located in separate directories under
deployments/ - Require the base deployment to function correctly
tyk-demo/
├── deployments/ # All available deployments
│ ├── tyk/ # Base deployment
│ ├── analytics-kibana/ # Feature deployment example
│ ├── cicd/ # Feature deployment example
│ └── ... # Other feature deployments
├── docs/ # General documentation
├── scripts/ # Utility scripts
├── docker-compose-command.sh # Helper for Docker Compose commands
├── down.sh # Deployment removal script
├── README.md # Main documentation
└── up.sh # Deployment creation script
Each deployment directory may contain:
| File/Directory | Description | Required |
|---|---|---|
bootstrap.sh |
Initialisation script | Yes |
deployment.json |
Metadata manifest | No |
docker-compose.yml |
Container configuration | Yes |
README.md |
Documentation | No |
data/ or volumes/ |
Data and volume mappings | No |
scripts/ |
Utility scripts | No |
scripts/examples/ |
Script-based examples | No |
teardown.sh |
Removes non-Docker assets | No |
tyk_demo_<deployment>.postman_collection.json |
Postman-based examples and tests | No |
The base deployment includes:
- Tyk Gateway: API Gateway responsible for managing traffic
- Tyk Dashboard: Web interface for managing APIs, policies, and users
- Tyk Pump: Analytics processor that moves data between Redis and MongoDB
- Redis: Primary database for the Tyk Gateway
- MongoDB: Primary database for the Tyk Dashboard
Feature deployments integrate with the base deployment by:
- Extending the base Docker Compose deployment with additional containers
- Configuring integration points with the base deployment
- Running bootstrap scripts to prepare the deployment
- Displaying deployment-specific information
When executing the up.sh script, the following process occurs:
- Determine which deployments to create/resume
- Launch all required containers with Docker Compose
- Execute the bootstrap scripts for each deployment
- Record deployments in
.bootstrap/bootstrapped_deployments
The bootstrap scripts handle all the actions necessary in order to prepare the deployment for usage:
- Configures environment variables
- Prepares services
- Generates assets
- Imports data
- Validates system state
- Displays system information
Progress is logged to the logs/bootstrap.log file.
Tyk Demo uses Docker environment variables (stored in .env) to configure the deployment. These variables allow for customization without modifying the source configuration files.
Many of the other variables are automatically set by the scripts. If a deployment requires manually set environment variables, the relevant instructions will be contained in its readme.
All containers run within a Tyk Demo Docker network called tyk-demo_tyk. This enables cross-container access.
Some containers have ports mapped to the host, enabling the services within them to be accessed.
Some services and APIs use custom hostnames, which are added to the /etc/hosts file via the scripts/update-hosts.sh script. This is covered as part of the "getting started" process.