美文网首页
APISIX-DASHBOARD安装-docker-compos

APISIX-DASHBOARD安装-docker-compos

作者: heichong | 来源:发表于2023-01-06 09:06 被阅读0次

    前提

    先安装ETCD和APISIX

    安装APISIX-DASHBOARD

    • 创建文件夹
    mkdir data
    
    • apisix-dashboard config配置
    
    cat <<EOF  > data/dashboard_conf.yaml
    
    # example  https://github.com/apache/apisix-docker/blob/master/example/dashboard_conf/conf.yaml
    conf:
      listen:
        host: 0.0.0.0    
        port: 9000         
      allow_list:          
        - 0.0.0.0/0
      etcd:
        endpoints:         
          - "http://10.3.23.191:9904"
    
        mtls:
          key_file: ""         
          cert_file: ""        
          ca_file: ""          
    
      log:
        error_log:
          level: warn      
          file_path:
            logs/error.log 
                           
        access_log:
          file_path:
            logs/access.log 
      
      security:
          content_security_policy: "default-src 'self'; script-src 'self' 'unsafe-eval' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; frame-src *" 
    
    authentication:
      secret:
        secret
      expire_time: 3600    
      users:               
        - username: bidradmin  
          password: bidr.com.cn
    
    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
    
    EOF
    
    • 编写docker-compose.yml
    cat <<EOF  > docker-compose.yml
    version: '3'
    
    services:
      apisix:
        image: 'apache/apisix:3.1.0-centos'
        container_name: apisix
        environment:
          - TZ=Asia/Shanghai
        ports:
          - 9906:9080 
          - 9907:9091
          - 9908:9180
          - 9909:9443
        volumes:
          - ./data/config.yaml:/usr/local/apisix/conf/config.yaml
          - ./data/logs:/usr/local/apisix/logs
    
      apisix-dashboard:
        image: apache/apisix-dashboard:2.15.0-alpine
        container_name: apisix-dashboard
        restart: always
        volumes:
          - ./data/dashboard_conf.yaml:/usr/local/apisix-dashboard/conf/conf.yaml
          - ./data/dashboard_logs:/usr/local/apisix-dashboard/logs
        ports:
        - "9910:9000"
    
    
    EOF
    

    这里把apisix、apisix-dashboard 都放在一起了

    测试

    浏览器打开:http://10.3.23.191:9910
    输入用户名、密码后即可进入系统


    image.png

    相关文章

      网友评论

          本文标题:APISIX-DASHBOARD安装-docker-compos

          本文链接:https://www.haomeiwen.com/subject/zdrscdtx.html