-
Notifications
You must be signed in to change notification settings - Fork 4
Gateway API
The Scigateway will need to get plugins and API requests from several locations, to avoid the CORS problem we need to use an API gateway
The Scigateway application will route requests from the main application page to plugin UI elements and the plugin backend services, all of which may be hosted in different networks.
Kong is one potential open-source solution to this issue, providing a configurable API gateway.
- Kong requires a database backend which can be Cassandra or PostgreSQL.
- Documentation is quite clear on how the proxy should be configured: https://docs.konghq.com/1.0.x/proxy/, however configuration is NON TRIVIAL and made via REST API calls.
- Konga is third-party UI that has been developed for Kong configuration
- A docker-compose configuration is available that starts both Kong and Postgres containers: https://github.com/Kong/docker-kong/tree/master/compose. This is NOT a production solution but useful for configuration testing
- Docker images for Kong are available as a more production ready solution via https://github.com/docker-library/docs/tree/master/kong
- Kong is also available to be deployed as a Kubernetes ingress controller. This would be a viable production solution if there is a Kubernetes instance available: https://github.com/Kong/kubernetes-ingress-controller
Download the docker compose file from GitHub and start it with
docker-compose up
This creates a running instance of Kong (admin on localhost:8001
) which persists configuration between sessions.
For safety, all configuration should be scripted so it can be managed and updated if the docker images are replaced.
Services are added, updated and removed through a straightforward REST API.
Configuration is via application/json
or formated inline application/x-www-form-urlencoded
and works as expected.
- Create the service pointing at the machine HOSTING the backend, host here can be a dns name or IP address
$ curl -i -X POST http://localhost:8001/services -d 'name=plugin1-service' -d 'port=5001' -d 'host=<remote host IP>'
- Create a route mapping to the service.id returned by the create service call. The
paths[]
block defines which routes to match,strip_path
ensures the call is passed to<target>:<port>/tasks/<other stuff>
not simply<target>:<port>/<other stuff>
$ curl -i -X POST http://localhost:8001/routes/ -d 'paths[]=/tasks' -d 'service.id=0421e967-7816-4859-ab6d-832bfc84f2c4' -d 'strip_path=false'
- For the initial development an API Gateway has not been configured
-
Architecture
-
Dev environment
-
Developing a plugin
-
Deployment
- Deploying SciGateway
- SciGateway Settings
- Deploying plugins
-
Releasing
-
Plugins
-
Continuous Integration
-
UX
-
Feedback