栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Go语言

APISIX Dashboard 源码构建

Go语言 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

APISIX Dashboard 源码构建

APISIX Dashboard 源码构建

注:此文档构建环境为腾讯云CentOS 7.9,虚拟机同样适用。

Source

The Dashboard project contains both manager-api and web, but web is optional.

The manager-api and web will be included in this build guide product.

Prerequisites

Before using source codes to build, make sure that the following dependencies are installed in your environment.

For manager-api:

  1. Golang 1.13+
cd /usr/local && wget https://dl.google.com/go/go1.13.linux-amd64.tar.gz
tar -zxvf go1.13.linux-amd64.tar.gz && rm -f go1.13.linux-amd64.tar.gz
# 添加环境变量
sudo vim /etc/profile
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin
source /etc/profile
#查看Go版本
go version

Tip: For users in mainland China, you can use the following command to speed up the module downloads.

go env -w GOPROXY=https://goproxy.cn,direct

For web:

  1. Node.js current LTS (14.x+)
# 用命令行形式进行下载
cd /usr/local && wget https://nodejs.org/dist/v14.15.4/node-v14.15.4-linux-x64.tar.xz
# 解压缩
tar -xvf node-v14.15.4-linux-x64.tar.xz && rm -f node-v14.15.4-linux-x64.tar.xz
mkdir -p nodejs
mv node-v14.15.4-linux-x64/* /usr/local/nodejs/
# 建立 node&npm 软链接
ln -s /usr/local/nodejs/bin/node /usr/local/bin
ln -s /usr/local/nodejs/bin/npm /usr/local/bin
# 设置国内淘宝镜像源
npm config set registry https://registry.npm.taobao.org
# 查看设置信息
npm config list
# 验证
node -v
npm -v
  1. Yarn
# 设置Yarn仓库
curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
sudo yum install -y yarn
# 设置国内镜像加速
yarn config set registry https://registry.npm.taobao.org
yarn --version
Download
# 如果克隆的太慢,可以直接去官网下载zip包
cd /usr/local && git clone -b release/2.10 https://github.com/apache/apisix-dashboard.git
Build
cd apisix-dashboard
make build

When the build is complete, the results are stored in the root output directory.

Note: make build will build manager-api and web, use the make help command to see more commands.

Launch
  1. After the build is complete and before you start, make sure the following dependencies are installed and running in your environment.
  • etcd 3.4.0+
  1. Check and modify the configuration information in output/conf/conf.yaml according to your deployment environment.
  2. Launch the Dashboard
cd ./output
./manager-api
  1. Without changing the configuration, visit http://127.0.0.1:9000 to use the dashboard with GUI, where the default username and password are admin.
Service

使用源代码编译方法进行部署时,需要处理自己的服务管理。我们为使用 Systemd 服务管理器的操作系统提供服务文件模板。

  1. 安装
cp -rf /usr/local/apisix-dashboard/output/* /usr/local/apisix-dashboard
  1. 创建服务单元

复制以下或者直接使用这个文件,需要复制到/usr/lib/systemd/system目录下执行systemctl daemon-reload命令。

# copy service unit
cp ./api/service/apisix-dashboard.service /usr/lib/systemd/system/apisix-dashboard.service
systemctl daemon-reload

# or: If you need to modify the service unit, you can use the following command
echo "[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" > /usr/lib/systemd/system/apisix-dashboard.service
  1. 管理服务

您可以使用以下命令来管理服务。

# start apisix-dashboard
systemctl start apisix-dashboard
# stop apisix-dashboard
systemctl stop apisix-dashboard
# check apisix-dashboard status
systemctl status apisix-dashboard
Test

浏览器输入:http://:9000,访问Web页面,如果报错:

{"Code":20002,"Message":"IP address not allowed","Data":null,"SourceSrv":""}

默认情况下,127.0.0.0/24允许访问的 IPv4 范围APISIX Dashboard。如果要允许所有IPv4访问,那么只需conf.allow_list在配置文件中conf/conf.yaml进行如下配置:

vim /usr/local/apisix-dashboard/conf/conf.yaml
conf:
  allow_list:
    - 0.0.0.0/0
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/990273.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号