第一步:github下载源码
参考:https://apisix.apache.org/zh/docs/apisix/installation-guide/
git clone https://github.com/apache/apisix-docker.git
cd apisix-docker/example
第二步:添加Apisix Dashboard镜像
打开./apisix-docker/example/docker-compose.yaml的services:部分添加apisix-dashboard镜像依赖
apisix-dashboard:
image: apache/apisix-dashboard:3.0.1-alpine
restart: always
volumes:
- ./dashboard_conf/conf.yaml:/usr/local/apisix-dashboard/conf/conf.yaml
depends_on:
- etcd
ports:
- "9000:9000/tcp"
networks:
apisix:
environment:
- TZ=Asia/Shanghai
第三步:Apisix Dashboard镜像需要挂载配置文件
创建文件夹及文件:参考https://ryanchan.top/archives/optimizing-api-management-and-traffic-control-with-apisix-dashboard
./dashboard_conf/conf.yaml
conf:
listen:
port: 9000
allow_list:
- 127.0.0.1
- ::1
- 0.0.0.0/0
etcd:
endpoints:
- etcd:2379
mtls:
key_file: ""
cert_file: ""
ca_file: ""
log:
error_log:
level: warn
file_path:
logs/error.log
access_log:
file_path:
logs/access.log
max_cpu: 0
authentication:
secret:
secret
expire_time: 3600
users:
- username: admin
password: admin
plugins:
- api-breaker
- authz-keycloak
- basic-auth
- batch-requests
- consumer-restriction
- cors
- echo
- fault-injection
- grpc-transcode
- hmac-auth
- http-logger
- ip-restriction
- jwt-auth
- kafka-logger
- key-auth
- limit-conn
- limit-count
- limit-req
- openid-connect
- prometheus
- proxy-cache
- proxy-mirror
- proxy-rewrite
- redirect
- referer-restriction
- request-id
- request-validation
- response-rewrite
- serverless-post-function
- serverless-pre-function
- sls-logger
- syslog
- tcp-logger
- udp-logger
- uri-blocker
- wolf-rbac
- zipkin
- server-info
- traffic-split
第四步:启动
# 启动
docker-compose -p docker-apisix up -d
# 删除
docker-compose -p docker-apisix down