Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/firetail-io/firetail-apisix-go-plugin
https://github.com/firetail-io/firetail-apisix-go-plugin
Last synced: 4 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/firetail-io/firetail-apisix-go-plugin
- Owner: FireTail-io
- License: lgpl-2.1
- Created: 2024-03-08T18:59:10.000Z (9 months ago)
- Default Branch: dev
- Last Pushed: 2024-04-30T15:41:05.000Z (7 months ago)
- Last Synced: 2024-05-02T08:22:01.313Z (7 months ago)
- Language: Go
- Size: 12.6 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
### Building
In the root directory, run `make build`
### Running in development mode
In the root directory, run the unix socket with `APISIX_LISTEN_ADDRESS=unix:/tmp/runner.sock APISIX_CONF_EXPIRE_TIME=3600 ./go-runner run`
Then in apisix's configuration file `config.yaml` add this:
```
ext-plugin:
path_for_test: /tmp/runner.sock
```and restart apisix `apisix restart`
### Testing
#### Enable both firetail request and response filtering via apisix API:
**NOTE** You will need to run your application at localhost (127.0.0.1) port 1980. If you wish to point it elsewhere, change the "nodes" parameter from example below.
```
curl http://127.0.0.1:9180/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"uri": "/profile/alice/comment",
"plugins": {
"ext-plugin-pre-req": {
"conf": [
{"name":"firetail", "value":"{\"body\":\"\"}"}
]
},
"ext-plugin-post-resp": {
"conf": [
{"name":"firetail", "value":"{\"body\":\"\"}"}
]
}
},
"upstream": {
"type": "roundrobin",
"nodes": {
"127.0.0.1:1980": 1
}
}
}'
```## Demo Setup
A demo setup using the FireTail APISIX plugin can be found in the [`/demo`](./demo) directory.
Docker compose is used to run:
1. An APISIX container which has been modified to use the FireTail APISIX plugin.
2. An NGINX instance with mocked API responses which can be used to demonstrate request and response validation.Getting it up and running should be as simple as:
```bash
git clone [email protected]:FireTail-io/firetail-apisix-go-plugin.git
cd firetail-apisix-go-plugin/demo
docker compose up
```You can then make a request to the health endpoint to check everything's working:
```bash
curl localhost:9080/health
```To get the demo setup to ship logs to the FireTail SaaS platform, create a copy of [`demo/.env.example`](./demo/.env.example) at `demo/.env` and modify it.
```bash
cp .env.example .env
nano .env
```