几个不错的golang 应用升级以及平滑启动包

在日常的应用开发中我们我们很多时候都需要处理软件的升级以及滚动式升级,基于.net 应用clickonce 以及微软的updte框架都
是一个不错的选择对于nodejs 的electron我们有electron-updater ,同时好多桌面应用的开发也会设计自己的更新程序,以下是
关于golang 应用升级的几个不错的包

几个参考

说明

从安全以及规范角度来说使用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/

posted on   荣锋亮  阅读(3171)  评论(0编辑  收藏  举报

编辑推荐:
· 记一次.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应用

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示