🐛 fix: 修复 Windows Agent 启动问题,需人工下载更新

This commit is contained in:
naiba 2021-01-19 11:10:32 +08:00
parent d7a3ba607b
commit c3cdf46ae3
5 changed files with 31 additions and 26 deletions

View File

@ -77,6 +77,11 @@
```
</details>
<details>
<summary>计划任务:备份脚本、服务重启,等定期运维任务。</summary>
使用此功能可以定期结合 restic、rclone 给服务器备份,或者定期某项重启服务来重置网络连接。
</details>
<details>
<summary>报警通知CPU、内存、硬盘、带宽、流量实时监控。</summary>
@ -205,16 +210,13 @@ URL 里面也可放置占位符,请求时会进行简单的字符串替换。
## 变更日志
最新:`dashboard 0.3.0` `agent 0.3.0`,只记录最后一次更新导致必须更新面板的说明。
只保留最后一次更新导致必须更新面板的说明。
- `agent 0.3.1`
- 0.3.0 的更新的一个问题导致 Windows 用户的 Agent 无法自动更新,需要下载 0.3.1 或更新的 release 手动替换掉二进制文件。
- 增加了对 mips(路由器) 的支持,在 release 处下载后手动配置
- `dashboard 0.3.0` `agent 0.3.0` **重大更新**
增加了定时任务功能,可以定时在 Agent 上执行脚本(应用于定期备份、重启服务等计划运维场景)
- `dashboard 0.2.0` `agent 0.2.0` **重大更新**
增加了服务监控TCP端口延迟、Ping、HTTP-SSL 证书)功能,此版本 Agent 与旧面板不兼容,而 Agent 是通过 GitHub Release 自动更新的 所以务必更新面板开启最新功能。
- `0.1.23` 新增 IP 变更通知功能
在后台设置界面启用。

View File

@ -5,6 +5,7 @@ import (
"time"
"github.com/patrickmn/go-cache"
"github.com/robfig/cron/v3"
"gorm.io/driver/sqlite"
"gorm.io/gorm"
@ -17,8 +18,17 @@ import (
)
func init() {
var err error
shanghai, err := time.LoadLocation("Asia/Shanghai")
if err != nil {
panic(err)
}
// 初始化 dao 包
dao.Conf = &model.Config{}
dao.Cron = cron.New(cron.WithLocation(shanghai))
dao.Crons = make(map[uint64]*model.Cron)
dao.ServerList = make(map[uint64]*model.Server)
err = dao.Conf.Read("data/config.yaml")
if err != nil {
panic(err)
@ -31,6 +41,7 @@ func init() {
dao.DB = dao.DB.Debug()
}
dao.Cache = cache.New(5*time.Minute, 10*time.Minute)
initSystem()
}

2
go.mod
View File

@ -14,7 +14,7 @@ require (
github.com/gorilla/websocket v1.4.2
github.com/onsi/ginkgo v1.7.0 // indirect
github.com/onsi/gomega v1.4.3 // indirect
github.com/p14yground/go-github-selfupdate v0.0.0-20201212172144-81a03b17860d
github.com/p14yground/go-github-selfupdate v1.2.3-0.20210119020835-db3523c6834b
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/robfig/cron/v3 v3.0.1
github.com/shirou/gopsutil/v3 v3.20.11

11
go.sum
View File

@ -263,8 +263,8 @@ github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W
github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/p14yground/go-github-selfupdate v0.0.0-20201212172144-81a03b17860d h1:ai2qidqUoF21+yU2Wuf7xpeKX3GgmxorX1zVxqzErG0=
github.com/p14yground/go-github-selfupdate v0.0.0-20201212172144-81a03b17860d/go.mod h1:7y6sHyZEF3inm1D+kaS5R72hbYgmhNJffyEEEJIplfk=
github.com/p14yground/go-github-selfupdate v1.2.3-0.20210119020835-db3523c6834b h1:jZAmPgstP0RHusZs3uOAL/xbz0IjRb7k0INXFHmf50s=
github.com/p14yground/go-github-selfupdate v1.2.3-0.20210119020835-db3523c6834b/go.mod h1:unC1eanNdTd2fUViujtg9cDR/jNnYNvGmFYjIXz1hK4=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
@ -332,8 +332,8 @@ github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVM
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
github.com/ulikunitz/xz v0.5.5 h1:pFrO0lVpTBXLpYw+pnLj6TbvHuyjXMfjGeCwSqCVwok=
github.com/ulikunitz/xz v0.5.5/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8=
github.com/ulikunitz/xz v0.5.9 h1:RsKRIA2MO8x56wkkcd3LbtcE/uMszhb6DpRf+3uwa3I=
github.com/ulikunitz/xz v0.5.9/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
@ -458,6 +458,7 @@ golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@ -487,6 +488,8 @@ golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=

View File

@ -3,7 +3,6 @@ package dao
import (
"sort"
"sync"
"time"
"github.com/patrickmn/go-cache"
"github.com/robfig/cron/v3"
@ -37,16 +36,6 @@ var Cron *cron.Cron
var Version = "v0.3.0"
func init() {
shanghai, err := time.LoadLocation("Asia/Shanghai")
if err != nil {
panic(err)
}
Cron = cron.New(cron.WithLocation(shanghai))
Crons = make(map[uint64]*model.Cron)
ServerList = make(map[uint64]*model.Server)
}
func ReSortServer() {
ServerLock.RLock()
defer ServerLock.RUnlock()