Skip to content

[Feature] 不以服务启动,通过命令行运行工作流 #736

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

Open
1 task
gyf9835 opened this issue May 28, 2025 · 8 comments
Open
1 task

[Feature] 不以服务启动,通过命令行运行工作流 #736

gyf9835 opened this issue May 28, 2025 · 8 comments
Labels
backlog Todo enhancement New feature or request

Comments

@gyf9835
Copy link

gyf9835 commented May 28, 2025

功能描述 / Description

通过命令行运行指定/全部工作流,不启动web服务,运行完成后退出

请求动机 / Motivation

经测试本应用运行时占用内存大约为200MB,而证书更新间隔时间相对较长,个人认为长时间将certimate作为服务运行有些浪费内存,200MB虽然不是很大,但是对于一些路由器/共享vps来说还是有一定压力的。所以希望推出一个不启动服务,只通过命令行运行指定/全部工作流的功能,或者将web服务与核心功能分开(通过单页面应用和api来控制核心服务)。在需要配置工作流时启动web,平时通过系统cron调用工作流,能极大地减少资源占用,拓展应用场景

其他 / Miscellaneous

No response

贡献 / Contribution

  • 我乐意为此贡献代码! / I am interested in contributing to this issue!
@gyf9835 gyf9835 added the enhancement New feature or request label May 28, 2025
@fudiwei fudiwei added the backlog Todo label May 28, 2025
@fondoger
Copy link
Contributor

fondoger commented May 28, 2025

你试试限制一下Golang的内存大小呢?比如设置为64MB或者32MB,我理解应该也能正常运行。
加一个环境变量:GOMEMLIMIT

PS: 我使用Docker部署最新版,才不到40MB内存。

Image

@usual2970
Copy link
Owner

你好,你使用的哪个版本、哪种部署方式?

@gyf9835
Copy link
Author

gyf9835 commented May 28, 2025

你试试限制一下Golang的内存大小呢?比如设置为64MB或者32MB,我理解应该也能正常运行。 加一个环境变量:GOMEMLIMIT

LXC-network:~/certimate# export GOMEMLIMIT=64MiB
LXC-network:~/certimate# GOMEMLIMIT=64MiB ./certimate serve
2025/05/28 17:02:40 INFO [CERTIMATE] Visit the website: http://127.0.0.1:8090

  PID   VSZ^VSZRW^  RSS (SHR) DIRTY (SHR) STACK COMMAND
 7747 1385m 51104  197m     4  197m     0   132 ./certimate serve

试了不太行,占用内存没有变化
昨天第一次尝试certimate在一个128MB的LXC alpine中运行失败,所以大概无法以较低内存稳定运行 #730


你好,你使用的哪个版本、哪种部署方式?

0.3.14,二进制安装在一个LXC alpine中,alpine版本:3.21.3

@usual2970
Copy link
Owner

@fudiwei

二进制包体积优化负优化了😂

upx压缩的包运行方式是:解压到内存中运行,导致内存占用变大了。Certimate实际占用20M左右,比起内存硬盘多占用一点就无所谓了。

@fudiwei
Copy link
Collaborator

fudiwei commented May 28, 2025

@fudiwei

二进制包体积优化负优化了😂

upx压缩的包运行方式是:解压到内存中运行,导致内存占用变大了。Certimate实际占用20M左右,比起内存硬盘多占用一点就无所谓了。

先注释掉吧 😂

@gyf9835
Copy link
Author

gyf9835 commented May 28, 2025

哈哈哈哈,我为了减少资源占用特意用了二进制文件没用docker,反倒占用更多了

那这个feature还要考虑吗?感觉和刚开的 #733 类似

@fudiwei
Copy link
Collaborator

fudiwei commented May 28, 2025

哈哈哈哈,我为了减少资源占用特意用了二进制文件没用docker,反倒占用更多了

那这个feature还要考虑吗?感觉和刚开的 #733 类似

这个需求提得挺好的 👍,跟 #733 也不冲突,他这个是希望提供 HTTP API 接口,你的是通过 CLI。

先在需求池里留着吧。不过优先级不高,短期内可能没办法实现。

@lisinloft
Copy link

lisinloft commented Jun 11, 2025

我是在openwrt上部署的二进制文件3.14,内存在脚本里限制为512M,实际运行后,占用69%,大概202M。
我一直没注意可执行文件从3.14后激增,今天在手动更新3.17文件的时候才猛然发现的,找到这里,留个言说下我的运行情况,可能会成为一个参考,最后谢谢开发者的程序,很好用,加油~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Todo enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants