修复镜像相关问题&&代码重构

This commit is contained in:
朱厚九 2024-07-10 14:55:21 +08:00
parent 97396d784b
commit 329c98ebc5
57 changed files with 405 additions and 172 deletions

View File

@ -18,5 +18,5 @@ start:
.PHONY: build
build:
docker buildx build --platform linux/amd64 -t "您的仓库地址" -f cmd/hummingbird/Dockerfile --push .
docker buildx build --platform linux/amd64 -t "" -f cmd/hummingbird-core/Dockerfile --push .

View File

@ -30,12 +30,12 @@ Timeout = 120
[Databases.Metadata]
[Databases.Metadata.Primary]
Type = 'sqlite'
DataSource = 'hummingbird/db-data/core-data/core.db?_timeout=5000'
DataSource = 'manifest/docker/db-data/core-data/core.db?_timeout=5000'
[Databases.Data]
[Databases.Data.Primary]
Type = 'leveldb'
DataSource = 'hummingbird/db-data/leveldb-core-data/'
DataSource = 'manifest/docker/db-data/leveldb-core-data/'
[MessageQueue]
Protocol = 'tcp'

View File

@ -0,0 +1,33 @@
{
"files": {
"main.css": "/static/css/main.822cee67.css",
"main.js": "/static/js/main.9a4b5878.js",
"static/js/342.e07172ae.chunk.js": "/static/js/342.e07172ae.chunk.js",
"static/js/558.d067177e.chunk.js": "/static/js/558.d067177e.chunk.js",
"static/js/324.bf4cc54f.chunk.js": "/static/js/324.bf4cc54f.chunk.js",
"static/js/258.efff4014.chunk.js": "/static/js/258.efff4014.chunk.js",
"static/js/787.d3befce1.chunk.js": "/static/js/787.d3befce1.chunk.js",
"ts.worker.js": "/ts.worker.js",
"json.worker.js": "/json.worker.js",
"editor.worker.js": "/editor.worker.js",
"static/media/head-bg.8b029587.png": "/static/media/head-bg.8b029587.60f3a93d8a581efd4c49.png",
"static/media/bg.ad187fed.png": "/static/media/bg.ad187fed.a47d112f49f56eb1cfa5.png",
"static/media/codicon.ttf": "/static/media/codicon.b797181c93b3755f4fa1.ttf",
"static/media/bg-1.7f3acdfb.png": "/static/media/bg-1.7f3acdfb.aad6275b1801455a76c0.png",
"static/media/newlogo.png": "/static/media/newlogo.e2ad3c36f34a1c2c10d1.png",
"static/media/default.32752796.png": "/static/media/default.32752796.9e3b4c5313ccb5060485.png",
"static/media/background.png": "/static/media/background.8ed5e5404edf817e15f5.png",
"index.html": "/index.html",
"main.822cee67.css.map": "/static/css/main.822cee67.css.map",
"main.9a4b5878.js.map": "/static/js/main.9a4b5878.js.map",
"342.e07172ae.chunk.js.map": "/static/js/342.e07172ae.chunk.js.map",
"558.d067177e.chunk.js.map": "/static/js/558.d067177e.chunk.js.map",
"324.bf4cc54f.chunk.js.map": "/static/js/324.bf4cc54f.chunk.js.map",
"258.efff4014.chunk.js.map": "/static/js/258.efff4014.chunk.js.map",
"787.d3befce1.chunk.js.map": "/static/js/787.d3befce1.chunk.js.map"
},
"entrypoints": [
"static/css/main.822cee67.css",
"static/js/main.9a4b5878.js"
]
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -0,0 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><link rel="apple-touch-icon" href="/favicon.ico"/><link rel="manifest" href="/manifest.json"/><title>登录</title><script defer="defer" src="/static/js/main.9a4b5878.js"></script><link href="/static/css/main.822cee67.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,8 @@
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
/*!-----------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Version: 0.34.1(547870b6881302c5b4ff32173c16d06009e3588f)
* Released under the MIT license
* https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
*-----------------------------------------------------------------------------*/

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

@ -0,0 +1,25 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "logo.png",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/png"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}

View File

@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,6 @@
/*!-----------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Version: 0.34.1(547870b6881302c5b4ff32173c16d06009e3588f)
* Released under the MIT license
* https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
*-----------------------------------------------------------------------------*/

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,2 @@
"use strict";(self.webpackChunkmyapp=self.webpackChunkmyapp||[]).push([[787],{787:function(e,t,n){n.r(t),n.d(t,{getCLS:function(){return y},getFCP:function(){return g},getFID:function(){return C},getLCP:function(){return P},getTTFB:function(){return D}});var i,r,a,o,u=function(e,t){return{name:e,value:void 0===t?-1:t,delta:0,entries:[],id:"v2-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12)}},c=function(e,t){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){if("first-input"===e&&!("PerformanceEventTiming"in self))return;var n=new PerformanceObserver((function(e){return e.getEntries().map(t)}));return n.observe({type:e,buffered:!0}),n}}catch(e){}},f=function(e,t){var n=function n(i){"pagehide"!==i.type&&"hidden"!==document.visibilityState||(e(i),t&&(removeEventListener("visibilitychange",n,!0),removeEventListener("pagehide",n,!0)))};addEventListener("visibilitychange",n,!0),addEventListener("pagehide",n,!0)},s=function(e){addEventListener("pageshow",(function(t){t.persisted&&e(t)}),!0)},m=function(e,t,n){var i;return function(r){t.value>=0&&(r||n)&&(t.delta=t.value-(i||0),(t.delta||void 0===i)&&(i=t.value,e(t)))}},v=-1,p=function(){return"hidden"===document.visibilityState?0:1/0},d=function(){f((function(e){var t=e.timeStamp;v=t}),!0)},l=function(){return v<0&&(v=p(),d(),s((function(){setTimeout((function(){v=p(),d()}),0)}))),{get firstHiddenTime(){return v}}},g=function(e,t){var n,i=l(),r=u("FCP"),a=function(e){"first-contentful-paint"===e.name&&(f&&f.disconnect(),e.startTime<i.firstHiddenTime&&(r.value=e.startTime,r.entries.push(e),n(!0)))},o=window.performance&&performance.getEntriesByName&&performance.getEntriesByName("first-contentful-paint")[0],f=o?null:c("paint",a);(o||f)&&(n=m(e,r,t),o&&a(o),s((function(i){r=u("FCP"),n=m(e,r,t),requestAnimationFrame((function(){requestAnimationFrame((function(){r.value=performance.now()-i.timeStamp,n(!0)}))}))})))},h=!1,T=-1,y=function(e,t){h||(g((function(e){T=e.value})),h=!0);var n,i=function(t){T>-1&&e(t)},r=u("CLS",0),a=0,o=[],v=function(e){if(!e.hadRecentInput){var t=o[0],i=o[o.length-1];a&&e.startTime-i.startTime<1e3&&e.startTime-t.startTime<5e3?(a+=e.value,o.push(e)):(a=e.value,o=[e]),a>r.value&&(r.value=a,r.entries=o,n())}},p=c("layout-shift",v);p&&(n=m(i,r,t),f((function(){p.takeRecords().map(v),n(!0)})),s((function(){a=0,T=-1,r=u("CLS",0),n=m(i,r,t)})))},E={passive:!0,capture:!0},w=new Date,L=function(e,t){i||(i=t,r=e,a=new Date,F(removeEventListener),S())},S=function(){if(r>=0&&r<a-w){var e={entryType:"first-input",name:i.type,target:i.target,cancelable:i.cancelable,startTime:i.timeStamp,processingStart:i.timeStamp+r};o.forEach((function(t){t(e)})),o=[]}},b=function(e){if(e.cancelable){var t=(e.timeStamp>1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?function(e,t){var n=function(){L(e,t),r()},i=function(){r()},r=function(){removeEventListener("pointerup",n,E),removeEventListener("pointercancel",i,E)};addEventListener("pointerup",n,E),addEventListener("pointercancel",i,E)}(t,e):L(t,e)}},F=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach((function(t){return e(t,b,E)}))},C=function(e,t){var n,a=l(),v=u("FID"),p=function(e){e.startTime<a.firstHiddenTime&&(v.value=e.processingStart-e.startTime,v.entries.push(e),n(!0))},d=c("first-input",p);n=m(e,v,t),d&&f((function(){d.takeRecords().map(p),d.disconnect()}),!0),d&&s((function(){var a;v=u("FID"),n=m(e,v,t),o=[],r=-1,i=null,F(addEventListener),a=p,o.push(a),S()}))},k={},P=function(e,t){var n,i=l(),r=u("LCP"),a=function(e){var t=e.startTime;t<i.firstHiddenTime&&(r.value=t,r.entries.push(e),n())},o=c("largest-contentful-paint",a);if(o){n=m(e,r,t);var v=function(){k[r.id]||(o.takeRecords().map(a),o.disconnect(),k[r.id]=!0,n(!0))};["keydown","click"].forEach((function(e){addEventListener(e,v,{once:!0,capture:!0})})),f(v,!0),s((function(i){r=u("LCP"),n=m(e,r,t),requestAnimationFrame((function(){requestAnimationFrame((function(){r.value=performance.now()-i.timeStamp,k[r.id]=!0,n(!0)}))}))}))}},D=function(e){var t,n=u("TTFB");t=function(){try{var t=performance.getEntriesByType("navigation")[0]||function(){var e=performance.timing,t={entryType:"navigation",startTime:0};for(var n in e)"navigationStart"!==n&&"toJSON"!==n&&(t[n]=Math.max(e[n]-e.navigationStart,0));return t}();if(n.value=n.delta=t.responseStart,n.value<0||n.value>performance.now())return;n.entries=[t],e(n)}catch(e){}},"complete"===document.readyState?setTimeout(t,0):addEventListener("load",(function(){return setTimeout(t,0)}))}}}]);
//# sourceMappingURL=787.d3befce1.chunk.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,117 @@
/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/*! @license DOMPurify 2.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.3.1/LICENSE */
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
/*!-----------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Version: 0.34.1(547870b6881302c5b4ff32173c16d06009e3588f)
* Released under the MIT license
* https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
*-----------------------------------------------------------------------------*/
/**
* @license
* Lodash <https://lodash.com/>
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/
/**
* @license React
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @license React
* use-sync-external-store-shim.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @remix-run/router v1.0.3
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
/**
* React Router DOM v6.4.3
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
/**
* React Router v6.4.3
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
/** @license React v16.13.1
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,8 @@
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
/*!-----------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Version: 0.34.1(547870b6881302c5b4ff32173c16d06009e3588f)
* Released under the MIT license
* https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
*-----------------------------------------------------------------------------*/

File diff suppressed because one or more lines are too long

View File

@ -121,13 +121,9 @@ type DeviceLibraryResponse struct {
func DeviceLibraryResponseFromModel(dl models.DeviceLibrary) DeviceLibraryResponse {
// 如果docker镜像id为空那么返回给前端的版本为 `-`
if dl.DockerImageId == "" {
if dl.DockerImageId == "" && !dl.IsInternal {
dl.Version = "-"
}
//if dl.ConfigFile != "" {
// dl.ConfigFile = path.Base(dl.ConfigFile)
//}
return DeviceLibraryResponse{
Id: dl.Id,
Name: dl.Name,

View File

@ -185,7 +185,13 @@ func (m *deviceLibraryManager) updateDLDefaultVersion(dl models.DeviceLibrary, n
func (m *deviceLibraryManager) downloadVersion(dl models.DeviceLibrary, dc models.DockerConfig, version string) (string, error) {
// 3.下载应用
imageId, err := m.appModel.DownApp(dtos.DockerConfigFromModel(dc), dtos.DeviceLibraryFromModel(dl), version)
var cfg dtos.DockerConfig
if dl.IsInternal {
cfg = dtos.WincLinkDockerConfig()
} else {
cfg = dtos.DockerConfigFromModel(dc)
}
imageId, err := m.appModel.DownApp(cfg, dtos.DeviceLibraryFromModel(dl), version)
if err != nil {
return "", err
}

View File

@ -11,11 +11,12 @@ func (app *driverLibApp) GetDeviceLibraryAndMirrorConfig(dlId string) (dl models
}
// 2.获取docker仓库配置
if !dl.IsInternal {
dc, err = app.dbClient.DockerConfigById(dl.DockerConfigId)
if err != nil {
app.lc.Errorf("2.DeviceLibraryOperate docker hub, id:%s, DockerConfigId:%s, err:%v", dlId, dl.DockerConfigId, err)
return
}
}
return
}

View File

@ -43,7 +43,6 @@ func (ctl *controller) DeviceLibrariesSearch(c *gin.Context) {
}
dtos.CorrectionPageParam(&req.BaseSearchConditionQuery)
//req2 := dtos.FromDeviceLibrarySearchQueryRequestToRpc(req)
list, total, edgeXErr := ctl.getDriverLibApp().DeviceLibrariesSearch(c, req)
if edgeXErr != nil {
httphelper.RenderFail(c, edgeXErr, c.Writer, lc)

View File

@ -86,6 +86,10 @@ func (b *Bootstrap) BootstrapHandler(ctx context.Context, wg *sync.WaitGroup, _
return false
}
if !initApp(ctx, configuration, dic) {
return false
}
// rpc 服务
if ok := initRPCServer(ctx, wg, dic); !ok {
return false

View File

@ -16,107 +16,136 @@ package initialize
import (
"context"
"github.com/winc-link/hummingbird/internal/hummingbird/core/container"
"encoding/json"
"github.com/kirinlabs/HttpRequest"
"github.com/winc-link/hummingbird/internal/hummingbird/core/config"
pkgContainer "github.com/winc-link/hummingbird/internal/pkg/container"
"github.com/winc-link/hummingbird/internal/pkg/di"
"github.com/winc-link/hummingbird/internal/pkg/errort"
"github.com/winc-link/hummingbird/internal/pkg/logger"
"strings"
"sync"
"time"
)
func initApp(ctx context.Context, dic *di.Container) bool {
func initApp(ctx context.Context, configuration *config.ConfigurationStruct, dic *di.Container) bool {
lc := pkgContainer.LoggingClientFrom(dic.Get)
dbClient := container.DBClientFrom(dic.Get)
_, edgeXErr := dbClient.GetUserByUserName("admin")
if edgeXErr != nil {
if errort.Is(errort.AppPasswordError, edgeXErr) {
var wg sync.WaitGroup
wg.Add(6)
go syncQuickNavigation(&wg, dic, lc)
go syncDocTemplate(&wg, dic, lc)
go syncUnitTemplate(&wg, dic, lc)
go syncCategory(&wg, dic, lc)
go syncThingModel(&wg, dic, lc)
go syncDocuments(&wg, dic, lc)
//go initEkuiperStreams(&wg, dic, lc)
wg.Wait()
lc.Infof("initApp end...")
}
}
go initEkuiperStreams(dic, lc, configuration)
return true
}
func syncCategory(wg *sync.WaitGroup, dic *di.Container, lc logger.LoggingClient) {
defer wg.Done()
categoryApp := container.CategoryTemplateAppFrom(dic.Get)
_, err := categoryApp.Sync(context.Background(), "Ireland")
lc.Infof("sync category start...")
func initEkuiperStreams(dic *di.Container, lc logger.LoggingClient, configuration *config.ConfigurationStruct) {
// time 10s 以保证ekuiper初始化完成
time.Sleep(10 * time.Second)
req := HttpRequest.NewRequest()
r := make(map[string]string)
r["sql"] = "CREATE STREAM mqtt_stream () WITH (DATASOURCE=\"eventbus/in\", FORMAT=\"JSON\",SHARED = \"true\")"
b, _ := json.Marshal(r)
url := configuration.Clients["Ekuiper"].Address() + "/streams"
resp, err := req.Post(url, b)
if err != nil {
lc.Errorf("sync category fail...")
lc.Errorf("init ekuiper stream failed error:%+v", err.Error())
return
}
lc.Infof("sync category success")
lc.Infof("init ekuiper stream start")
lc.Info("ekuiper stream start resp code", resp.StatusCode())
if resp.StatusCode() == 201 {
body, err := resp.Body()
if err != nil {
lc.Errorf("init ekuiper stream failed error:%+v", err.Error())
return
}
if strings.Contains(string(body), "created") {
lc.Infof("init ekuiper stream success")
return
}
} else if resp.StatusCode() == 400 {
body, err := resp.Body()
lc.Infof("init ekuiper stream body", string(body))
if err != nil {
lc.Errorf("init ekuiper stream failed error:%+v", err.Error())
return
}
if strings.Contains(string(body), "already exists") {
lc.Infof("init ekuiper stream plug success")
return
}
} else {
lc.Errorf("init ekuiper stream failed resp code:%+v", resp.StatusCode())
}
}
func syncUnitTemplate(wg *sync.WaitGroup, dic *di.Container, lc logger.LoggingClient) {
func DownloadEkuiperKafkaPlug(wg *sync.WaitGroup, dic *di.Container, lc logger.LoggingClient) {
defer wg.Done()
unitTempApp := container.UnitTemplateAppFrom(dic.Get)
_, err := unitTempApp.Sync(context.Background(), "Ireland")
lc.Infof("sync unit start")
req := HttpRequest.NewRequest()
kafkaPlug := make(map[string]string)
kafkaPlug["name"] = "kafka"
kafkaPlug["file"] = "https://packages.emqx.net/kuiper-plugins/1.10.0/debian/sinks/kafka_amd64.zip"
b, _ := json.Marshal(kafkaPlug)
resp, err := req.Post("http://ekuiper:9081/plugins/sinks", b)
if err != nil {
lc.Errorf("sync unit fail")
lc.Errorf("down ekuiper kafka plug failed error:%+v", err.Error())
}
if resp.StatusCode() == 201 {
body, err := resp.Body()
if err != nil {
lc.Errorf("down ekuiper kafka plug failed error:%+v", err.Error())
return
}
if strings.Contains(string(body), "created") {
lc.Infof("down ekuiper kafka plug success")
return
}
} else if resp.StatusCode() == 400 {
body, err := resp.Body()
if err != nil {
lc.Errorf("down ekuiper kafka plug failed error:%+v", err.Error())
return
}
if strings.Contains(string(body), "duplicate") {
lc.Infof("down ekuiper kafka plug success")
return
}
} else {
lc.Errorf("down ekuiper kafka plug failed resp code:%+v", resp.StatusCode())
}
lc.Infof("sync unit success")
}
func syncDocTemplate(wg *sync.WaitGroup, dic *di.Container, lc logger.LoggingClient) {
func DownloadEkuiperTdenginePlug(wg *sync.WaitGroup, dic *di.Container, lc logger.LoggingClient) {
defer wg.Done()
docApp := container.DocsTemplateAppFrom(dic.Get)
_, err := docApp.SyncDocs(context.Background(), "Ireland")
lc.Infof("sync doc start")
req := HttpRequest.NewRequest()
kafkaPlug := make(map[string]interface{})
kafkaPlug["name"] = "tdengine"
kafkaPlug["file"] = "https://packages.emqx.net/kuiper-plugins/1.10.0/debian/sinks/tdengine_amd64.zip"
kafkaPlug["shellParas"] = []string{"2.4.0.26"}
b, _ := json.Marshal(kafkaPlug)
resp, err := req.Post("http://ekuiper:9081/plugins/sinks", b)
if err != nil {
lc.Errorf("sync doc fail")
lc.Errorf("down ekuiper tdengine plug failed error:%+v", err.Error())
}
lc.Infof("sync doc success")
}
func syncQuickNavigation(wg *sync.WaitGroup, dic *di.Container, lc logger.LoggingClient) {
defer wg.Done()
quickApp := container.QuickNavigationAppTemplateAppFrom(dic.Get)
_, err := quickApp.SyncQuickNavigation(context.Background(), "Ireland")
lc.Infof("sync quickNavigation start")
if resp.StatusCode() == 201 {
body, err := resp.Body()
if err != nil {
lc.Errorf("sync quickNavigation fail...", err.Error())
lc.Errorf("down ekuiper tdengine plug failed error:%+v", err.Error())
return
}
lc.Infof("sync quickNavigation success")
}
func syncThingModel(wg *sync.WaitGroup, dic *di.Container, lc logger.LoggingClient) {
defer wg.Done()
thingModelApp := container.ThingModelTemplateAppFrom(dic.Get)
_, err := thingModelApp.Sync(context.Background(), "Ireland")
lc.Infof("sync thingModel start")
if strings.Contains(string(body), "created") {
lc.Infof("down ekuiper tdengine plug success")
return
}
} else if resp.StatusCode() == 400 {
body, err := resp.Body()
if err != nil {
lc.Errorf("sync thingModel fail...", err.Error())
lc.Errorf("down ekuiper tdengine plug failed error:%+v", err.Error())
return
}
lc.Infof("sync thingModel success")
}
func syncDocuments(wg *sync.WaitGroup, dic *di.Container, lc logger.LoggingClient) {
defer wg.Done()
languageApp := container.LanguageAppNameFrom(dic.Get)
err := languageApp.Sync(context.Background(), "Ireland")
lc.Infof("sync language start")
if err != nil {
lc.Errorf("sync language fail...", err.Error())
if strings.Contains(string(body), "duplicate") {
lc.Infof("down ekuiper tdengine plug success")
return
}
} else {
lc.Errorf("down ekuiper tdengine plug failed resp code:%+v", resp.StatusCode())
}
lc.Infof("sync language success")
}

View File

@ -76,6 +76,8 @@ func RegisterGateway(engine *gin.Engine, dic *di.Container) {
v1Auth.GET("device-libraries", ctl.DeviceLibrariesSearch)
v1Auth.DELETE("device-libraries/:deviceLibraryId", ctl.DeviceLibraryDelete)
v1Auth.PUT("device-libraries/:deviceLibraryId", ctl.DeviceLibraryUpdate)
v1Auth.GET("driver-classify", ctl.DeviceClassify)
}
/*******驱动实例 *******/
{

Binary file not shown.

Binary file not shown.

View File

@ -1 +0,0 @@
MANIFEST-000007

View File

@ -1 +0,0 @@
MANIFEST-000005

View File

@ -1,39 +0,0 @@
=============== Jun 23, 2024 (UTC) ===============
07:28:50.576890 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed
07:28:50.595517 db@open opening
07:28:50.601758 version@stat F·[] S·0B[] Sc·[]
07:28:50.606910 db@janitor F·2 G·0
07:28:50.608077 db@open done T·11.719649ms
07:28:52.124654 db@close closing
07:28:52.125660 db@close done T·1.005394ms
=============== Jun 23, 2024 (UTC) ===============
07:28:58.402544 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed
07:28:58.415412 version@stat F·[] S·0B[] Sc·[]
07:28:58.416824 db@open opening
07:28:58.418046 journal@recovery F·1
07:28:58.419128 journal@recovery recovering @1
07:28:58.430863 version@stat F·[] S·0B[] Sc·[]
07:28:58.545419 db@janitor F·2 G·0
07:28:58.547729 db@open done T·129.962204ms
07:49:44.007188 db@close closing
07:49:44.008431 db@close done T·1.252401ms
=============== Jun 23, 2024 (UTC) ===============
07:52:54.060168 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed
07:52:54.070750 version@stat F·[] S·0B[] Sc·[]
07:52:54.071563 db@open opening
07:52:54.072563 journal@recovery F·1
07:52:54.073517 journal@recovery recovering @2
07:52:54.080468 version@stat F·[] S·0B[] Sc·[]
07:52:54.117002 db@janitor F·2 G·0
07:52:54.117872 db@open done T·45.529864ms
07:52:54.740007 db@close closing
07:52:54.741617 db@close done T·1.607086ms
=============== Jun 23, 2024 (UTC) ===============
07:52:59.485349 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed
07:52:59.496162 version@stat F·[] S·0B[] Sc·[]
07:52:59.497367 db@open opening
07:52:59.499105 journal@recovery F·1
07:52:59.500621 journal@recovery recovering @4
07:52:59.511912 version@stat F·[] S·0B[] Sc·[]
07:52:59.534086 db@janitor F·2 G·0
07:52:59.535315 db@open done T·36.592228ms