Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

为什么不提供各主流平台的二进制可执行文件呢? #12

Open
m2acgi opened this issue Aug 22, 2022 · 12 comments
Open

为什么不提供各主流平台的二进制可执行文件呢? #12

m2acgi opened this issue Aug 22, 2022 · 12 comments

Comments

@m2acgi
Copy link

m2acgi commented Aug 22, 2022

为什么不提供各主流平台的二进制可执行文件呢?go 交叉编译很容易的吧. rpm 只能 RedHat 系。

@apptut
Copy link
Contributor

apptut commented Aug 22, 2022

@m2acgi 感谢反馈,由于项目架构是cs架构,需要编译2个二进制文件,一个配置文件,还有自动补全脚本,以及系统常驻进程service配置,打包成一个rpm包方便软件分发部署。制作二进制很容易;但软件本身也需要作为常驻进程维护起来,这样才能高可用。如有需要可自行编译,另外项目使用了glibc底层库,所以go交叉编译会有问题,目前主要是精力有限,暂只提供RedHat系。

@m2acgi
Copy link
Author

m2acgi commented Aug 22, 2022

感谢大佬回复。我是 pm2 用户,systemd 配置太麻烦了,所以用 pm2 来跑各种命令和脚本,查看日志也很方便。但是 pm2 没有提供二进制可执行文件,需要安装 nodejs, 对于我的场景太重了,希望找个 go 或者 rust 实现的 pm2 类似的进程管理。之所以找用 go 或者 rust 实现的,是因为相比较其它语言开发出来的程序,较轻量级,并且几乎无依赖,单文件可执行。但是把 go 程序打包为 rpm 这个用法很少见,go 程序一般提供各个平台的二进制可执行文件下载直接使用。

@m2acgi m2acgi closed this as completed Aug 22, 2022
@m2acgi m2acgi reopened this Aug 22, 2022
@m2acgi
Copy link
Author

m2acgi commented Aug 22, 2022

如果这个项目能实现 pm2 的进程管理功能,能提供各个平台的单个预编译二进制可执行文件的话,应该会很受欢迎。现在市面上我几乎没有找到这种轻量级的还在维护的工具。一台服务器上若干个脚本加上若干条需要开机启动的命令行,如果用 systemd 管理太麻烦了。

@apptut
Copy link
Contributor

apptut commented Aug 23, 2022

@m2acgi 二进制包本身也需要自启动维护。估计需要1、2、3步骤进行部署,不如rpm方便,考虑到你的需求,接下来我们制作一下。

@m2acgi
Copy link
Author

m2acgi commented Aug 23, 2022

我用过很多 go 开发的工具都是单文件的,比如 k0s. 使用时也支持安装为服务等。不知道他们是怎么处理的。

@apptut
Copy link
Contributor

apptut commented Aug 23, 2022

好的,我们评估一下。

@m2acgi
Copy link
Author

m2acgi commented Aug 23, 2022

👍 期待尽快用上大佬改进的版本

@apptut
Copy link
Contributor

apptut commented Aug 23, 2022

@m2acgi 看了下 k0s,它应该是在启动时有语法糖,当运行某个子命令时,会自动把自己配置到systemd中:https://docs.k0sproject.io/v1.23.6+k0s.2/install/#install-k0s

The k0s install sub-command installs k0s as a system service on the local host that is running one of the supported init systems: Systemd or OpenRC. You can execute the install for workers, controllers or single node (controller+worker) instances.

@m2acgi
Copy link
Author

m2acgi commented Aug 23, 2022

k0s 不仅可以创建 systemd service 文件,在执行不同的命令时还能释放其它可执行文件至对应的目录。我用过别的 go 程序很多也是这么弄的。而且有些 go 程序就完全是内置的,没有释放文件出来,比如 frp, 它自带了一个 web admin, 也是一个单可执行文件,也不知道是怎么实现的。

@huoxue1
Copy link

huoxue1 commented Jan 16, 2023

k0s 不仅可以创建 systemd service 文件,在执行不同的命令时还能释放其它可执行文件至对应的目录。我用过别的 go 程序很多也是这么弄的。而且有些 go 程序就完全是内置的,没有释放文件出来,比如 frp, 它自带了一个 web admin, 也是一个单可执行文件,也不知道是怎么实现的。

go1.17版本不是加了哪个embed功能嘛,可以直接把静态文件一起打包,在之前好像也有三方打包静态文件之类的

@apptut
Copy link
Contributor

apptut commented Jan 17, 2023

感谢反馈。更希望来个pr,一起参与。

@huoxue1
Copy link

huoxue1 commented Jan 17, 2023

https://github.com/huoxue1/pmon2/releases/tag/v1.12.2

已经实现了自动打包,但是sqlite那个驱动有点问题,等我调整一下就pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants