说明:
官网推荐: kong-dashboard,但对比界面高端程度和友好度,更推荐konga.
[一个坑]kong版本问题:我在安装时目前kong最新版本已经到1.0.0, 对于konga和kong-dashboard还不支持,建议安装低版本0.15以下; 具体表现查询apis,旧版本:[ip]:8001/apis,新版:[ip]:8001/services
npm安装方式
1. 安装依赖
sudo apt-getinstall nodejs npm
sudo npm install-g gulp
sudo npm install-g bower
sudo npm install-g sails
2. 安装
git clone https://github.com/pantsel/konga.git
cd konga
npm install konga
3. 配置数据库信息
目前支持数据库: mysql, mongo, sqlserver, postgres
cd config/cp local_example.js local.js
vi local.js
models: {
connection: process.env.DB_ADAPTER|| 'localDiskDb',
}
# 改成
models: {
connection: process.env.DB_ADAPTER|| 'mysql', //这里可以用‘mysql’,‘mongo’,‘sqlserver’,‘postgres’
}
# 修改数据库默认配置
vi konga/config/connections.js
mysql: {
adapter:'sails-mysql',
host: process.env.DB_HOST|| 'localhost',
port: process.env.DB_PORT|| 3306,
user: process.env.DB_USER|| 'root',
password: process.env.DB_PASSWORD|| null,
database: process.env.DB_DATABASE|| 'konga_database'}
# 改成
mysql: {
adapter:'sails-mysql',
host: process.env.DB_HOST|| 'localhost',
port: process.env.DB_PORT|| 3306,
user: process.env.DB_USER|| 'root',
password: process.env.DB_PASSWORD|| 'root',
database: process.env.DB_DATABASE|| 'konga_database'}
安装依赖
npm run bower-deps
npm install dotenv-extended
npm install angular
启动
#konga根目录
npm start
访问: http://127.0.0.1:1338