在代码库中启动、停止和管理微服务
adscli的Python项目详细描述
概述
微服务很好,但是在你的开发框上运行它们很烦人。 每一个都有自己的命令来启动和停止、检查状态以及如何 你应该知道原木在哪里吗?
ads通过要求每个参与服务公开 最常见命令的简单统一接口:start、stop, 状态和日志位置。
要使用ADS,请在每个服务的目录中放置一个名为 ads.yml 的文件:
start_cmd: gradle run > obscure/logs/dir/out & # ads can be used with any build system - cmds are just bash stop_cmd: pgrep -f ninja-service | xargs kill -9 # Still the most reliable way to kill a process status_cmd: pgrep -f ninja-service # Exit status indicates whether any process matched log_paths: - obscure/logs/dir/* - even/more/secret/logs/dir/**/ninja.log # Note the glob support description: Web service that turns your ordinary app into badass rockstart tech. # Optional but a good idea
还有一些字段,但这将帮助您开始。
在 代码库:
# Actually, you don't need to put anything in it yet. # The existence of the file is sufficient.
现在你可以在代码库的任何地方运行广告 服务。
$ cd /anywhere/in/codebase $ ads list ninja: Web service that turns your ordinary app into badass rockstart tech.
一旦你"广告化"了一系列的服务,广告就会使它真正 方便一次操作多个。
$ ads status --- db: not running --- ninja: not running --- pirate: not running $ ads up ninja pirate --- Starting [ninja, pirate] --- Starting ninja --- Starting pirate