KONGA配置

安装KONGA

安装nodejs和git,安装kong的文档中已经安装了,版本>=8,git运行

Centos安装git

yum install git -y
yum install -y git

 需要注意版本,git --version  ,    版本太低的话需要重新下载,否则git  clone时会报错

git解压编译安装

cd git-2.0.0
make configure
./configure --prefix=/usr/git ##配置目录
make profix=/usr/git
make install
加入环境变量
echo "export PATH=$PATH:/usr/git/bin" >> /etc/profile
source /etc/profile

检查版本

git --version 
git version 2.0.0

安装依赖  (这些依赖的包,安装在konga目录中,减少一些问题)

yum -y install nodejs npm
npm install -g gulp
npm install -g bower
npm install -g sails

安装konga

git clone https://github.com/pantsel/konga.git
cd konga
npm install konga
此时可能会报错

Cloning into 'konga'...
fatal: unable to access 'https://github.com/pantsel/konga.git/': SSL connect error

升级了git版本后git clone报SSL错误,执行 yum update -y nss curl libcurl

配置 

# 示例配置位置
/config/local_example.js
 
# 拷贝一份
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 connections.js
  postgres: {
    adapter: 'sails-postgresql',
    url: process.env.DB_URI,
    host: process.env.DB_HOST || 'localhost',
    user:  process.env.DB_USER || 'kong1',
    password: process.env.DB_PASSWORD || 'kong1',
    port: process.env.DB_PORT || 5432,
    database: process.env.DB_DATABASE ||'konga_database',
    // schema: process.env.DB_PG_SCHEMA ||'public',
    poolSize: process.env.DB_POOLSIZE || 10,
    ssl: process.env.DB_SSL ? true : false // If set, assume it's true
  },
# 保存
 
# 创建数据库
psql -U postgres -d postgres -h 127.0.0.1 -p 5432

# 新建 linux kong 用户
$ adduser kong

#建立新的数据库用户(和之前建立的系统用户要一样)
postgres=# create user kong with password 'kong';
#为新用户建立数据库
postgres=# create database konga_database owner kong;
#把新建的数据库权限赋予 kong
postgres=# grant all privileges on database konga_database to kong;
#退出控制台

启动 (启动的时候还是缺少一些模块,直接按照建议安装就可以了)

cd ../
npm start
 
error: Incompatible Node.js version. Please make sure that you have Node.js >= 8 installed.

node版本太低,换8以上。

启动后可能会报错,

No DB Adapter defined. Using localDB...
error: ** Grunt :: An error occurred. **
error: 
运行npm install sails-postgresql 报错,权限问题,

执行npm install --unsafe-perm=true --allow-root sails-postgresql

浏览

浏览器输入 localhost:1338,端口可以在local.js改
默认登录名admin,密码是三个admin
配置kong API地址要填写完整地址,后面不要带‘/’

1. Getting blank page with Uncaught ReferenceError: angular is not defined

In some cases when running npm install, the bower dependencies are not installed properly. You will need to cd into your project's root directory and install them manually by typing

$ npm run bower-deps  (界面空白的时候,需要执行这个)
2. Can't add/edit some plugin properties.

When a plugin property is an array, the input is handled by a chip component. You will need to press enter after every value you type in so that the component assigns it to an array index. See issue #48 for reference.

3. EACCES permission denied, mkdir '/kongadata/'.

If you see this error while trying to run Konga, it means that konga has no write permissions to it's default data dir /kongadata. You will just have to define the storage path yourself to a directory Konga will have access permissions via the env var STORAGE_PATH.

4. The hook grunt is taking too long to load

The default timeout for the sails hooks to load is 60000. In some cases, depending on the memory the host machine has available, startup tasks like code minification and uglyfication may take longer to complete. You can fix that by setting then env var KONGA_HOOK_TIMEOUT to something greater than 60000, like 120000.
 

你可能感兴趣的:(Kong)