Compare commits

...

11 Commits

Author SHA1 Message Date
刘祥超
073890c843 默认不启用MMAP 2024-05-01 12:51:24 +08:00
刘祥超
44765ed970 Dockerfile版本号修改为1.3.8 2024-05-01 08:53:53 +08:00
刘祥超
39bd6264e7 版本号修改为1.3.8 2024-04-30 19:51:35 +08:00
刘祥超
8a480d296f 可以在集群设置中修改节点最大并发读/写数 2024-04-30 19:51:30 +08:00
刘祥超
fd2ae5d445 修改Docker文件版本号为1.3.7 2024-04-29 23:15:24 +08:00
刘祥超
d51370d443 版本修改为1.3.7 2024-04-29 23:12:21 +08:00
刘祥超
2d711408c6 管理平台界面设置中增加“使用的DNS解析库”选项 2024-04-29 15:07:09 +08:00
刘祥超
e911039e33 更新依赖库 2024-04-29 14:24:40 +08:00
刘祥超
e915deffb3 安装MySQL过程中测试MySQL是否能够连接后关闭连接 2024-04-28 11:41:07 +08:00
刘祥超
3b61871399 完善添加/修改源站时“回源主机名”的提示文字 2024-04-25 10:24:20 +08:00
刘祥超
cb33d58685 Docker版本号修改为1.3.6 2024-04-22 11:17:20 +08:00
18 changed files with 92 additions and 17 deletions

View File

@@ -1,7 +1,7 @@
FROM --platform=linux/amd64 alpine:latest
LABEL maintainer="goedge.cdn@gmail.com"
ENV TZ "Asia/Shanghai"
ENV VERSION 1.3.5
ENV VERSION 1.3.8
ENV ROOT_DIR /usr/local/goedge
ENV TAR_FILE edge-admin-linux-amd64-plus-v${VERSION}.zip

2
go.mod
View File

