https://github.com/dyrnq/aia
apisix instance agent (abbr. aia) ,is a cli for manage apisix instance, eg. read and write config.yaml, reload apisix, stop apisix.
https://github.com/dyrnq/aia
apisix apisix-agent apisix-manager apisix-sentinel apisix-sidecar
Last synced: 3 months ago
JSON representation
apisix instance agent (abbr. aia) ,is a cli for manage apisix instance, eg. read and write config.yaml, reload apisix, stop apisix.
- Host: GitHub
- URL: https://github.com/dyrnq/aia
- Owner: dyrnq
- License: mit
- Created: 2024-09-02T08:08:34.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-28T04:04:56.000Z (7 months ago)
- Last Synced: 2025-03-28T05:19:17.443Z (7 months ago)
- Topics: apisix, apisix-agent, apisix-manager, apisix-sentinel, apisix-sidecar
- Language: Go
- Homepage:
- Size: 28.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# apisix-instance-agent
apisix instance agent (abbr. aia) ,is a cli for manage apisix instance, eg. read and write config.yaml, reload apisix, stop apisix.
```bash
./aia --help
Usage of ./aia:
--allowed-ip string Comma-separated list of allowed IPs
--apisix-config string apisix-config
--apisix-reload-cmd string apisix-reload-cmd
--apisix-restart-cmd string apisix-restart-cmd
--apisix-start-cmd string apisix-start-cmd
--apisix-stop-cmd string apisix-stop-cmd
-h, --help aia, apisix instance agent.
--listen string listen address (default ":5980")
--release-mode string gin.ReleaseMode (default "true")
--version print version
--x-api-key string x-api-key (default "your-secret-api-key")
```## usage
```bashopenssl rand -base64 32
1kD+yHW1hjE7Dy0RzVjIChENoR0TaI9Zt30K5rzDzeQ=./aia \
--listen :5980 \
--apisix-config /opt/apisix/conf/config.yaml \
--apisix-reload-cmd "docker exec -t apisix bash -c \"apisix reload\"" \
--apisix-stop-cmd "docker stop apisix || true" \
--apisix-start-cmd "docker start apisix" \
--apisix-restart-cmd "docker restart apisix" \
--x-api-key "1kD+yHW1hjE7Dy0RzVjIChENoR0TaI9Zt30K5rzDzeQ=" \
--allowed-ip 192.168.1.0/24,127.0.0.1,172.17.0.0/16
```## http rest api
### read/write config
```bash
## read
curl --fail -sS -H "X-API-KEy: 1kD+yHW1hjE7Dy0RzVjIChENoR0TaI9Zt30K5rzDzeQ=" -X GET http://127.0.0.1:5980/api/v1/config | jq -r ".data" | base64 -d
``````bash
## write
curl --fail -sS -H "X-API-KEy: 1kD+yHW1hjE7Dy0RzVjIChENoR0TaI9Zt30K5rzDzeQ=" -X POST http://127.0.0.1:5980/api/v1/config -d "{\"data\": \"$base64Str\"}"
```### apisix instance operate
```bash
## reload config
curl --fail -sS -H "X-API-KEy: 1kD+yHW1hjE7Dy0RzVjIChENoR0TaI9Zt30K5rzDzeQ=" -X GET http://127.0.0.1:5980/api/v1/reload | jq
## stop
curl --fail -sS -H "X-API-KEy: 1kD+yHW1hjE7Dy0RzVjIChENoR0TaI9Zt30K5rzDzeQ=" -X GET http://127.0.0.1:5980/api/v1/stop | jq
## start
curl --fail -sS -H "X-API-KEy: 1kD+yHW1hjE7Dy0RzVjIChENoR0TaI9Zt30K5rzDzeQ=" -X GET http://127.0.0.1:5980/api/v1/start | jq
## restart
curl --fail -sS -H "X-API-KEy: 1kD+yHW1hjE7Dy0RzVjIChENoR0TaI9Zt30K5rzDzeQ=" -X GET http://127.0.0.1:5980/api/v1/restart | jq
```