引言
本文主要将 apisix、apisix-dashboard、etcd 以 docker compose 的方式进行部署,目前只是出于开发目的。
配置文件
docker-compose.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55version: "3"
services:
apisix-dashboard:
image: apache/apisix-dashboard
restart: always
container_name: apisix-dashboard
volumes:
- /Users/tubetrue01/Applications/Docker/containers/apisix/logs/dashboard:/usr/local/apisix-dashboard/logs
- /Users/tubetrue01/Applications/Docker/containers/apisix/conf/conf-dashboard.yaml:/usr/local/apisix-dashboard/conf/conf.yaml:ro
ports:
- 9000:9000
depends_on:
- etcd
links:
- etcd
networks:
- apisix
apisix:
image: apache/apisix
restart: always
container_name: apisix
volumes:
- /Users/tubetrue01/Applications/Docker/containers/apisix/conf/config.yaml:/usr/local/apisix/conf/config.yaml
- /Users/tubetrue01/Applications/Docker/containers/apisix/logs/apisix:/usr/local/apisix/logs
ports:
- 9080:9080
- 9091:9091
- 9443:9443
depends_on:
- etcd
networks:
- apisix
links:
- etcd
etcd:
# if you are in the mainland China, please use Azure China mirror:
# image: gcr.azk8s.cn/etcd-development/etcd:v3.3.12
image: bitnami/etcd
restart: always
container_name: etcd
volumes:
- /Users/tubetrue01/Applications/Docker/containers/apisix/data/etcd:/etcd_data
environment:
ETCD_DATA_DIR: /etcd_data
ALLOW_NONE_AUTHENTICATION: "yes"
ports:
- 2379:2379
networks:
- apisix
networks:
apisix:
driver: bridgeapisix-dashboard.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31conf:
listen:
port: 9000 # The port on which the `Manager API` should listen.
etcd:
endpoints: # supports defining multiple etcd host addresses for an etcd cluster
- etcd:2379
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
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
access_log:
file_path:
logs/access.log # supports relative path, absolute path, standard output
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: userapisix-conf.yaml
1
2
3
4
5
6
7
8
9
10
11apisix:
admin_key:
- name: admin
key: edd1c9f034335f136f87ad84b625c8f1 # using fixed API token has security risk, please update it when you deploy to production environment
role: admin
allow_admin: # http://nginx.org/en/docs/http/ngx_http_access_module.html#allow
- 0.0.0.0/0
etcd:
host:
- http://etcd:2379