This project allows you to create custom plugins for the KrakenD API Gateway. It includes a build script that automates the compilation of plugins from source code into shared objects (.so files) and a Docker Compose setup to run KrakenD with these plugins.
- Docker
- Docker Compose
- Basic knowledge of Docker and command-line operations
plugins/: Directory where each subdirectory is a plugin. Create your plugin directories here.build.sh: Script to build all plugins in theplugins/directory.krakend.json: Krakend config file for Routes configuration.docker-compose.yml: Docker Compose configuration file to run KrakenD with built plugins.
-
Create a Plugin: Navigate to the
plugins/directory and create a new directory for your plugin. The directory name will be used as the plugin name.mkdir -p plugins/my-plugin
-
Add Plugin Code: Place your Go source code inside this new directory.
Before running the API gateway, you need to build the plugins using the provided script.
-
Make the Build Script Executable:
chmod +x build.sh
-
Run the Build Script:
./build.sh
This script will compile each plugin into a
.sofile and move it to theplugins/directory.
After building the plugins, you can start the KrakenD API Gateway with all plugins loaded:
docker-compose upThis command starts the KrakenD service as defined in the docker-compose.yml file, loading all the built plugins.
If needed, you can edit the docker-compose.yml file to tweak the KrakenD configuration or to add additional services to your setup.