使用?docker?部署?APISIX的詳細(xì)介紹
二話不說(shuō),上個(gè) docker-compose.yml 為敬!
version: "3"
services:
apisix-dashboard:
image: apache/apisix-dashboard:2.10.1-alpine
restart: always
volumes:
- ./dashboard_conf/conf.yaml:/usr/local/apisix-dashboard/conf/conf.yaml
ports:
- "4000:9000"
networks:
apisix:
apisix:
image: apache/apisix:2.12.1-alpine
- ./apisix_log:/usr/local/apisix/logs
- ./apisix_conf/config.yaml:/usr/local/apisix/conf/config.yaml:ro
depends_on:
- etcd
##network_mode: host
- "4080:9080/tcp"
- "4091:9091/tcp"
- "4443:9443/tcp"
- "4092:9092/tcp"
etcd:
image: bitnami/etcd:3.4.15
- etcd_data:/bitnami/etcd
environment:
ETCD_ENABLE_V2: "true"
ALLOW_NONE_AUTHENTICATION: "yes"
ETCD_ADVERTISE_CLIENT_URLS: "http://0.0.0.0:2379"
ETCD_LISTEN_CLIENT_URLS: "http://0.0.0.0:2379"
- "2379:2379/tcp"
networks:
driver: bridge
volumes:
etcd_data:可以修改 apisix-dashboard 的 port 和 apisix 的 port。apisix 容器的 9080 端口對(duì)應(yīng)的就是其內(nèi)部 OpenRestry 監(jiān)聽的端口,這個(gè)要選擇好,后面反代的端口就是這個(gè)。
etcd 就不用修改什么了,默認(rèn)就好。
apisix_conf/config.yaml
apisix:
node_listen: 9080 # APISIX listening port
enable_ipv6: false
allow_admin: # http://nginx.org/en/docs/http/ngx_http_access_module.html#allow
- 0.0.0.0/0 # We need to restrict ip access rules for security. 0.0.0.0/0 is for test.
admin_key:
- name: "admin"
key: edd1c9f034335f136f87ad84b625c8f1
role: admin # admin: manage all configuration data
# viewer: only can view configuration data
- name: "viewer"
key: 4054f7cf07e344346cd3f287985e76a2
role: viewer
enable_control: true
control:
ip: "0.0.0.0"
port: 9092
etcd:
host: # it's possible to define multiple etcd hosts addresses of the same etcd cluster.
- "http://etcd:2379" # multiple etcd address
prefix: "/apisix" # apisix configurations prefix
timeout: 30 # 30 seconds
plugin_attr:
prometheus:
export_addr:
ip: "0.0.0.0"
port: 9091這里需要修改 admin_key,座位 AdminAPI 的認(rèn)證 key
dashboard_conf/conf.yaml
conf:
listen:
host: 0.0.0.0 # `manager api` listening ip or host name
port: 9000 # `manager api` listening port
allow_list: # If we don't set any IP list, then any IP access is allowed by default.
- 0.0.0.0/0
etcd:
endpoints: # supports defining multiple etcd host addresses for an etcd cluster
- "http://etcd:2379"
# yamllint disable rule:comments-indentation
# etcd basic auth info
# username: "root" # ignore etcd username if not enable etcd auth
# password: "123456" # ignore etcd password if not enable etcd auth
mtls:
key_file: "" # Path of your self-signed client side key
cert_file: "" # Path of your self-signed client side cert
ca_file: "" # Path of your self-signed ca cert, the CA is used to sign callers' certificates
# prefix: /apisix # apisix config's prefix in etcd, /apisix by default
log:
error_log:
level: warn # supports levels, lower to higher: debug, info, warn, error, panic, fatal
file_path:
logs/error.log # supports relative path, absolute path, standard output
# such as: logs/error.log, /tmp/logs/error.log, /dev/stdout, /dev/stderr
access_log:
logs/access.log # supports relative path, absolute path, standard output
# such as: logs/access.log, /tmp/logs/access.log, /dev/stdout, /dev/stderr
# log example: 2020-12-09T16:38:09.039+0800 INFO filter/logging.go:46 /apisix/admin/routes/r1 {"status": 401, "host": "127.0.0.1:9000", "query": "asdfsafd=adf&a=a", "requestId": "3d50ecb8-758c-46d1-af5b-cd9d1c820156", "latency": 0, "remoteIP": "127.0.0.1", "method": "PUT", "errs": []}
authentication:
secret:
secret # secret for jwt token generation.
# NOTE: Highly recommended to modify this value to protect `manager api`.
# if it's default value, when `manager api` start, it will generate a random string to replace it.
expire_time: 3600 # jwt token expire time, in second
users: # yamllint enable rule:comments-indentation
- username: admin # username and password for login `manager api`
password: admin
- username: user
password: user
plugins: # plugin list (sorted in alphabetical order)
- api-breaker
- authz-keycloak
- basic-auth
- batch-requests
- consumer-restriction
- cors
# - dubbo-proxy
- echo
# - error-log-logger
# - example-plugin
- fault-injection
- grpc-transcode
- hmac-auth
- http-logger
- ip-restriction
- jwt-auth
- kafka-logger
- key-auth
- limit-conn
- limit-count
- limit-req
# - log-rotate
# - node-status
- openid-connect
- prometheus
- proxy-cache
- proxy-mirror
- proxy-rewrite
- redirect
- referer-restriction
- request-id
- request-validation
- response-rewrite
- serverless-post-function
- serverless-pre-function
# - skywalking
- sls-logger
- syslog
- tcp-logger
- udp-logger
- uri-blocker
- wolf-rbac
- zipkin
- server-info
- traffic-split這里需要修改的是 users 中的賬號(hào)和密碼作為登陸的憑證
以上內(nèi)容都可以在官方的 apisix_docker 倉(cāng)庫(kù)中的 example 找到。apisix github
到此這篇關(guān)于使用 docker 部署 APISIX的文章就介紹到這了,更多相關(guān)docker 部署 APISIX內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
詳解docker 允許主機(jī)ssh連接到docker容器中
本篇文章主要介紹了詳解docker 允許主機(jī)ssh到docker容器中,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-05-05
Docker中安裝Redis并開啟遠(yuǎn)程訪問(wèn)的詳細(xì)步驟
這篇文章主要介紹了Docker中安裝Redis并開啟遠(yuǎn)程訪問(wèn)的詳細(xì)步驟,文中有詳細(xì)的代碼示例供大家參考,對(duì)大家的學(xué)習(xí)或工作有一定的幫助,需要的朋友可以參考下2025-01-01
Docker容器下運(yùn)行Nginx并實(shí)現(xiàn)反向代理
這篇文章介紹了Docker容器下運(yùn)行Nginx并實(shí)現(xiàn)反向代理的方法,對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2022-03-03
Docker 部署 Prometheus的安裝詳細(xì)教程
這篇文章主要介紹了Docker 部署 Prometheus及安裝方法,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2021-08-08
docker安裝minio及實(shí)現(xiàn)文件上傳、刪除、下載方式
這篇文章主要介紹了docker安裝minio及實(shí)現(xiàn)文件上傳、刪除、下載方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-03-03
idea使用docker插件一鍵部署項(xiàng)目的操作方法
這篇文章主要介紹了idea使用docker插件一鍵部署項(xiàng)目的操作方法,本文通過(guò)圖文實(shí)例相結(jié)合給大家介紹的非常詳細(xì),感興趣的朋友一起看看吧2025-04-04
jenkins中通過(guò)Publish Over SSH插件將項(xiàng)目部署到遠(yuǎn)程機(jī)器上的講解說(shuō)明
今天小編就為大家分享一篇關(guān)于jenkins中通過(guò)Publish Over SSH插件將項(xiàng)目部署到遠(yuǎn)程機(jī)器上的講解說(shuō)明,小編覺(jué)得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來(lái)看看吧2019-02-02
Docker load之后鏡像名字為none問(wèn)題解決方法
這篇文章主要介紹了Docker load之后鏡像名字為none問(wèn)題解決方法,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-12-12
docker如何查看容器啟動(dòng)命令(已運(yùn)行的容器)
Docker是一個(gè)開源的應(yīng)用容器引擎,讓開發(fā)者可以打包他們的應(yīng)用以及依賴包到一個(gè)可移植的容器中,然后發(fā)布到任何流行的Linux機(jī)器上,下面這篇文章主要給大家介紹了關(guān)于docker如何查看容器啟動(dòng)命令(已運(yùn)行的容器)的相關(guān)資料,需要的朋友可以參考下2023-02-02

