美文网首页
KONGA UI部署

KONGA UI部署

作者: Busyasabee | 来源:发表于2020-01-22 15:24 被阅读0次

konga 提供了对Kong的界面操作, 需要部署npm, mysql

Mysql57

wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

  • rpm -ivh mysql57-community-release-el7-11.noarch.rpm
  • yum install mysql-community-server

启动

  • systemctl start mysqld
  • systemctl enable mysqld

设置root密码

  • grep 'password' /var/log/mysqld.log #初始密码在 temporary password
  • mysql -uroot -p
  • mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'xxx';

NodeJs 10

curl -sL https://rpm.nodesource.com/setup_10.x | bash -

## Run `sudo yum install -y nodejs` to install Node.js 10.x and npm.
## You may also need development tools to build native addons:
     sudo yum install gcc-c++ make
## To install the Yarn package manager, run:
     curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
     sudo yum install yarn
  • sudo yum clean all && sudo yum makecache fast
  • yum install -y gcc-c++ make nodejs

npm 淘宝源

配置后可通过下面方式来验证是否成功

[root@10-225-255-115 ~]# node -v
v10.18.1
[root@10-225-255-115 ~]# npm config set registry https://registry.npm.taobao.org
[root@10-225-255-115 ~]# npm config get registry
https://registry.npm.taobao.org/

konga 安装

mysql> CREATE DATABASE konga DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on konga.* to 'konga'@'%' identified by 'xxx';
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> grant all privileges on konga.* to 'konga'@'127.0.0.1' identified by 'xxx';
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> grant all privileges on konga.* to 'konga'@'localhost' identified by 'xxx';
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

konga 初始化

  • mkdir /opt/webroot
  • cd /opt/webroot
  • npm install -g gulp
  • npm install -g bower
  • npm install -g sails

下载源码, --depth=1 表示权下载最新版本的源码,可以加速下载

安装npm 依赖

  • cd konga
  • npm install konga

修改配置 ,可跳过此配置

  • cp .env_example .env
# 可跳过
PORT=8080
NODE_ENV=production
KONGA_HOOK_TIMEOUT=120000
DB_ADAPTER=mysql
DB_URI=mysql://127.0.0.1:3306/konga
DB_USER=konga
DB_PASSWROD=xxx
KONGA_LOG_LEVEL=warn
TOKEN_SECRET=some_secret_token
  • cd config && cp local_example.js local.js
# 改成
models: {
    connection: process.env.DB_ADAPTER || 'mysql', // 这里可以用‘mysql’,‘mongo’,‘sqlserver’,‘postgres’
},
  • vim connections.js
# 修改数据库默认配置
  mysql: {
    adapter: 'sails-mysql',
    host: process.env.DB_HOST || 'localhost',
    port: process.env.DB_PORT || 3306,
    user: process.env.DB_USER || 'konga',
    password: process.env.DB_PASSWORD || 'xxx',
    database: process.env.DB_DATABASE || 'konga'
  },

可以跳过此配置 初始化数据库

#可跳过
node ./bin/konga.js  prepare --adapter mysql --uri mysql://10.225.255.115:3306/konga
Preparing database...
(node:3854) [DEP0095] DeprecationWarning: timers.enroll() is deprecated. Please use setTimeout instead.
(node:3854) [DEP0096] DeprecationWarning: timers.unenroll() is deprecated. Please use clearTimeout instead.
debug: Hook:api_health_checks:process() called
debug: Hook:health_checks:process() called
debug: Hook:start-scheduled-snapshots:process() called
debug: Hook:upstream_health_checks:process() called
debug: Hook:user_events_hook:process() called
debug: Seeding User...
debug: User seed planted
debug: Seeding Kongnode...
debug: Kongnode seed planted
debug: Seeding Emailtransport...
debug: Emailtransport seed planted
debug: Database migrations completed!

启动

[root@10-225-255-115 konga]# npm start 

> kongadmin@0.14.7 start /opt/webroot/konga
> node --harmony app.js

Hook:api_health_checks:process() called
Hook:health_checks:process() called
Hook:start-scheduled-snapshots:process() called
Hook:upstream_health_checks:process() called
Hook:user_events_hook:process() called
(node:4041) [DEP0095] DeprecationWarning: timers.enroll() is deprecated. Please use setTimeout instead.
(node:4041) [DEP0096] DeprecationWarning: timers.unenroll() is deprecated. Please use clearTimeout instead.
Seeding User...
User seed planted
Seeding Kongnode...
Kongnode seed planted
Emailtransport seeds updated

               .-..-.

   Sails              <|    .-..-.
   v0.12.14            |\
                      /|.\
                     / || \
                   ,'  |'  \
                .-'.-==|/_--'
                `--'-------' 
   __---___--___---___--___---___--___
 ____---___--___---___--___---___--___-__

Server lifted in `/opt/webroot/konga`
To see your app, visit http://0.0.0.0:8080
To shut down Sails, press <CTRL> + C at any time.

-------------------------------------------------------
:: Mon Jan 20 2020 18:29:46 GMT+0800 (China Standard Time)

Environment : production
Host        : 0.0.0.0
Port        : 8080
-------------------------------------------------------

第一次访问主机的1338端口, 就可以看到注册画面。这里注册的是 konga的管理员账号。


image.png

登录成功后,需要配置一下kong的管理接口,选择的8001地址即可

相关文章

网友评论

      本文标题:KONGA UI部署

      本文链接:https://www.haomeiwen.com/subject/crauzctx.html