几个不错的golang 应用升级以及平滑启动包
在日常的应用开发中我们我们很多时候都需要处理软件的升级以及滚动式升级,基于.net 应用clickonce 以及微软的updte框架都
是一个不错的选择对于nodejs 的electron我们有electron-updater ,同时好多桌面应用的开发也会设计自己的更新程序,以下是
关于golang 应用升级的几个不错的包
几个参考
- go-selfupdate
基于bsdiff 算法
参考资料 https://github.com/sanbornm/go-selfupdate - overseer
参考资料 https://github.com/jpillora/overseer - go-update
参考资料 https://github.com/inconshreveable/go-update - go-tuf
基于tuf 框架的实现,参考https://github.com/flynn/go-tuf
https://github.com/jpillora/overseer
说明
从安全以及规范角度来说使用tuf 框架的实现会比较好,以上介绍的几个都是不错的选择,应该还会有其他的选择,以上几个是目前发现
几个不错的选择,实际上设计一个完全可以自动升级以及平滑重启的服务是有好多知识点,需要很好的处理系统的信号以及对于业务关联操
作的评估。以上中overseer 使用相对比较简单,一个参考demo
main.go
package main
import (
"fmt"
"log"
"net/http"
"time"
"github.com/jpillora/overseer"
"github.com/jpillora/overseer/fetcher"
)
//create another main() to run the overseer process
//and then convert your old main() into a 'prog(state)'
func main() {
overseer.Run(overseer.Config{
Program: prog,
Address: ":3000",
Fetcher: &fetcher.HTTP{
URL: "http://localhost:8080/binaries/myapp",
Interval: 1 * time.Second,
},
Debug: true,
})
}
//prog(state) runs in a child process
func prog(state overseer.State) {
log.Printf("app (%s) listening...", state.ID)
http.Handle("/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, " demo app app (%s) says hello\n", state.ID)
}))
http.Serve(state.Listener, nil)
}
参考资料
https://theupdateframework.com/
http://www.daemonology.net/bsdiff/
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
2019-07-02 nexus 3.17.0 简单试用
2019-07-02 nexus 3.17.0 简单说明
2019-07-02 Building a Service Mesh with HAProxy and Consul
2019-07-02 Using HAProxy as an API Gateway, Part 3 [Health Checks]
2019-07-02 Using HAProxy as an API Gateway, Part 2 [Authentication]
2019-07-02 Using HAProxy as an API Gateway, Part 1 [Introduction]
2019-07-02 cjss 像编写css 一样开发web应用