question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[RFC] egg-scripts proposals

See original GitHub issue

https://github.com/eggjs/egg/issues/241 太长了,重开一个,讨论第一期的实现方案。

仅提供 egg-scripts startegg-scripts stop 几条最基础的线上指令。 而看了下原内网的实现,会比较依赖于环境变量,本方案更倾向于用 cli options 的方式

原提案点击此处, 以下正文更新为讨论后的:

start

$ egg-scripts start [baseDir] --port=7001 --env=prod --workers=2 --no-daemon

description :

  • master 进程上提供 egg-server 之类的关键词,用于 grep

** arguments: **

  • baseDir 为应用的根目录,可选,默认为 process.cwd(),支持相对路径

options :

  • port 为端口,可选,默认为 7001,不做冲突自动更换端口。
  • env 为运行环境,可选,默认为 prod
    • 大小写不敏感,内部会统一转换为小写
    • 环境变量取值顺序 env 传值 -> EGG_SERVER_ENV 环境变量 -> 默认值 prod
  • workers 配置 workers 个数
  • no-daemon 配置该参数则在前台运行
  • framework 框架名,一般不需要填,自动检测
  • title 关键词,用于 grep,默认为 egg-server-APPNAME

stop

$ egg-scripts stop [baseDir]

description :

  • 找到指定目录下的 egg master 进程,并 kill 掉
  • 在 5s 后,寻找没有被 egg master 优雅退出的 worker/agent 进程,kill -9(虽然 egg-cluster 已经有处理了)

arguments :

  • baseDir 为应用的根目录,可选,默认为 process.cwd()

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:41 (41 by maintainers)

github_iconTop GitHub Comments

1reaction
fengmk2commented, Feb 28, 2017

TERM 必然是进程退出了,要不然都不加stop了。真的不要做这么复杂,这里只做2件事情。其它都不是它负责的。

cluster兼容没必要做,有workers参数足够了

1reaction
fengmk2commented, Feb 27, 2017

npm scripts: “start”: “egg-scripts start --prod=env” 但临时用 EGG_SERVER_ENV=test npm start

加一个 start-test: "egg-scripts start --env=test"

Read more comments on GitHub >

github_iconTop Results From Across the Web

Proposal for a staged RFC process - Baby Steps
This proposal represents an alternate take on the RFC process, drawing on some ideas from the TC39 process, but adapting them to Rust's ......
Read more >
egg-scripts - npm
Start using egg-scripts in your project by running `npm i egg-scripts`. There are 130 other projects in the npm registry using egg-scripts.
Read more >
Dependencies | beidou-example-with-react-loadable | npm
arrow_right babel‑eslint. 8.2.6 Notes Relation Licenses Dep... Version 8.2.6 Published Description arrow_right babel‑plugin‑dynamic‑import‑node. 1.2.0 Notes Relation Licenses Dep... Version 1.2.0 Published Description
Read more >
History.md · Gitee 极速下载/eggjs - Gitee.com
add lifecycle doc; add sequelize guide; add allowDebugAtProd in document; egg-scripts support windows; schedule add env description; more document and ...
Read more >
2014-August.txt - Python mailing list
... in this document are to be interpreted as described in RFC 2119. ... [Distutils] windows permissions on bdist egg scripts, data?
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found