[go: up one dir, main page]

0% found this document useful (0 votes)
141 views4 pages

Apisix Info

Download as txt, pdf, or txt
Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1/ 4

https://apisix.apache.

org/docs/apisix/getting-started/
https://apisix.apache.org/blog/2021/06/28/why-we-need-apache-apisix/

https://dev.to/apisix/3-ways-to-deploy-apache-apisix-on-aws-part-1-aws-ec2-2c86
https://dev.to/apisix/3-ways-to-deploy-apache-apisix-on-aws-part-2-aws-ess-gfi
https://www.youtube.com/watch?v=dUOjJkb61so
https://apache.googlesource.com/apisix/+/refs/tags/1.3/doc/getting-started.md

docker down permission issue:


https://gist.github.com/zenthangplus/4b2d534fa85031ae6c652ffe16ae5da2
https://apisix.apache.org/docs/apisix/plugins/redirect/

web1 and web2 examples:


https://developpaper.com/a-new-generation-of-api-gateway-with-visual-management-
document-friendly/
https://apisix.apache.org/docs/docker/example/

eureka apisix integration:


https://apisix.apache.org/blog/2022/03/05/apisix-integration-eureka-service-
discovery/
https://developpaper.com/api-gateway-apache-apis-ix-integrates-eureka-as-service-
discovery/
https://apisix.apache.org/docs/apisix/next/discovery/

https://dev.to/apisix/centralized-authentication-with-apache-apisix-plugins-30fo

API key: perfiosintegreat


Dashboard username and password:
docker-compose -p docker-apisix up -d
docker-compose -p docker-apisix down

docker exec -it saas-integreat /bin/bash

verify admin api:

curl "http://127.0.0.1:9080/apisix/admin/services/" -H 'X-API-KEY:


perfiosintegreat'

create a route:
curl "http://127.0.0.1:9080/apisix/admin/routes/1" -H "X-API-KEY: perfiosintegreat"
-X PUT -d '
{
"methods": ["GET"],
"host": "example.com",
"uri": "/anything/*",
"upstream": {
"type": "roundrobin",
"nodes": {
"httpbin.org:80": 1
}
}
}'

curl http://localhost:9080/apisix/admin/routes -H 'X-API-KEY: perfiosintegreat' -X


POST -d '
{
"name": "Route to httpbin",
"uris": ["/demo/*"],
"upstream": {
"type": "roundrobin",
"nodes": {
"httpbin.org:80": 1
}
}
}'

verify dashboard for created route: http://localhost:9000/routes/list

verify url redirection:

curl -i -X GET "http://127.0.0.1:9080/anything/foo?arg=10" -H "Host: example.com"


curl -i 'http://127.0.0.1:9080/anything?foo=bar&baz' -X POST -d '{ "hello":
"world" }' -H "Host: example.com" 'Content-Type: application/json'

apisix eureka integration:

discovery: # service discovery center

eureka:

host: # it's possible to define multiple eureka


hosts addresses of the same eureka cluster.

- "http://vishal:Yab5HTrsdehQySnS@192.168.28.25:8761" # access address of


Eureka server started by spring boot
prefix: /eureka/
fetch_interval: 30 # default 30s

weight: 100 # default weight for node

timeout:

connect: 2000 # default 2000ms

send: 2000 # default 2000ms

read: 5000 # default 5000ms

curl http://127.0.0.1:9092/v1/discovery/eureka/dump

curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: perfiosintegreat' -


X PUT -i -d '
{
"uri": "/payuservice/*",
"plugins": {
"proxy-rewrite" : {
"regex_uri": ["^/payuservice/(.*)", "/${1}"]
}
},
"upstream": {
"service_name": "P2P-PAYU-GATEWAY-SERVICE",
"type": "roundrobin",
"discovery_type": "eureka"
}
}'

curl http://127.0.0.1:9080/apisix/admin/routes/2 -H 'X-API-KEY: perfiosintegreat' -


X PUT -i -d '
{
"uri": "/payuservice/*",
"plugins": {
"proxy-rewrite" : {
"regex_uri": ["^/payuservice/(.*)", "/${1}"]
}
},
"upstream": {
"service_name": "P2P-PAYU-GATEWAY-SERVICE",
"type": "roundrobin",
"discovery_type": "eureka"
}
}'

curl http://127.0.0.1:9080/apisix/admin/routes/3 -H 'X-API-KEY: perfiosintegreat' -


X PUT -i -d '
{
"uri": "/loanreport/*",
"plugins": {
"proxy-rewrite" : {
"regex_uri": ["^/loanreport/(.*)", "/${1}"]
}
},
"upstream": {
"service_name": "LOANREPORT",
"type": "roundrobin",
"discovery_type": "eureka"
}
}'

curl http://127.0.0.1:9080/apisix/admin/routes/427716274848531210 -H 'X-API-KEY:


perfiosintegreat' -X GET
curl http://127.0.0.1:9080/apisix/admin/upstreams/427716129272627978 -H 'X-API-KEY:
perfiosintegreat' -X GET

while true; do curl http://localhost:9080/api/web1/ ; sleep 0.3; echo; done

while true; do curl http://localhost:9080/api/web2/ ;sleep 1; echo; done


while true; do curl http://api.perfios.com:9080/api/loanreport/generateReport ;
sleep 1; echo; done
while true; do curl http://localhost:9080/api/loanreport/generateReport ; sleep 1;
echo; done

curl http://localhost:9080/loanreport/
curl http://localhost:9080/loanreport/ -H "host: localhost:9080"
curl http://192.168.1.40:9080/loanreport/ -H "host: localhost:9080"

curl http://172.80.19.5:7000/loanreport/ -H "host: localhost:9080"

office ip: 192.168.28.25


192.168.28.67
home ip: 192.168.1.40

local ports:
http://localhost:9081/web1/
http://localhost:9082/web2/
http://localhost:7100/notification
http://localhost:7000/loanreport

http://192.168.1.40:9081/web1/
http://192.168.1.40:9082/web2/
http://192.168.1.40:7100/notification
http://192.168.1.40:7000/loanreport

http://api.perfios.com:9080/api/web1/
http://api.perfios.com:9080/api/web2/
http://api.perfios.com:9080/api/notification/
http://api.perfios.com:9080/api/notification/sendSMS
http://api.perfios.com:9080/api/loanreport/
http://api.perfios.com:9080/api/loanreport/generateReport

You might also like