change api prefix
This commit is contained in:
commit
e6c8216d7b
|
@ -36,10 +36,10 @@ pipeline {
|
||||||
sh label: 'package-linux-arm64', script: 'cd /home/jenkins/go/src/infini.sh/search-center/bin && tar cfz ${WORKSPACE}/console-$VERSION-$BUILD_NUMBER-linux-arm64.tar.gz console-linux-arm64 console.yml '
|
sh label: 'package-linux-arm64', script: 'cd /home/jenkins/go/src/infini.sh/search-center/bin && tar cfz ${WORKSPACE}/console-$VERSION-$BUILD_NUMBER-linux-arm64.tar.gz console-linux-arm64 console.yml '
|
||||||
|
|
||||||
sh label: 'package-mac-amd64', script: 'cd /home/jenkins/go/src/infini.sh/search-center/bin && zip -r ${WORKSPACE}/console-$VERSION-$BUILD_NUMBER-mac-amd64.zip console-mac-amd64 console.yml '
|
sh label: 'package-mac-amd64', script: 'cd /home/jenkins/go/src/infini.sh/search-center/bin && zip -r ${WORKSPACE}/console-$VERSION-$BUILD_NUMBER-mac-amd64.zip console-mac-amd64 console.yml '
|
||||||
sh label: 'package-mac-arm64', script: 'cd /home/jenkins/go/src/infini.sh/search-center/bin && zip -r ${WORKSPACE}/console-$VERSION-$BUILD_NUMBER-mac-arm64.zip console-mac-arm64 console.yml '
|
// sh label: 'package-mac-arm64', script: 'cd /home/jenkins/go/src/infini.sh/search-center/bin && zip -r ${WORKSPACE}/console-$VERSION-$BUILD_NUMBER-mac-arm64.zip console-mac-arm64 console.yml '
|
||||||
sh label: 'package-win-amd64', script: 'cd /home/jenkins/go/src/infini.sh/search-center/bin && zip -r ${WORKSPACE}/console-$VERSION-$BUILD_NUMBER-windows-amd64.zip console-windows-amd64 console.yml '
|
sh label: 'package-win-amd64', script: 'cd /home/jenkins/go/src/infini.sh/search-center/bin && zip -r ${WORKSPACE}/console-$VERSION-$BUILD_NUMBER-windows-amd64.zip console-windows-amd64.exe console.yml '
|
||||||
sh label: 'package-win-386', script: 'cd /home/jenkins/go/src/infini.sh/search-center/bin && zip -r ${WORKSPACE}/console-$VERSION-$BUILD_NUMBER-windows-386.zip console-windows-386 console.yml '
|
sh label: 'package-win-386', script: 'cd /home/jenkins/go/src/infini.sh/search-center/bin && zip -r ${WORKSPACE}/console-$VERSION-$BUILD_NUMBER-windows-386.zip console-windows-386.exe console.yml '
|
||||||
archiveArtifacts artifacts: 'console-$VERSION-$BUILD_NUMBER-*.tar.gz', fingerprint: true, followSymlinks: true, onlyIfSuccessful: false
|
archiveArtifacts artifacts: 'console-$VERSION-$BUILD_NUMBER-*.*', fingerprint: true, followSymlinks: true, onlyIfSuccessful: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -125,7 +125,7 @@ build-arm: config
|
||||||
build-darwin: config
|
build-darwin: config
|
||||||
GOOS=darwin GOARCH=amd64 $(GOBUILD) -o $(OUTPUT_DIR)/$(APP_NAME)-mac-amd64
|
GOOS=darwin GOARCH=amd64 $(GOBUILD) -o $(OUTPUT_DIR)/$(APP_NAME)-mac-amd64
|
||||||
# GOOS=darwin GOARCH=386 $(GOBUILD) -o $(OUTPUT_DIR)/$(APP_NAME)-mac-386
|
# GOOS=darwin GOARCH=386 $(GOBUILD) -o $(OUTPUT_DIR)/$(APP_NAME)-mac-386
|
||||||
GOOS=darwin GOARCH=arm64 $(GOBUILD) -o $(OUTPUT_DIR)/$(APP_NAME)-mac-arm64
|
# GOOS=darwin GOARCH=arm64 $(GOBUILD) -o $(OUTPUT_DIR)/$(APP_NAME)-mac-arm64
|
||||||
@$(MAKE) restore-generated-file
|
@$(MAKE) restore-generated-file
|
||||||
|
|
||||||
build-bsd: config
|
build-bsd: config
|
||||||
|
|
21
console.yml
21
console.yml
|
@ -1,33 +1,25 @@
|
||||||
#配置应用存储数据的 Elasticsearch 集群信息
|
#存储极限数据平台相关数据的 Elasticsearch 集群信息,版本 v7.0+
|
||||||
elasticsearch:
|
elasticsearch:
|
||||||
- name: default
|
- name: default
|
||||||
enabled: true
|
enabled: true
|
||||||
monitored: true
|
monitored: true
|
||||||
endpoint: http://localhost:9200
|
endpoint: http://192.168.3.188:9299
|
||||||
basic_auth:
|
basic_auth:
|
||||||
username: elastic
|
username: elastic
|
||||||
password: ZBdkVQUUdF1Sir4X4BGB
|
password: ZBdkVQUUdF1Sir4X4BGB
|
||||||
|
|
||||||
#前端 UI HTTP 配置
|
#前端 UI HTTP 配置
|
||||||
web:
|
web:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
embedding_api: true
|
||||||
ui:
|
ui:
|
||||||
enabled: true
|
enabled: true
|
||||||
path: .public
|
path: .public
|
||||||
vfs: true
|
vfs: true
|
||||||
local: true
|
local: true
|
||||||
#api_endpoint: 10.0.2.5:9000 #配置 api_endpoint 可覆盖默认 api 访问地址
|
|
||||||
network:
|
network:
|
||||||
binding: 0.0.0.0:9000
|
binding: 0.0.0.0:9000
|
||||||
skip_occupied_port: true
|
skip_occupied_port: true
|
||||||
#API IP 地址需要在前端可连通(虚拟机环境安装,宿主机访问)
|
|
||||||
api:
|
|
||||||
enabled: true
|
|
||||||
network:
|
|
||||||
binding: 0.0.0.0:2900
|
|
||||||
skip_occupied_port: true
|
|
||||||
cors:
|
|
||||||
allowed_origins:
|
|
||||||
- "*"
|
|
||||||
|
|
||||||
elastic:
|
elastic:
|
||||||
elasticsearch: default
|
elasticsearch: default
|
||||||
|
@ -41,11 +33,6 @@ elastic:
|
||||||
template_name: ".infini"
|
template_name: ".infini"
|
||||||
index_prefix: ".infini_"
|
index_prefix: ".infini_"
|
||||||
|
|
||||||
search-center:
|
|
||||||
ui_path: .public
|
|
||||||
ui_vfs: true
|
|
||||||
ui_local: true
|
|
||||||
|
|
||||||
metrics:
|
metrics:
|
||||||
enabled: true
|
enabled: true
|
||||||
major_ip_pattern: "192.*"
|
major_ip_pattern: "192.*"
|
||||||
|
|
19
main.go
19
main.go
|
@ -9,8 +9,14 @@ import (
|
||||||
"infini.sh/framework/core/module"
|
"infini.sh/framework/core/module"
|
||||||
"infini.sh/framework/core/orm"
|
"infini.sh/framework/core/orm"
|
||||||
pipe "infini.sh/framework/core/pipeline"
|
pipe "infini.sh/framework/core/pipeline"
|
||||||
"infini.sh/framework/modules"
|
elastic2 "infini.sh/framework/modules/elastic"
|
||||||
|
"infini.sh/framework/modules/filter"
|
||||||
"infini.sh/framework/modules/metrics"
|
"infini.sh/framework/modules/metrics"
|
||||||
|
"infini.sh/framework/modules/pipeline"
|
||||||
|
"infini.sh/framework/modules/queue"
|
||||||
|
"infini.sh/framework/modules/stats"
|
||||||
|
"infini.sh/framework/modules/task"
|
||||||
|
"infini.sh/framework/modules/ui"
|
||||||
"infini.sh/framework/plugins/elastic/json_indexing"
|
"infini.sh/framework/plugins/elastic/json_indexing"
|
||||||
"infini.sh/search-center/config"
|
"infini.sh/search-center/config"
|
||||||
"infini.sh/search-center/model"
|
"infini.sh/search-center/model"
|
||||||
|
@ -40,7 +46,16 @@ func main() {
|
||||||
if app.Setup(func() {
|
if app.Setup(func() {
|
||||||
|
|
||||||
//load core modules first
|
//load core modules first
|
||||||
modules.Register()
|
module.RegisterSystemModule(elastic2.ElasticModule{})
|
||||||
|
module.RegisterSystemModule(filter.FilterModule{})
|
||||||
|
module.RegisterSystemModule(&stats.SimpleStatsModule{})
|
||||||
|
module.RegisterSystemModule(&queue.DiskQueue{})
|
||||||
|
module.RegisterSystemModule(&queue.RedisModule{})
|
||||||
|
module.RegisterSystemModule(&queue.QueueModule{})
|
||||||
|
module.RegisterSystemModule(&ui.UIModule{})
|
||||||
|
module.RegisterSystemModule(&pipeline.PipeModule{})
|
||||||
|
module.RegisterSystemModule(&task.TaskModule{})
|
||||||
|
|
||||||
pipe.RegisterProcessorPlugin("json_indexing", json_indexing.New)
|
pipe.RegisterProcessorPlugin("json_indexing", json_indexing.New)
|
||||||
module.RegisterUserPlugin(&metrics.MetricsModule{})
|
module.RegisterUserPlugin(&metrics.MetricsModule{})
|
||||||
|
|
||||||
|
|
38
ui.go
38
ui.go
|
@ -2,16 +2,11 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"infini.sh/framework/core/global"
|
|
||||||
"net/http"
|
|
||||||
"src/github.com/segmentio/encoding/json"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
public "infini.sh/search-center/.public"
|
public "infini.sh/search-center/.public"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
log "github.com/cihub/seelog"
|
log "github.com/cihub/seelog"
|
||||||
"infini.sh/framework/core/api"
|
"infini.sh/framework/core/api"
|
||||||
"infini.sh/framework/core/ui"
|
|
||||||
"infini.sh/framework/core/util"
|
"infini.sh/framework/core/util"
|
||||||
"infini.sh/framework/core/vfs"
|
"infini.sh/framework/core/vfs"
|
||||||
uiapi "infini.sh/search-center/api"
|
uiapi "infini.sh/search-center/api"
|
||||||
|
@ -27,26 +22,25 @@ func (h UI) InitUI() {
|
||||||
|
|
||||||
vfs.RegisterFS(public.StaticFS{StaticFolder: h.Config.UI.LocalPath, TrimLeftPath: h.Config.UI.LocalPath, CheckLocalFirst: h.Config.UI.LocalEnabled, SkipVFS: !h.Config.UI.VFSEnabled})
|
vfs.RegisterFS(public.StaticFS{StaticFolder: h.Config.UI.LocalPath, TrimLeftPath: h.Config.UI.LocalPath, CheckLocalFirst: h.Config.UI.LocalEnabled, SkipVFS: !h.Config.UI.VFSEnabled})
|
||||||
|
|
||||||
ui.HandleUI("/", vfs.FileServer(vfs.VFS()))
|
api.HandleUI("/", vfs.FileServer(vfs.VFS()))
|
||||||
|
|
||||||
uiapi.Init(h.Config)
|
uiapi.Init(h.Config)
|
||||||
|
|
||||||
var apiEndpoint = h.Config.UI.APIEndpoint
|
//var apiEndpoint = h.Config.UI.APIEndpoint
|
||||||
apiConfig := &global.Env().SystemConfig.APIConfig
|
//apiConfig := &global.Env().SystemConfig.APIConfig
|
||||||
|
//
|
||||||
|
//api.HandleUIFunc("/config", func(w http.ResponseWriter, req *http.Request){
|
||||||
|
// if(strings.TrimSpace(apiEndpoint) == ""){
|
||||||
|
// hostParts := strings.Split(req.Host, ":")
|
||||||
|
// apiEndpoint = fmt.Sprintf("%s//%s:%s", apiConfig.GetSchema(), hostParts[0], apiConfig.NetworkConfig.GetBindingPort())
|
||||||
|
// }
|
||||||
|
// buf, _ := json.Marshal(util.MapStr{
|
||||||
|
// "api_endpoint": apiEndpoint,
|
||||||
|
// })
|
||||||
|
// w.Write(buf)
|
||||||
|
//})
|
||||||
|
|
||||||
ui.HandleUIFunc("/config", func(w http.ResponseWriter, req *http.Request){
|
api.HandleUIFunc("/api/", func(w http.ResponseWriter, req *http.Request) {
|
||||||
|
|
||||||
if(strings.TrimSpace(apiEndpoint) == ""){
|
|
||||||
hostParts := strings.Split(req.Host, ":")
|
|
||||||
apiEndpoint = fmt.Sprintf("%s//%s:%s", apiConfig.GetSchema(), hostParts[0], apiConfig.NetworkConfig.GetBindingPort())
|
|
||||||
}
|
|
||||||
buf, _ := json.Marshal(util.MapStr{
|
|
||||||
"api_endpoint": apiEndpoint,
|
|
||||||
})
|
|
||||||
w.Write(buf)
|
|
||||||
})
|
|
||||||
|
|
||||||
ui.HandleUIFunc("/api/", func(w http.ResponseWriter, req *http.Request) {
|
|
||||||
log.Warn("api: ", req.URL, " not implemented")
|
log.Warn("api: ", req.URL, " not implemented")
|
||||||
request, err := h.GetRawBody(req)
|
request, err := h.GetRawBody(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -41,7 +41,7 @@ export class InitialStep extends React.Component {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
type: "string",
|
type: "string",
|
||||||
pattern: /^[\w\.]+\:\d+$/, //(https?:\/\/)?
|
pattern: /^[\w\.\-_~%]+\:\d+$/, //(https?:\/\/)?
|
||||||
message: "请输入域名或 IP 地址和端口号",
|
message: "请输入域名或 IP 地址和端口号",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,33 +1,6 @@
|
||||||
import $ from "jquery";
|
import $ from "jquery";
|
||||||
|
|
||||||
function getConfig() {
|
export const pathPrefix = "/_search-center";
|
||||||
const options = {
|
|
||||||
url: "/config",
|
|
||||||
cache: false,
|
|
||||||
type: "GET",
|
|
||||||
dataType: "json", // disable automatic guessing
|
|
||||||
async: false,
|
|
||||||
};
|
|
||||||
let result = {};
|
|
||||||
try {
|
|
||||||
const text = $.ajax(options).responseText;
|
|
||||||
result = JSON.parse(text);
|
|
||||||
} catch (e) {
|
|
||||||
console.warn("failed get config data");
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
const { api_endpoint } = getConfig();
|
|
||||||
|
|
||||||
let apiEndpoint = api_endpoint;
|
|
||||||
if (!apiEndpoint) {
|
|
||||||
apiEndpoint = API_ENDPOINT;
|
|
||||||
if (!API_ENDPOINT) {
|
|
||||||
apiEndpoint = `${location.protocol}//${location.hostname}:2900`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const pathPrefix = (apiEndpoint || "") + "/_search-center";
|
|
||||||
export function buildQueryArgs(params) {
|
export function buildQueryArgs(params) {
|
||||||
let argsStr = "";
|
let argsStr = "";
|
||||||
for (let key in params) {
|
for (let key in params) {
|
||||||
|
@ -41,7 +14,7 @@ export function buildQueryArgs(params) {
|
||||||
}
|
}
|
||||||
return argsStr;
|
return argsStr;
|
||||||
}
|
}
|
||||||
export const ESPrefix = (apiEndpoint || "") + "/elasticsearch";
|
export const ESPrefix = "/elasticsearch";
|
||||||
|
|
||||||
export async function fetchWithTimeout(resource, options = {}) {
|
export async function fetchWithTimeout(resource, options = {}) {
|
||||||
const { timeout = 5000 } = options;
|
const { timeout = 5000 } = options;
|
||||||
|
|
Loading…
Reference in New Issue