未验证 提交 2e19c8cd 编写于 作者: E Eolink 提交者: GitHub

Merge pull request #32 from Dot-Liu/master

修改初始化sql
...@@ -5,13 +5,13 @@ PRAGMA foreign_keys = false; ...@@ -5,13 +5,13 @@ PRAGMA foreign_keys = false;
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS "goku_admin"; DROP TABLE IF EXISTS "goku_admin";
CREATE TABLE "goku_admin" ( CREATE TABLE "goku_admin" (
"userID" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "userID" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
"loginCall" text(255) NOT NULL, "loginCall" text(255) NOT NULL,
"loginPassword" text(255) NOT NULL, "loginPassword" text(255) NOT NULL,
"userType" integer(4) NOT NULL DEFAULT 0, "userType" integer(4) NOT NULL DEFAULT 0,
"groupID" integer(11) NOT NULL DEFAULT 0, "groupID" integer(11) NOT NULL DEFAULT 0,
"remark" text(255), "remark" text(255),
"permissions" text "permissions" text
); );
-- ---------------------------- -- ----------------------------
...@@ -19,18 +19,18 @@ CREATE TABLE "goku_admin" ( ...@@ -19,18 +19,18 @@ CREATE TABLE "goku_admin" (
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS "goku_balance"; DROP TABLE IF EXISTS "goku_balance";
CREATE TABLE "goku_balance" ( CREATE TABLE "goku_balance" (
"balanceID" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "balanceID" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
"balanceName" text(255) NOT NULL, "balanceName" text(255) NOT NULL,
"serviceName" text(255) NOT NULL, "serviceName" text(255) NOT NULL,
"balanceConfig" text, "balanceConfig" text,
"createTime" text, "createTime" text,
"updateTime" text, "updateTime" text,
"balanceDesc" text(255), "balanceDesc" text(255),
"defaultConfig" text NOT NULL, "defaultConfig" text NOT NULL,
"clusterConfig" text NOT NULL DEFAULT '', "clusterConfig" text NOT NULL DEFAULT '',
"appName" text(255) NOT NULL DEFAULT '', "appName" text(255) NOT NULL DEFAULT '',
"static" text, "static" text,
"staticCluster" text "staticCluster" text
); );
-- ---------------------------- -- ----------------------------
...@@ -38,12 +38,12 @@ CREATE TABLE "goku_balance" ( ...@@ -38,12 +38,12 @@ CREATE TABLE "goku_balance" (
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS "goku_cluster"; DROP TABLE IF EXISTS "goku_cluster";
CREATE TABLE "goku_cluster" ( CREATE TABLE "goku_cluster" (
"id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
"name" text(20) NOT NULL, "name" text(20) NOT NULL,
"title" text(50) NOT NULL, "title" text(50) NOT NULL,
"note" text(255), "note" text(255),
"db" text, "db" text,
"redis" text "redis" text
); );
-- ---------------------------- -- ----------------------------
...@@ -51,15 +51,15 @@ CREATE TABLE "goku_cluster" ( ...@@ -51,15 +51,15 @@ CREATE TABLE "goku_cluster" (
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS "goku_config_log"; DROP TABLE IF EXISTS "goku_config_log";
CREATE TABLE "goku_config_log" ( CREATE TABLE "goku_config_log" (
"id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
"name" text(20) NOT NULL, "name" text(20) NOT NULL,
"enable" integer(11) NOT NULL DEFAULT 1, "enable" integer(11) NOT NULL DEFAULT 1,
"dir" text(255) NOT NULL, "dir" text(255) NOT NULL,
"file" text(255) NOT NULL, "file" text(255) NOT NULL,
"period" text(10) NOT NULL, "period" text(10) NOT NULL,
"level" text(10) NOT NULL, "level" text(10) NOT NULL,
"fields" text NOT NULL, "fields" text NOT NULL,
"expire" integer(11) NOT NULL DEFAULT 3 "expire" integer(11) NOT NULL DEFAULT 3
); );
-- ---------------------------- -- ----------------------------
...@@ -67,17 +67,17 @@ CREATE TABLE "goku_config_log" ( ...@@ -67,17 +67,17 @@ CREATE TABLE "goku_config_log" (
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS "goku_conn_plugin_api"; DROP TABLE IF EXISTS "goku_conn_plugin_api";
CREATE TABLE "goku_conn_plugin_api" ( CREATE TABLE "goku_conn_plugin_api" (
"connID" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "connID" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
"apiID" integer(11) NOT NULL, "apiID" integer(11) NOT NULL,
"pluginName" text(255) NOT NULL, "pluginName" text(255) NOT NULL,
"pluginConfig" text, "pluginConfig" text,
"strategyID" text(255) NOT NULL, "strategyID" text(255) NOT NULL,
"pluginInfo" text, "pluginInfo" text,
"createTime" text, "createTime" text,
"updateTime" text, "updateTime" text,
"pluginStatus" integer(4), "pluginStatus" integer(4),
"updateTag" text(32), "updateTag" text(32),
"updaterID" integer(11) NOT NULL DEFAULT 0 "updaterID" integer(11) NOT NULL DEFAULT 0
); );
-- ---------------------------- -- ----------------------------
...@@ -85,16 +85,16 @@ CREATE TABLE "goku_conn_plugin_api" ( ...@@ -85,16 +85,16 @@ CREATE TABLE "goku_conn_plugin_api" (
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS "goku_conn_plugin_strategy"; DROP TABLE IF EXISTS "goku_conn_plugin_strategy";
CREATE TABLE "goku_conn_plugin_strategy" ( CREATE TABLE "goku_conn_plugin_strategy" (
"connID" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "connID" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
"strategyID" text(255) NOT NULL, "strategyID" text(255) NOT NULL,
"pluginName" text(255) NOT NULL, "pluginName" text(255) NOT NULL,
"pluginConfig" text, "pluginConfig" text,
"pluginInfo" text, "pluginInfo" text,
"createTime" text, "createTime" text,
"updateTime" text, "updateTime" text,
"pluginStatus" integer(4), "pluginStatus" integer(4),
"updateTag" text(32), "updateTag" text(32),
"updaterID" integer(11) NOT NULL DEFAULT 0 "updaterID" integer(11) NOT NULL DEFAULT 0
); );
-- ---------------------------- -- ----------------------------
...@@ -102,13 +102,13 @@ CREATE TABLE "goku_conn_plugin_strategy" ( ...@@ -102,13 +102,13 @@ CREATE TABLE "goku_conn_plugin_strategy" (
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS "goku_conn_strategy_api"; DROP TABLE IF EXISTS "goku_conn_strategy_api";
CREATE TABLE "goku_conn_strategy_api" ( CREATE TABLE "goku_conn_strategy_api" (
"connID" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "connID" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
"strategyID" text(255) NOT NULL, "strategyID" text(255) NOT NULL,
"apiID" integer(11) NOT NULL, "apiID" integer(11) NOT NULL,
"apiMonitorStatus" integer(11) NOT NULL DEFAULT 0, "apiMonitorStatus" integer(11) NOT NULL DEFAULT 0,
"strategyMonitorStatus" integer(11) NOT NULL DEFAULT 0, "strategyMonitorStatus" integer(11) NOT NULL DEFAULT 0,
"target" text(255), "target" text(255),
"updateTime" text "updateTime" text
); );
-- ---------------------------- -- ----------------------------
...@@ -116,26 +116,26 @@ CREATE TABLE "goku_conn_strategy_api" ( ...@@ -116,26 +116,26 @@ CREATE TABLE "goku_conn_strategy_api" (
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS "goku_gateway"; DROP TABLE IF EXISTS "goku_gateway";
CREATE TABLE "goku_gateway" ( CREATE TABLE "goku_gateway" (
"id" integer(11) NOT NULL, "id" integer(11) NOT NULL,
"successCode" text(255) NOT NULL, "successCode" text(255) NOT NULL,
"nodeUpdatePeriod" integer(11) NOT NULL, "nodeUpdatePeriod" integer(11) NOT NULL,
"monitorUpdatePeriod" integer(11) NOT NULL, "monitorUpdatePeriod" integer(11) NOT NULL,
"alertStatus" integer(4) NOT NULL, "alertStatus" integer(4) NOT NULL,
"alertPeriodType" integer(4) NOT NULL, "alertPeriodType" integer(4) NOT NULL,
"alertAddress" text(255), "alertAddress" text(255),
"alertLogPath" text(255), "alertLogPath" text(255),
"sender" text(255), "sender" text(255),
"senderPassword" text(255), "senderPassword" text(255),
"smtpAddress" text(255), "smtpAddress" text(255),
"smtpPort" integer(11) NOT NULL, "smtpPort" integer(11) NOT NULL,
"smtpProtocol" integer(4) NOT NULL, "smtpProtocol" integer(4) NOT NULL,
"receiverList" text(255), "receiverList" text(255),
"monitorTimeout" integer(4) NOT NULL, "monitorTimeout" integer(4) NOT NULL,
"apiAlertInfo" text, "apiAlertInfo" text,
"nodeAlertInfo" text, "nodeAlertInfo" text,
"redisAlertInfo" text, "redisAlertInfo" text,
"versionID" INTEGER NOT NULL DEFAULT 0, "versionID" INTEGER NOT NULL DEFAULT 0,
PRIMARY KEY ("id") PRIMARY KEY ("id")
); );
INSERT INTO "goku_gateway" VALUES (1, 200, 1, 30, 0, 0, NULL, NULL, NULL, NULL, NULL, 25, 0, NULL, 0, NULL, NULL, NULL, 0); INSERT INTO "goku_gateway" VALUES (1, 200, 1, 30, 0, 0, NULL, NULL, NULL, NULL, NULL, 25, 0, NULL, 0, NULL, NULL, NULL, 0);
...@@ -145,15 +145,15 @@ INSERT INTO "goku_gateway" VALUES (1, 200, 1, 30, 0, 0, NULL, NULL, NULL, NULL, ...@@ -145,15 +145,15 @@ INSERT INTO "goku_gateway" VALUES (1, 200, 1, 30, 0, 0, NULL, NULL, NULL, NULL,
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS "goku_gateway_alert"; DROP TABLE IF EXISTS "goku_gateway_alert";
CREATE TABLE "goku_gateway_alert" ( CREATE TABLE "goku_gateway_alert" (
"alertID" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "alertID" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
"requestURL" text(255) NOT NULL, "requestURL" text(255) NOT NULL,
"targetServer" text(255) NOT NULL, "targetServer" text(255) NOT NULL,
"alertPeriodType" integer(4) NOT NULL, "alertPeriodType" integer(4) NOT NULL,
"alertCount" integer(11) NOT NULL, "alertCount" integer(11) NOT NULL,
"updateTime" text, "updateTime" text,
"targetURL" text(255) NOT NULL, "targetURL" text(255) NOT NULL,
"clusterName" text(255), "clusterName" text(255),
"nodeIP" text(255) "nodeIP" text(255)
); );
-- ---------------------------- -- ----------------------------
...@@ -161,33 +161,33 @@ CREATE TABLE "goku_gateway_alert" ( ...@@ -161,33 +161,33 @@ CREATE TABLE "goku_gateway_alert" (
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS "goku_gateway_api"; DROP TABLE IF EXISTS "goku_gateway_api";
CREATE TABLE "goku_gateway_api" ( CREATE TABLE "goku_gateway_api" (
"apiID" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "apiID" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
"groupID" integer(11) NOT NULL, "groupID" integer(11) NOT NULL,
"projectID" integer(11) NOT NULL, "projectID" integer(11) NOT NULL,
"requestURL" text(255) NOT NULL, "requestURL" text(255) NOT NULL,
"apiName" text(255) NOT NULL, "apiName" text(255) NOT NULL,
"requestMethod" text(255) NOT NULL, "requestMethod" text(255) NOT NULL,
"targetServer" text(255), "targetServer" text(255),
"targetURL" text(255), "targetURL" text(255),
"targetMethod" text(255), "targetMethod" text(255),
"isFollow" text(32) NOT NULL, "isFollow" text(32) NOT NULL,
"stripPrefix" text(32), "stripPrefix" text(32),
"timeout" integer(11), "timeout" integer(11),
"retryCount" integer(11), "retryCount" integer(11),
"createTime" text, "createTime" text,
"updateTime" text, "updateTime" text,
"alertValve" integer(11) NOT NULL DEFAULT 0, "alertValve" integer(11) NOT NULL DEFAULT 0,
"monitorStatus" integer(11) NOT NULL DEFAULT 1, "monitorStatus" integer(11) NOT NULL DEFAULT 1,
"managerID" integer(11) NOT NULL, "managerID" integer(11) NOT NULL,
"lastUpdateUserID" integer(11) NOT NULL, "lastUpdateUserID" integer(11) NOT NULL,
"createUserID" integer(11) NOT NULL, "createUserID" integer(11) NOT NULL,
"balanceName" text(255), "balanceName" text(255),
"protocol" text(20), "protocol" text(20),
"stripSlash" text(32), "stripSlash" text(32),
"apiType" integer NOT NULL DEFAULT 0, "apiType" integer NOT NULL DEFAULT 0,
"responseDataType" text NOT NULL DEFAULT 'origin', "responseDataType" text NOT NULL DEFAULT origin,
"linkApis" TEXT, "linkApis" TEXT,
"staticResponse" TEXT "staticResponse" TEXT
); );
-- ---------------------------- -- ----------------------------
...@@ -195,12 +195,12 @@ CREATE TABLE "goku_gateway_api" ( ...@@ -195,12 +195,12 @@ CREATE TABLE "goku_gateway_api" (
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS "goku_gateway_api_group"; DROP TABLE IF EXISTS "goku_gateway_api_group";
CREATE TABLE "goku_gateway_api_group" ( CREATE TABLE "goku_gateway_api_group" (
"groupID" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "groupID" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
"projectID" integer(11) NOT NULL, "projectID" integer(11) NOT NULL,
"groupName" text(255) NOT NULL, "groupName" text(255) NOT NULL,
"groupPath" text(255), "groupPath" text(255),
"groupDepth" text(255), "groupDepth" text(255),
"parentGroupID" integer(11) NOT NULL DEFAULT 0 "parentGroupID" integer(11) NOT NULL DEFAULT 0
); );
-- ---------------------------- -- ----------------------------
...@@ -208,9 +208,9 @@ CREATE TABLE "goku_gateway_api_group" ( ...@@ -208,9 +208,9 @@ CREATE TABLE "goku_gateway_api_group" (
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS "goku_gateway_permission_group"; DROP TABLE IF EXISTS "goku_gateway_permission_group";
CREATE TABLE "goku_gateway_permission_group" ( CREATE TABLE "goku_gateway_permission_group" (
"groupID" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "groupID" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
"groupName" text(255) NOT NULL, "groupName" text(255) NOT NULL,
"permissions" text "permissions" text
); );
-- ---------------------------- -- ----------------------------
...@@ -218,10 +218,10 @@ CREATE TABLE "goku_gateway_permission_group" ( ...@@ -218,10 +218,10 @@ CREATE TABLE "goku_gateway_permission_group" (
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS "goku_gateway_project"; DROP TABLE IF EXISTS "goku_gateway_project";
CREATE TABLE "goku_gateway_project" ( CREATE TABLE "goku_gateway_project" (
"projectID" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "projectID" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
"projectName" text(255) NOT NULL, "projectName" text(255) NOT NULL,
"createTime" text, "createTime" text,
"updateTime" text "updateTime" text
); );
-- ---------------------------- -- ----------------------------
...@@ -229,16 +229,16 @@ CREATE TABLE "goku_gateway_project" ( ...@@ -229,16 +229,16 @@ CREATE TABLE "goku_gateway_project" (
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS "goku_gateway_strategy"; DROP TABLE IF EXISTS "goku_gateway_strategy";
CREATE TABLE "goku_gateway_strategy" ( CREATE TABLE "goku_gateway_strategy" (
"strategyID" text(32) NOT NULL, "strategyID" text(32) NOT NULL,
"strategyName" text(255) NOT NULL, "strategyName" text(255) NOT NULL,
"updateTime" text, "updateTime" text,
"createTime" text, "createTime" text,
"auth" text(255), "auth" text(255),
"groupID" integer(11) NOT NULL DEFAULT 0, "groupID" integer(11) NOT NULL DEFAULT 0,
"monitorStatus" integer(4) NOT NULL DEFAULT 0, "monitorStatus" integer(4) NOT NULL DEFAULT 0,
"enableStatus" integer(11) NOT NULL DEFAULT 0, "enableStatus" integer(11) NOT NULL DEFAULT 0,
"strategyType" integer(11) NOT NULL DEFAULT 0, "strategyType" integer(11) NOT NULL DEFAULT 0,
PRIMARY KEY ("strategyID") PRIMARY KEY ("strategyID")
); );
-- ---------------------------- -- ----------------------------
...@@ -251,9 +251,9 @@ INSERT INTO "goku_gateway_strategy" VALUES ('RGAtKBd', '开放策略', '2019-10- ...@@ -251,9 +251,9 @@ INSERT INTO "goku_gateway_strategy" VALUES ('RGAtKBd', '开放策略', '2019-10-
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS "goku_gateway_strategy_group"; DROP TABLE IF EXISTS "goku_gateway_strategy_group";
CREATE TABLE "goku_gateway_strategy_group" ( CREATE TABLE "goku_gateway_strategy_group" (
"groupID" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "groupID" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
"groupName" text(255) NOT NULL, "groupName" text(255) NOT NULL,
"groupType" integer(11) NOT NULL DEFAULT 0 "groupType" integer(11) NOT NULL DEFAULT 0
); );
-- ---------------------------- -- ----------------------------
...@@ -266,16 +266,16 @@ INSERT INTO "goku_gateway_strategy_group" VALUES (1, '开放分组', 1); ...@@ -266,16 +266,16 @@ INSERT INTO "goku_gateway_strategy_group" VALUES (1, '开放分组', 1);
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS "goku_gateway_version_config"; DROP TABLE IF EXISTS "goku_gateway_version_config";
CREATE TABLE "goku_gateway_version_config" ( CREATE TABLE "goku_gateway_version_config" (
"versionID" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "versionID" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
"name" TEXT NOT NULL, "name" TEXT NOT NULL,
"version" TEXT, "version" TEXT,
"remark" TEXT, "remark" TEXT,
"createTime" TEXT, "createTime" TEXT,
"updateTime" TEXT, "updateTime" TEXT,
"publishTime" TEXT, "publishTime" TEXT,
"config" TEXT, "config" TEXT,
"balanceConfig" TEXT, "balanceConfig" TEXT,
"discoverConfig" TEXT "discoverConfig" TEXT
); );
-- ---------------------------- -- ----------------------------
...@@ -283,23 +283,23 @@ CREATE TABLE "goku_gateway_version_config" ( ...@@ -283,23 +283,23 @@ CREATE TABLE "goku_gateway_version_config" (
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS "goku_monitor_cluster"; DROP TABLE IF EXISTS "goku_monitor_cluster";
CREATE TABLE "goku_monitor_cluster" ( CREATE TABLE "goku_monitor_cluster" (
"recordID" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "recordID" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
"strategyID" text(20) NOT NULL, "strategyID" text(20) NOT NULL,
"apiID" integer(11) NOT NULL, "apiID" integer(11) NOT NULL,
"clusterID" integer(11) NOT NULL, "clusterID" integer(11) NOT NULL,
"hour" integer(11) NOT NULL, "hour" integer(11) NOT NULL,
"gatewayRequestCount" integer(11) NOT NULL, "gatewayRequestCount" integer(11) NOT NULL,
"gatewaySuccessCount" integer(11) NOT NULL, "gatewaySuccessCount" integer(11) NOT NULL,
"gatewayStatus2xxCount" integer(11) NOT NULL, "gatewayStatus2xxCount" integer(11) NOT NULL,
"gatewayStatus4xxCount" integer(11) NOT NULL, "gatewayStatus4xxCount" integer(11) NOT NULL,
"gatewayStatus5xxCount" integer(11) NOT NULL, "gatewayStatus5xxCount" integer(11) NOT NULL,
"proxyRequestCount" integer(11) NOT NULL, "proxyRequestCount" integer(11) NOT NULL,
"proxySuccessCount" integer(11) NOT NULL, "proxySuccessCount" integer(11) NOT NULL,
"proxyStatus2xxCount" integer(11) NOT NULL, "proxyStatus2xxCount" integer(11) NOT NULL,
"proxyStatus4xxCount" integer(11) NOT NULL, "proxyStatus4xxCount" integer(11) NOT NULL,
"proxyStatus5xxCount" integer(11) NOT NULL, "proxyStatus5xxCount" integer(11) NOT NULL,
"proxyTimeoutCount" integer(11) NOT NULL, "proxyTimeoutCount" integer(11) NOT NULL,
"updateTime" text NOT NULL "updateTime" text NOT NULL
); );
-- ---------------------------- -- ----------------------------
...@@ -307,10 +307,10 @@ CREATE TABLE "goku_monitor_cluster" ( ...@@ -307,10 +307,10 @@ CREATE TABLE "goku_monitor_cluster" (
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS "goku_node_group"; DROP TABLE IF EXISTS "goku_node_group";
CREATE TABLE "goku_node_group" ( CREATE TABLE "goku_node_group" (
"groupID" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "groupID" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
"groupName" text(255) NOT NULL, "groupName" text(255) NOT NULL,
"groupType" integer(4) NOT NULL, "groupType" integer(4) NOT NULL,
"clusterID" integer(11) NOT NULL "clusterID" integer(11) NOT NULL
); );
-- ---------------------------- -- ----------------------------
...@@ -318,28 +318,23 @@ CREATE TABLE "goku_node_group" ( ...@@ -318,28 +318,23 @@ CREATE TABLE "goku_node_group" (
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS "goku_node_info"; DROP TABLE IF EXISTS "goku_node_info";
CREATE TABLE "goku_node_info" ( CREATE TABLE "goku_node_info" (
"nodeID" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "nodeID" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
"createTime" text, "nodeIP" text(255) NOT NULL,
"updateTime" text, "updateStatus" integer(4) NOT NULL DEFAULT 0,
"groupID" integer(11) NOT NULL DEFAULT 0, "createTime" text,
"nodeName" text(255) NOT NULL, "updateTime" text,
"nodeStatus" integer(11) NOT NULL, "groupID" integer(11) NOT NULL DEFAULT 0,
"version" text(255), "nodeName" text(255) NOT NULL,
"sshAddress" text(255) DEFAULT 22, "nodePort" text(255),
"sshUserName" text(255), "nodeStatus" integer(11) NOT NULL,
"sshPassword" text(255), "version" text(255),
"gatewayPath" text(255), "sshPort" text(255) DEFAULT 22,
"sshKey" text, "userName" text(255),
"authMethod" integer(4) NOT NULL DEFAULT 0, "password" text(255),
"clusterID" integer(11) NOT NULL DEFAULT 0, "gatewayPath" text(255),
"listenAddress" text(22) NOT NULL DEFAULT '', "key" text,
"adminAddress" text(22) NOT NULL DEFAULT '', "authMethod" integer(4) NOT NULL DEFAULT 0,
"nodeKey" TEXT(32) NOT NULL DEFAULT '' "clusterID" integer(11) NOT NULL DEFAULT 0
);
CREATE UNIQUE INDEX "nodeKey_new"
ON "goku_node_info_new" (
"nodeKey" ASC
); );
-- ---------------------------- -- ----------------------------
...@@ -347,19 +342,19 @@ ON "goku_node_info_new" ( ...@@ -347,19 +342,19 @@ ON "goku_node_info_new" (
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS "goku_plugin"; DROP TABLE IF EXISTS "goku_plugin";
CREATE TABLE "goku_plugin" ( CREATE TABLE "goku_plugin" (
"pluginID" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "pluginID" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
"pluginName" text(255) NOT NULL, "pluginName" text(255) NOT NULL,
"chineseName" text(255), "chineseName" text(255),
"pluginStatus" integer(4) NOT NULL, "pluginStatus" integer(4) NOT NULL,
"pluginPriority" integer(4) NOT NULL, "pluginPriority" integer(4) NOT NULL,
"pluginConfig" text, "pluginConfig" text,
"pluginInfo" text, "pluginInfo" text,
"isStop" integer(4) NOT NULL, "isStop" integer(4) NOT NULL,
"pluginType" integer(4) NOT NULL, "pluginType" integer(4) NOT NULL,
"official" text(255) NOT NULL, "official" text(255) NOT NULL,
"pluginDesc" text(255), "pluginDesc" text(255),
"version" text(255) NOT NULL, "version" text(255) NOT NULL,
"isCheck" integer(4) NOT NULL "isCheck" integer(4) NOT NULL
); );
...@@ -368,20 +363,20 @@ CREATE TABLE "goku_plugin" ( ...@@ -368,20 +363,20 @@ CREATE TABLE "goku_plugin" (
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS "goku_service_config"; DROP TABLE IF EXISTS "goku_service_config";
CREATE TABLE "goku_service_config" ( CREATE TABLE "goku_service_config" (
"id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
"name" text(255) NOT NULL, "name" text(255) NOT NULL,
"default" integer(4), "default" integer(4),
"driver" text(20) NOT NULL, "driver" text(20) NOT NULL,
"desc" text NOT NULL, "desc" text NOT NULL,
"config" text NOT NULL, "config" text NOT NULL,
"clusterConfig" text NOT NULL, "clusterConfig" text NOT NULL,
"healthCheck" integer(4) NOT NULL, "healthCheck" integer(4) NOT NULL,
"healthCheckPath" text(255) NOT NULL, "healthCheckPath" text(255) NOT NULL,
"healthCheckPeriod" integer(11) NOT NULL, "healthCheckPeriod" integer(11) NOT NULL,
"healthCheckCode" text(255) NOT NULL, "healthCheckCode" text(255) NOT NULL,
"healthCheckTimeOut" integer(11) NOT NULL, "healthCheckTimeOut" integer(11) NOT NULL,
"createTime" text NOT NULL, "createTime" text NOT NULL,
"updateTime" text NOT NULL "updateTime" text NOT NULL
); );
-- ---------------------------- -- ----------------------------
...@@ -389,14 +384,14 @@ CREATE TABLE "goku_service_config" ( ...@@ -389,14 +384,14 @@ CREATE TABLE "goku_service_config" (
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS "goku_service_discovery"; DROP TABLE IF EXISTS "goku_service_discovery";
CREATE TABLE "goku_service_discovery" ( CREATE TABLE "goku_service_discovery" (
"id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
"name" text(30), "name" text(30),
"type" text(20), "type" text(20),
"remark" text(500), "remark" text(500),
"config" text, "config" text,
"default" text(255), "default" text(255),
"createTime" text, "createTime" text,
"updateTime" text "updateTime" text
); );
-- ---------------------------- -- ----------------------------
...@@ -404,35 +399,9 @@ CREATE TABLE "goku_service_discovery" ( ...@@ -404,35 +399,9 @@ CREATE TABLE "goku_service_discovery" (
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS "goku_table_update_record"; DROP TABLE IF EXISTS "goku_table_update_record";
CREATE TABLE "goku_table_update_record" ( CREATE TABLE "goku_table_update_record" (
"name" text(64) NOT NULL, "name" text(64) NOT NULL,
"updateTime" text NOT NULL, "updateTime" text NOT NULL,
"tableID" integer NOT NULL PRIMARY KEY AUTOINCREMENT "tableID" integer NOT NULL PRIMARY KEY AUTOINCREMENT
);
CREATE TABLE "goku_table_version" (
"tableID" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"tableName" TEXT NOT NULL,
"version" TEXT NOT NULL
);
CREATE UNIQUE INDEX "tableName"
ON "goku_table_version" (
"tableName"
);
INSERT INTO "goku_table_version" ("tableName","version") VALUES ('goku_node_info', "3.1.1");
INSERT INTO "goku_table_version" ("tableName","version") VALUES ('goku_monitor_module', "3.1.1");
CREATE TABLE "goku_monitor_module" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"name" TEXT NOT NULL,
"config" TEXT NOT NULL,
"moduleStatus" integer NOT NULL DEFAULT 0
);
CREATE UNIQUE INDEX "moduleName"
ON "goku_monitor_module" (
"name" ASC
); );
...@@ -458,17 +427,17 @@ UPDATE "sqlite_sequence" SET seq = 1 WHERE name = 'goku_admin'; ...@@ -458,17 +427,17 @@ UPDATE "sqlite_sequence" SET seq = 1 WHERE name = 'goku_admin';
-- Indexes structure for table goku_balance -- Indexes structure for table goku_balance
-- ---------------------------- -- ----------------------------
CREATE INDEX "balanceName" CREATE INDEX "balanceName"
ON "goku_balance" ( ON "goku_balance" (
"balanceName" ASC "balanceName" ASC
); );
-- ---------------------------- -- ----------------------------
-- Indexes structure for table goku_cluster -- Indexes structure for table goku_cluster
-- ---------------------------- -- ----------------------------
CREATE INDEX "name" CREATE INDEX "name"
ON "goku_cluster" ( ON "goku_cluster" (
"name" ASC "name" ASC
); );
-- ---------------------------- -- ----------------------------
-- Auto increment value for goku_config_log -- Auto increment value for goku_config_log
......
...@@ -3,12 +3,14 @@ package application ...@@ -3,12 +3,14 @@ package application
import ( import (
"bytes" "bytes"
"errors" "errors"
"github.com/eolinker/goku-api-gateway/diting"
goku_labels "github.com/eolinker/goku-api-gateway/goku-labels"
"github.com/eolinker/goku-api-gateway/node/monitor"
"io" "io"
"net/http" "net/http"
"net/url" "net/url"
"github.com/eolinker/goku-api-gateway/diting"
goku_labels "github.com/eolinker/goku-api-gateway/goku-labels"
"github.com/eolinker/goku-api-gateway/node/monitor"
// "fmt" // "fmt"
"time" "time"
) )
...@@ -99,16 +101,16 @@ func (r *Request) Send() (*http.Response, error) { ...@@ -99,16 +101,16 @@ func (r *Request) Send() (*http.Response, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
start:=time.Now() start := time.Now()
defer func() { defer func() {
delay:= time.Since(start) delay := time.Since(start)
labels:= make(diting.Labels) labels := make(diting.Labels)
labels[goku_labels.Proto] = req.Proto labels[goku_labels.Proto] = req.Proto
labels[goku_labels.Host] = req.Host labels[goku_labels.Host] = req.Host
labels[goku_labels.Path] = req.URL.Path labels[goku_labels.Path] = req.URL.Path
labels[goku_labels.Method] = req.Method labels[goku_labels.Method] = req.Method
monitor.ProxyMonitor.Observe(float64( delay.Milliseconds()),labels) monitor.ProxyMonitor.Observe(float64(delay/time.Millisecond), labels)
}() }()
req.Header.Set("Accept-Encoding", "gzip") req.Header.Set("Accept-Encoding", "gzip")
req.Header = parseHeaders(r.headers) req.Header = parseHeaders(r.headers)
......
...@@ -2,13 +2,14 @@ package gateway ...@@ -2,13 +2,14 @@ package gateway
import ( import (
"fmt" "fmt"
"github.com/eolinker/goku-api-gateway/diting"
goku_labels "github.com/eolinker/goku-api-gateway/goku-labels"
"github.com/eolinker/goku-api-gateway/node/monitor"
"net/http" "net/http"
"strconv" "strconv"
"time" "time"
"github.com/eolinker/goku-api-gateway/diting"
goku_labels "github.com/eolinker/goku-api-gateway/goku-labels"
"github.com/eolinker/goku-api-gateway/node/monitor"
log "github.com/eolinker/goku-api-gateway/goku-log" log "github.com/eolinker/goku-api-gateway/goku-log"
access_log "github.com/eolinker/goku-api-gateway/goku-node/access-log" access_log "github.com/eolinker/goku-api-gateway/goku-node/access-log"
"github.com/eolinker/goku-api-gateway/goku-node/common" "github.com/eolinker/goku-api-gateway/goku-node/common"
...@@ -53,7 +54,7 @@ func (h *HTTPHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) { ...@@ -53,7 +54,7 @@ func (h *HTTPHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
n, status := ctx.Finish() n, status := ctx.Finish()
delay:= time.Since(timeStart) delay := time.Since(timeStart)
ctx.LogFields[fields.RequestID] = requestID ctx.LogFields[fields.RequestID] = requestID
ctx.LogFields[fields.StatusCode] = status ctx.LogFields[fields.StatusCode] = status
...@@ -66,15 +67,12 @@ func (h *HTTPHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) { ...@@ -66,15 +67,12 @@ func (h *HTTPHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
access_log.Log(ctx.LogFields) access_log.Log(ctx.LogFields)
log.WithFields(ctx.LogFields).Info() log.WithFields(ctx.LogFields).Info()
// 监控计数 // 监控计数
labels:= make(diting.Labels) labels := make(diting.Labels)
labels[goku_labels.API] = strconv.Itoa(ctx.ApiID()) labels[goku_labels.API] = strconv.Itoa(ctx.ApiID())
labels[goku_labels.Strategy] = ctx.StrategyId() labels[goku_labels.Strategy] = ctx.StrategyId()
labels[goku_labels.Status] = strconv.Itoa(status) labels[goku_labels.Status] = strconv.Itoa(status)
monitor.APIMonitor.Observe( float64( delay.Milliseconds()),labels) monitor.APIMonitor.Observe(float64(delay/time.Millisecond), labels)
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册