[TOC]
nodejs及go环境准备
安装nodejs
1 | wget https://nodejs.org/download/release/v14.21.3/node-v14.21.3-linux-x64.tar.gz |
注意nodejs版本不能过高,试过node18构建会报错,建议版本node14~node16
配置环境变量
1 | tee -a /etc/profile << EOF |
使环境变量生效1
source /etc/profile
安装yarn1
npm install -g yarn
安装go
https://mirrors.aliyun.com/golang/可以找需要的版本1
2wget https://mirrors.aliyun.com/golang/go1.20.3.linux-amd64.tar.gz
tar xzvf go1.20.3.linux-amd64.tar.gz -C /opt/
1 | tee -a /etc/profile << EOF |
使环境变量生效1
source /etc/profile
安装APISIX Dashboard
下载源码
1 | wget https://github.com/apache/apisix-dashboard/archive/refs/tags/v2.15.1.tar.gz |
解压源码
1 | tar xzvf v2.15.1.tar.gz |
构建
1 | make build |
构建完成会打印以下内容,估计要7分钟左右1
2
3
4
5
6
7其他省略...
The bundle size is significantly larger than recommended.
Consider reducing it with code splitting: https://umijs.org/docs/load-on-demand
You can also analyze the project dependencies using ANALYZE=1
Done in 433.32s.
编译完将output拷贝到/opt/apisix-dashboard1
mkdir -p mkdir -p /usr/local/apisix/dashboard && cp -r ./output/* /usr/local/apisix/dashboard
修改配置
如果是http访问etcd仅需配置ectd的访问地址即可
如果是https访问etcd则需要相关证书
将根证书,etcd-server-key证书,etcd-server证书拷贝到apisix目录下
1 | mkdir -p /usr/local/apisix/ssl |
修改vi /usr/local/apisix/dashboard/conf/conf.yaml
1 | # 其余省略... |
运行APISIX DASHBOARD
frontend方式运行apisix-dashboard(不推荐)1
2cd /usr/local/apisix/dashboard
./manager-api
安装为系统服务(推荐)1
2
3
4
5
6
7
8
9
10
11tee /usr/lib/systemd/system/apisix-dashboard.service << EOF
[Unit]
Description=apisix-dashboard
Conflicts=apisix-dashboard.service
After=network-online.target
[Service]
WorkingDirectory=/usr/local/apisix/dashboard
ExecStart=/usr/local/apisix/dashboard/manager-api -c /usr/local/apisix/dashboard/conf/conf.yaml
EOF
服务管理1
2
3
4
5
6
7
8
9
10
11
12
13
14 reload下
systemctl daemon-reload
enable apisix-dashboard
systemctl enable apisix-dashboard
start apisix-dashboard
systemctl start apisix-dashboard
stop apisix-dashboard
systemctl stop apisix-dashboard
check apisix-dashboard status
systemctl status apisix-dashboard
若出现以下错误,需要将您的机器IP加入白名单,修改conf.yaml将IP地址或IP网段加入到allow_list内即可1
2
3
4
5
6{
Code: 20002,
Message: "IP address not allowed",
Data: null,
SourceSrv: ""
}
修改vi /usr/local/apisix/dashboard/conf/conf.yaml,加入允许访问的网段即可1
2
3
4
5
6
7# 其余省略...
allow_list: # If we don't set any IP list, then any IP access is allowed by default.
- 127.0.0.1 # The rules are checked in sequence until the first match is found.
- 10.1.80.0/24 # The rules are checked in sequence until the first match is found.
- ::1 # In this example, access is allowed only for IPv4 network 127.0.0.1, and for IPv6 network ::1.
# It also support CIDR like 192.168.1.0/24 and 2001:0db8::/32
# 其余省略...