@@ -8,7 +8,7 @@ require (
github.com/TeaOSLab/EdgeCommon v0.0.0-00010101000000-000000000000
github.com/cespare/xxhash/v2 v2.2.0
github.com/go-sql-driver/mysql v1.5.0
github.com/iwind/TeaGo v0.0.0-20240312020455-6f20b5121caf
github.com/iwind/TeaGo v0.0.0-20240429060313-31a7bc8e9cc9
github.com/iwind/gosock v0.0.0-20211103081026-ee4652210ca4
github.com/miekg/dns v1.1.43
github.com/quic-go/quic-go v0.42.0

2
go.sum
View File

@@ -30,6 +30,8 @@ github.com/google/pprof v0.0.0-20240402174815-29b9bb013b0f h1:f00RU+zOX+B3rLAmMM
github.com/google/pprof v0.0.0-20240402174815-29b9bb013b0f/go.mod h1:kf6iHlnVGwgKolg33glAes7Yg/8iWP8ukqeldJSO7jw=
github.com/iwind/TeaGo v0.0.0-20240312020455-6f20b5121caf h1:WA9qgiynESu/DDTnLH6npRI5AK6UL9qwJ2YZ5qhJX5E=
github.com/iwind/TeaGo v0.0.0-20240312020455-6f20b5121caf/go.mod h1:SfqVbWyIPdVflyA6lMgicZzsoGS8pyeLiTRe8/CIpGI=
github.com/iwind/TeaGo v0.0.0-20240429060313-31a7bc8e9cc9 h1:lqSd+OeAMzPlejoVtsmHJEeQ6/MWXCr+Ws2eX9/Rewg=
github.com/iwind/TeaGo v0.0.0-20240429060313-31a7bc8e9cc9/go.mod h1:SfqVbWyIPdVflyA6lMgicZzsoGS8pyeLiTRe8/CIpGI=
github.com/iwind/gosock v0.0.0-20211103081026-ee4652210ca4 h1:VWGsCqTzObdlbf7UUE3oceIpcEKi4C/YBUszQXk118A=
github.com/iwind/gosock v0.0.0-20211103081026-ee4652210ca4/go.mod h1:H5Q7SXwbx3a97ecJkaS2sD77gspzE7HFUafBO0peEyA=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=

View File

@@ -93,6 +93,7 @@ func loadAdminUIConfig() (*systemconfigs.AdminUIConfig, error) {
}
var config = &systemconfigs.AdminUIConfig{}
config.DNSResolver.Type = nodeconfigs.DNSResolverTypeDefault // 默认值
err = json.Unmarshal(resp.ValueJSON, config)
if err != nil {
logs.Println("[UI_MANAGER]" + err.Error())
@@ -108,7 +109,7 @@ func loadAdminUIConfig() (*systemconfigs.AdminUIConfig, error) {
}
func defaultAdminUIConfig() *systemconfigs.AdminUIConfig {
return &systemconfigs.AdminUIConfig{
var config = &systemconfigs.AdminUIConfig{
ProductName: langs.DefaultMessage(codes.AdminUI_DefaultProductName),
AdminSystemName: langs.DefaultMessage(codes.AdminUI_DefaultSystemName),
ShowOpenSourceInfo: true,
@@ -117,6 +118,8 @@ func defaultAdminUIConfig() *systemconfigs.AdminUIConfig {
DefaultPageSize: 10,
TimeZone: nodeconfigs.DefaultTimeZoneLocation,
}
config.DNSResolver.Type = nodeconfigs.DNSResolverTypeDefault
return config
}
// 修改时区

View File

@@ -1,9 +1,9 @@
package teaconst
const (
Version = "1.3.6"
Version = "1.3.8"
APINodeVersion = "1.3.6"
APINodeVersion = "1.3.8"
ProductName = "Edge Admin"
ProcessName = "edge-admin"

View File

@@ -8,6 +8,7 @@ import (
teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const"
"github.com/TeaOSLab/EdgeAdmin/internal/events"
"github.com/TeaOSLab/EdgeAdmin/internal/utils"
"github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs"
"github.com/iwind/TeaGo"
"github.com/iwind/TeaGo/Tea"
"github.com/iwind/TeaGo/lists"
@@ -87,6 +88,9 @@ func (this *AdminNode) Run() {
// 启动API节点
this.startAPINode()
// 设置DNS相关
this.setupDNS()
// 启动IP库
this.startIPLibrary()
@@ -254,6 +258,33 @@ func (this *AdminNode) addPortsToFirewall() {
utils.AddPortsToFirewall(ports)
}
// 设置DNS相关
func (this *AdminNode) setupDNS() {
config, loadErr := configloaders.LoadAdminUIConfig()
if loadErr != nil {
// 默认使用go原生
err := os.Setenv("GODEBUG", "netdns=go")
if err != nil {
logs.Println("[DNS_RESOLVER]set env failed: " + err.Error())
}
return
}
var err error
switch config.DNSResolver.Type {
case nodeconfigs.DNSResolverTypeGoNative:
err = os.Setenv("GODEBUG", "netdns=go")
case nodeconfigs.DNSResolverTypeCGO:
err = os.Setenv("GODEBUG", "netdns=cgo")
default:
// 默认使用go原生
err = os.Setenv("GODEBUG", "netdns=go")
}
if err != nil {
logs.Println("[DNS_RESOLVER]set env failed: " + err.Error())
}
}
// 启动API节点
func (this *AdminNode) startAPINode() {
var configPath = Tea.Root + "/edge-api/configs/api.yaml"

View File

@@ -114,6 +114,8 @@ func (this *IndexAction) RunGet(params struct {
"autoInstallNftables": cluster.AutoInstallNftables,
"autoSystemTuning": cluster.AutoSystemTuning,
"autoTrimDisks": cluster.AutoTrimDisks,
"maxConcurrentReads": cluster.MaxConcurrentReads,
"maxConcurrentWrites": cluster.MaxConcurrentWrites,
"sshParams": sshParams,
"domainName": fullDomainName,
}
@@ -143,6 +145,8 @@ func (this *IndexAction) RunPost(params struct {
AutoInstallNftables bool
AutoSystemTuning bool
AutoTrimDisks bool
MaxConcurrentReads int32
MaxConcurrentWrites int32
Must *actions.Must
}) {
@@ -200,6 +204,8 @@ func (this *IndexAction) RunPost(params struct {
AutoSystemTuning: params.AutoSystemTuning,
AutoTrimDisks: params.AutoTrimDisks,
SshParamsJSON: sshParamsJSON,
MaxConcurrentReads: params.MaxConcurrentReads,
MaxConcurrentWrites: params.MaxConcurrentWrites,
})
if err != nil {
this.ErrorPage(err)

View File

@@ -81,6 +81,8 @@ func (this *CreateAction) RunPost(params struct {
AutoInstallNftables bool
AutoSystemTuning bool
AutoTrimDisks bool
MaxConcurrentReads int32
MaxConcurrentWrites int32
// DNS相关
DnsDomainId int64
@@ -151,6 +153,8 @@ func (this *CreateAction) RunPost(params struct {
AutoInstallNftables: params.AutoInstallNftables,
AutoSystemTuning: params.AutoSystemTuning,
AutoTrimDisks: params.AutoTrimDisks,
MaxConcurrentReads: params.MaxConcurrentReads,
MaxConcurrentWrites: params.MaxConcurrentWrites,
})
if err != nil {
this.ErrorPage(err)

View File

@@ -56,7 +56,7 @@ func (this *UpdateAction) RunGet(params struct {
{
_, ok := cachePolicy.Options["enableMMAP"]
if !ok {
cachePolicy.Options["enableMMAP"] = true
cachePolicy.Options["enableMMAP"] = false
}
}
}

View File

@@ -55,6 +55,7 @@ func (this *IndexAction) RunPost(params struct {
LogoFile *actions.File
DefaultPageSize int
TimeZone string
DnsResolverType string
SupportModuleCDN bool
SupportModuleNS bool
@@ -85,6 +86,7 @@ func (this *IndexAction) RunPost(params struct {
config.ShowVersion = params.ShowVersion
config.Version = params.Version
config.TimeZone = params.TimeZone
config.DNSResolver.Type = params.DnsResolverType
if params.DefaultPageSize > 0 {
config.DefaultPageSize = params.DefaultPageSize
@@ -111,10 +113,10 @@ func (this *IndexAction) RunPost(params struct {
this.ErrorPage(err)
return
}
fileId := createResp.FileId
var fileId = createResp.FileId
// 上传内容
buf := make([]byte, 512*1024)
var buf = make([]byte, 512*1024)
reader, err := params.FaviconFile.OriginFile.Open()
if err != nil {
this.ErrorPage(err)
@@ -158,10 +160,10 @@ func (this *IndexAction) RunPost(params struct {
this.ErrorPage(err)
return
}
fileId := createResp.FileId
var fileId = createResp.FileId
// 上传内容
buf := make([]byte, 512*1024)
var buf = make([]byte, 512*1024)
reader, err := params.LogoFile.OriginFile.Open()
if err != nil {
this.ErrorPage(err)

View File

@@ -344,10 +344,12 @@ func (this *MySQLInstaller) InstallFromFile(xzFilePath string, targetDir string)
// waiting for startup
for i := 0; i < 30; i++ {
_, err = net.Dial("tcp", "127.0.0.1:3306")
var conn net.Conn
conn, err = net.Dial("tcp", "127.0.0.1:3306")
if err != nil {
time.Sleep(1 * time.Second)
} else {
_ = conn.Close()
break
}
}

View File

@@ -126,6 +126,20 @@
<p class="comment">执行TRIM后可以移除SSD硬盘中无效的数据从而显著提升SSD硬盘写入性能。</p>
</td>
</tr>
<tr>
<td>节点I/O最大读并发数</td>
<td>
<input name="maxConcurrentReads" v-model="cluster.maxConcurrentReads" type="text" style="width: 5em" maxlength="4"/>
<p class="comment">0表示根据系统资源自动计算通常不需要修改请在专业人士指导下操作。</p>
</td>
</tr>
<tr>
<td>节点I/O最大写并发数</td>
<td>
<input name="maxConcurrentWrites" v-model="cluster.maxConcurrentWrites" type="text" style="width: 5em" maxlength="4"/>
<p class="comment">0表示根据系统资源自动计算通常不需要修改请在专业人士指导下操作。</p>
</td>
</tr>
</tbody>
</table>
<submit-btn></submit-btn>

View File

@@ -46,7 +46,7 @@
<td>回源主机名</td>
<td>
<input type="text" name="host" placeholder="比如example.com" maxlength="100"/>
<p class="comment">可选项。请求源站时的Host字段值用于设置访问源站的站点域名<span v-if="isHTTP">,支持请求变量</span></p>
<p class="comment">可选项。请求源站时的Host字段值用于设置访问源站的站点域名<span v-if="isHTTP">,支持请求变量</span>;如果用户访问的域名和源站域名不一致,请务必设置为源站域名</p>
</td>
</tr>

View File

@@ -73,7 +73,7 @@
<tr v-show="moreOptionsVisible && policyType == 'file'">
<td class="color-border">启用MMAP</td>
<td>
<checkbox name="enableMMAP" checked="checked"></checkbox>
<checkbox name="enableMMAP"></checkbox>
<p class="comment">选中后表示允许系统自动利用MMAP提升缓存读取性能。</p>
</td>
</tr>

View File

@@ -12,7 +12,7 @@ Tea.context(function () {
if (this.policyType == "file") {
let options = this.cachePolicy.options
if (options != null && typeof options == "object" && typeof options["dir"] === "undefined") {
options["enableMMAP"] = true
options["enableMMAP"] = false
options["dir"] = "/opt/cache"
options["memoryPolicy"] = {
capacity: {

View File

@@ -48,7 +48,7 @@
<td>回源主机名</td>
<td>
<input type="text" name="host" placeholder="比如example.com" maxlength="100"/>
<p class="comment">可选项。请求源站时的Host字段值用于设置访问源站的站点域名<span v-if="isHTTP">,支持请求变量</span></p>
<p class="comment">可选项。请求源站时的Host字段值用于设置访问源站的站点域名<span v-if="isHTTP">,支持请求变量</span>;如果用户访问的域名和源站域名不一致,请务必设置为源站域名</p>
</td>
</tr>

View File

@@ -49,7 +49,7 @@
<td>回源主机名</td>
<td>
<input type="text" name="host" v-model="origin.host" placeholder="比如example.com" maxlength="100"/>
<p class="comment">可选项。请求源站时的Host字段值用于设置访问源站的站点域名<span v-if="isHTTP">,支持请求变量</span></p>
<p class="comment">可选项。请求源站时的Host字段值用于设置访问源站的站点域名<span v-if="isHTTP">,支持请求变量</span>;如果用户访问的域名和源站域名不一致,请务必设置为源站域名</p>
</td>
</tr>

View File

@@ -109,7 +109,18 @@
</select>
</div>
</div>
<p class="comment">显示时间使用的时区。</p>
<p class="comment">当前管理系统显示时间使用的时区。</p>
</td>
</tr>
<tr>
<td>使用的DNS解析库</td>
<td>
<select class="ui dropdown auto-width" name="dnsResolverType" v-model="config.dnsResolver.type">
<option value="default">默认</option>
<option value="cgo">CGO</option>
<option value="goNative">Go原生</option>
</select>
<p class="comment">当前管理系统使用的DNS解析库修改此项配置后需要重启管理系统进程才会生效通常不需要修改如要修改请在专家指导下进行。</p>
</td>
</tr>
</table>