diff --git a/.gitignore b/.gitignore index 7f858cd..c26d36a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .DS_Store output dist +api-server diff --git a/conf/i18n/zh.toml b/conf/i18n/zh.toml index 56dc7a9..6efe992 100644 --- a/conf/i18n/zh.toml +++ b/conf/i18n/zh.toml @@ -12,7 +12,6 @@ Lang = "zh" "Authorizate Fail" = "鉴权失败" "Unknown Exception" = "未知异常" -"^Health Check Job$" = "健康检查任务" "^Product Not Exist$" = "产品线不存在" "^Not Cluste Existed$" = "暂无集群" "^Want Prefix (.+).$" = "期望前缀 %s." diff --git a/docs/zh_cn/deploy.md b/docs/zh_cn/deploy.md index 215c659..1c1edf1 100644 --- a/docs/zh_cn/deploy.md +++ b/docs/zh_cn/deploy.md @@ -38,6 +38,7 @@ BFE控制面包含如下组件: - 方式一:通过源码编译:clone本仓库后进入项目根目录,执行 `make`,output文件夹包括了可执行文件和初始配置文件 - 方式二:直接进入 [releases](https://github.com/bfenetworks/api-server/releases) 页面下载相应的编译产出 1. 修改初始配置文件,详见[配置文件说明](./config_param.md) +- 特别注意:绝大多数配置可以使用默认配置,最小修改集合为 **数据库用户名和密码** 1. 启动 API Server。执行`./api-server -c ./conf -sc api_server.toml -l ./log `。如果不需要指定启动参数,直接执行 `./api-server` 即可 ## Dashboard 部署 @@ -60,5 +61,5 @@ Conf Agent和 BFE 转发引擎同机部署。 1. 获取Conf Agent可执行程序 - 方式一:通过源码编译:clone [bfenetwork/conf-agent](https://github.com/bfenetworks/conf-agent) 仓库后进入项目根目录,执行 `make`, output文件夹包括了可执行文件和初始配置文件 - 方式二:直接进入 [release](https://github.com/bfenetworks/conf-agent/releases) 页面下载相应的编译产出 -1. 修改配置,详见 [配置文件说明](https://github.com/bfenetworks/conf-agent/docs/zh-cn/config.md),使其能访问API Server导出最新的配置 +1. 修改配置,详见 [配置文件说明](https://github.com/bfenetworks/conf-agent/blob/develop/docs/zh_cn/config.md),使其能访问API Server导出最新的配置 1. 启动 Conf Agent。执行 `./conf-agent` \ No newline at end of file diff --git a/model/icluster_conf/cluster.go b/model/icluster_conf/cluster.go index 0585ee1..261afaa 100644 --- a/model/icluster_conf/cluster.go +++ b/model/icluster_conf/cluster.go @@ -603,7 +603,7 @@ func NewBfeClusterConf(version string, clusters []*Cluster) *cluster_conf.BfeClu continue } - clusterConfMap["cluster_"+cluster.Name] = cluster_conf.ClusterConf{ + clusterConfMap[cluster.Name] = cluster_conf.ClusterConf{ BackendConf: &cluster_conf.BackendBasic{ Protocol: lib.PString("http"), TimeoutConnSrv: int322intp(cluster.Basic.Timeouts.TimeoutConnServ), diff --git a/model/iroute_conf/exporter.go b/model/iroute_conf/exporter.go index 41bc977..d3c0c71 100644 --- a/model/iroute_conf/exporter.go +++ b/model/iroute_conf/exporter.go @@ -116,21 +116,12 @@ func newRouteTableFile(version string, productMapID2Name map[int64]string, basicRule := route_rule_conf.ProductBasicRouteRuleFile{} advanceRule := route_rule_conf.ProductAdvancedRouteRuleFile{} - clusterName := func(cn string) *string { - if cn == icluster_conf.RouteAdvancedModeClusterName4DP { - return &cn - } - - tmp := "cluster_" + cn - return &tmp - } - newBasicRouteRuleFiles := func(brrs []*BasicRouteRule) (bs []route_rule_conf.BasicRouteRuleFile) { for _, brr := range brrs { bs = append(bs, route_rule_conf.BasicRouteRuleFile{ Hostname: brr.HostNames, Path: brr.Paths, - ClusterName: clusterName(brr.ClusterName), + ClusterName: &brr.ClusterName, }) } @@ -141,7 +132,7 @@ func newRouteTableFile(version string, productMapID2Name map[int64]string, for _, arr := range arrs { as = append(as, route_rule_conf.AdvancedRouteRuleFile{ Cond: &arr.Expression, - ClusterName: clusterName(arr.ClusterName), + ClusterName: &arr.ClusterName, }) } diff --git a/stateful/config_database.go b/stateful/config_database.go index 60ce2ef..63dce0e 100644 --- a/stateful/config_database.go +++ b/stateful/config_database.go @@ -41,6 +41,10 @@ func NewDB(dbConfig *DbConfig) (*sql.DB, error) { return nil, err } + if err := db.Ping(); err != nil { + return nil, err + } + db.SetMaxOpenConns(dbConfig.MaxOpenConns) db.SetMaxIdleConns(dbConfig.MaxIdleConns) db.SetConnMaxIdleTime(time.Duration(dbConfig.ConnMaxIdleTimeMs) * time.Millisecond)