lumberjack改造前

This commit is contained in:
robin
2026-02-12 21:37:55 +08:00
parent c28317ee07
commit c6da67db79
24 changed files with 836 additions and 68 deletions

View File

@@ -1,7 +1,7 @@
FROM --platform=linux/amd64 alpine:latest
FROM --platform=linux/amd64 alpine:latest
LABEL maintainer="goedge.cdn@gmail.com"
ENV TZ "Asia/Shanghai"
ENV VERSION 1.4.6
ENV VERSION 1.4.7
ENV ROOT_DIR /usr/local/goedge
ENV TAR_FILE edge-admin-linux-amd64-plus-v${VERSION}.zip
@@ -38,4 +38,4 @@ EXPOSE 7788
EXPOSE 8001
EXPOSE 3306
ENTRYPOINT [ "/usr/local/goedge/run.sh" ]
ENTRYPOINT [ "/usr/local/goedge/run.sh" ]

View File

@@ -1,9 +1,9 @@
package teaconst
package teaconst
const (
Version = "1.4.6" //1.3.9
Version = "1.4.7" //1.3.9
APINodeVersion = "1.4.6" //1.3.9
APINodeVersion = "1.4.7" //1.3.9
ProductName = "Edge Admin"
ProcessName = "edge-admin"
@@ -18,3 +18,4 @@ const (
SystemdServiceName = "edge-admin"
UpdatesURL = "https://goedge.cn/api/boot/versions?os=${os}&arch=${arch}&version=${version}"
)

View File

@@ -9,6 +9,7 @@ import (
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/systemconfigs"
"github.com/iwind/TeaGo/actions"
"strings"
)
const clickhouseConfigCode = "clickhouseConfig"
@@ -28,7 +29,7 @@ func (this *ClickHouseAction) RunGet(params struct{}) {
this.ErrorPage(err)
return
}
cfg := &systemconfigs.ClickHouseSetting{Port: 8123, Database: "default"}
cfg := &systemconfigs.ClickHouseSetting{Port: 8123, Database: "default", Scheme: "http"}
if len(resp.ValueJSON) > 0 {
_ = json.Unmarshal(resp.ValueJSON, cfg)
}
@@ -38,22 +39,31 @@ func (this *ClickHouseAction) RunGet(params struct{}) {
if cfg.Database == "" {
cfg.Database = "default"
}
if strings.TrimSpace(cfg.Scheme) == "" {
cfg.Scheme = "http"
}
this.Data["config"] = map[string]interface{}{
"host": cfg.Host,
"port": cfg.Port,
"user": cfg.User,
"password": cfg.Password,
"database": cfg.Database,
"host": cfg.Host,
"port": cfg.Port,
"user": cfg.User,
"password": cfg.Password,
"database": cfg.Database,
"scheme": cfg.Scheme,
"tlsSkipVerify": cfg.TLSSkipVerify,
"tlsServerName": cfg.TLSServerName,
}
this.Show()
}
func (this *ClickHouseAction) RunPost(params struct {
Host string
Port int
User string
Password string
Database string
Host string
Port int
User string
Password string
Database string
Scheme string
TLSSkipVerify bool
TLSServerName string
Must *actions.Must
}) {
@@ -64,6 +74,9 @@ func (this *ClickHouseAction) RunPost(params struct {
if params.Database == "" {
params.Database = "default"
}
if params.Scheme != "https" {
params.Scheme = "http"
}
password := params.Password
if password == "" {
resp, _ := this.RPC().SysSettingRPC().ReadSysSetting(this.AdminContext(), &pb.ReadSysSettingRequest{Code: clickhouseConfigCode})
@@ -75,11 +88,14 @@ func (this *ClickHouseAction) RunPost(params struct {
}
}
cfg := &systemconfigs.ClickHouseSetting{
Host: params.Host,
Port: params.Port,
User: params.User,
Password: password,
Database: params.Database,
Host: params.Host,
Port: params.Port,
User: params.User,
Password: password,
Database: params.Database,
Scheme: params.Scheme,
TLSSkipVerify: params.TLSSkipVerify,
TLSServerName: strings.TrimSpace(params.TLSServerName),
}
valueJSON, err := json.Marshal(cfg)
if err != nil {

View File

@@ -50,8 +50,8 @@ func (this *AdvancedHelper) BeforeAction(actionPtr actions.ActionWrapper) (goNex
}
// 外层始终显示「日志数据库」与「ClickHouse 配置」两个标签,不随点击变化
path := action.Request.URL.Path
tabbar.Add(this.Lang(actionPtr, codes.AdminSetting_TabAccessLogDatabases), "", "/db", "", (path == "/db" || strings.HasPrefix(path, "/db/")) && path != "/db/clickhouse")
tabbar.Add(this.Lang(actionPtr, codes.DBNode_TabClickHouse), "", "/db/clickhouse", "", path == "/db/clickhouse")
tabbar.Add("日志数据库MySQL", "", "/db", "", (path == "/db" || strings.HasPrefix(path, "/db/")) && path != "/db/clickhouse")
tabbar.Add("日志数据库(ClickHouse", "", "/db/clickhouse", "", path == "/db/clickhouse")
if teaconst.IsPlus {
// 目前仅在调试模式下使用
if Tea.IsTesting() {

View File

@@ -80,9 +80,7 @@ Vue.component("http-access-log-box", {
<div>
<a v-if="accessLog.node != null && accessLog.node.nodeCluster != null" :href="'/clusters/cluster/node?nodeId=' + accessLog.node.id + '&clusterId=' + accessLog.node.nodeCluster.id" title="点击查看节点详情" target="_top"><span class="grey">[{{accessLog.node.name}}<span v-if="!accessLog.node.name.endsWith('节点')">节点</span>]</span></a>
<!-- 网站 -->
<a :href="'/servers/server/log?serverId=' + accessLog.serverId" title="点击到网站" v-if="vShowServerLink && accessLog.serverId > 0"><span class="grey">[网站]</span></a>
<span v-if="vShowServerLink && (accessLog.serverId == null || accessLog.serverId == 0)" @click.prevent="mismatch()"><span class="disabled">[网站]</span></span>
<span v-if="accessLog.region != null && accessLog.region.length > 0" class="grey"><ip-box :v-ip="accessLog.remoteAddr">[{{accessLog.region}}]</ip-box></span>
<ip-box><keyword :v-word="vKeyword">{{accessLog.remoteAddr}}</keyword></ip-box> [{{accessLog.timeLocal}}] <em>&quot;<keyword :v-word="vKeyword">{{accessLog.requestMethod}}</keyword> {{accessLog.scheme}}://<keyword :v-word="vKeyword">{{accessLog.host}}</keyword><keyword :v-word="vKeyword">{{accessLog.requestURI}}</keyword> <a :href="accessLog.scheme + '://' + accessLog.host + accessLog.requestURI" target="_blank" title="新窗口打开" class="disabled"><i class="external icon tiny"></i> </a> {{accessLog.proto}}&quot; </em> <keyword :v-word="vKeyword">{{accessLog.status}}</keyword>
@@ -110,6 +108,7 @@ Vue.component("http-access-log-box", {
</span>
<span v-if="accessLog.requestTime != null"> - 耗时:{{formatCost(accessLog.requestTime)}} ms </span><span v-if="accessLog.humanTime != null && accessLog.humanTime.length > 0" class="grey small">&nbsp; ({{accessLog.humanTime}})</span>
<a :href="'/servers/server/log?serverId=' + accessLog.serverId" title="仅看此网站日志" v-if="vShowServerLink && accessLog.serverId > 0" class="ui label tiny blue basic" style="font-weight: normal; margin-left: 0.5em; padding: 2px 5px !important">网站</a>
&nbsp; <a href="" @click.prevent="showLog" title="查看详情"><i class="icon expand"></i></a>
</div>
</div>`

View File

@@ -14,11 +14,21 @@
<p class="comment">ClickHouse 服务器地址。</p>
</td>
</tr>
<tr>
<td>协议Scheme</td>
<td>
<select name="scheme" class="ui dropdown auto-width">
<option value="http" :selected="config.scheme != 'https'">HTTP</option>
<option value="https" :selected="config.scheme == 'https'">HTTPS</option>
</select>
<p class="comment">默认 HTTP选择 HTTPS 时将启用 TLS 连接。</p>
</td>
</tr>
<tr>
<td>端口Port</td>
<td>
<input type="number" name="port" min="1" max="65535" style="width:6em" :value="config.port"/>
<p class="comment">HTTP 接口端口,默认 8123</p>
<p class="comment">接口端口HTTP 默认 8123HTTPS 常用 8443以你的 ClickHouse 实际配置为准)</p>
</td>
</tr>
<tr>
@@ -34,6 +44,20 @@
<p class="comment">留空则不修改已保存的密码。</p>
</td>
</tr>
<tr>
<td>TLS 跳过证书校验</td>
<td>
<checkbox name="tlsSkipVerify" value="1" :checked="config.tlsSkipVerify"></checkbox>
<p class="comment">仅测试环境建议开启;生产建议关闭并使用受信任证书。</p>
</td>
</tr>
<tr>
<td>TLS Server Name</td>
<td>
<input type="text" name="tlsServerName" maxlength="200" placeholder="可选证书校验域名SNI" :value="config.tlsServerName"/>
<p class="comment">可选;当 ClickHouse 证书域名与连接 Host 不一致时使用。</p>
</td>
</tr>
<tr>
<td>数据库名Database</td>
<td>