sitegeist / scentmark
v3.0.0
2024-06-18 12:19 UTC
Requires
- php: >= 8.1
- neos/flow: ~8.3 || dev-master
This package is auto-updated.
Last update: 2024-09-18 12:45:22 UTC
README
通过CLI在Neos上标记和嗅探。这可以帮助在集群环境中协调任务,在这些环境中,某些任务(如缓存刷新或静态资源的发布)只能在新部署的应用版本的第一个容器或仅在一个容器上执行。
注意:这与sitegeist/treasuremap包配合良好,该包实现了绿色/蓝色缓存,但也可以用于其他目的。
使用方法
该包包含三个CLI命令
./flow scentmark:mark
Mark the current deployment with the pack scent.
COMMAND:
sitegeist.scentmark:scentmark:mark
USAGE:
./flow scentmark:mark <pack scent>
ARGUMENTS:
--pack-scent
DESCRIPTION:
Returns status code 0 if the pack was new and successfully marked
Returns status code 1 if the pack was already known beforehand
./flow scentmark:bark
Select pack leader by passing packScent and leaderScent. If no leader is currently elected the first one asking
COMMAND:
sitegeist.scentmark:scentmark:bark
USAGE:
./flow scentmark:bark <pack scent> <leader scent>
ARGUMENTS:
--pack-scent
--leader-scent
DESCRIPTION:
for the role is granted leader status for one hour
Returns status code 0 if the $packScent and $leaderScent match and the current pod is considered leader for a time
Returns status code 1 if the current pod is not the leader for now
./flow scentmark:cleanup
Remove the oldest packs but keep a specified number of items
COMMAND:
sitegeist.scentmark:scentmark:cleanup
USAGE:
./flow scentmark:cleanup <keep>
ARGUMENTS:
--keep
示例
在新发布的第一容器上运行作业
start.sh
// check wether a release (pack) with the given scent is already known ./flow scentmark:mark $APP_VERSION // tasks to run on the first pod/container of a release (pack) if [ $? -eq 0 ]; then // flush caches ... ensure they are configured with green / blue backends fi
在发布的单个容器(pack leader)上运行作业
cron.sh
// check wether the current pod is pack leader or can be promoted to lead status ./flow scentmark:bark $APP_VERSION $POD_ID // tasks to run on eacatly one container only if [ $? -eq 0 ]; then // flush caches ... ensure they are configured with green / blue backends fi
作者和赞助商
- Martin Ficzel - ficzel@sitegeist.de
- Melanie Wüst - wuest@sitegeist.de
本包的开发和公开发布得到了我们雇主http://www.sitegeist.de的慷慨赞助。
安装
Sitegeist.ScentMark通过packagist提供。运行composer require sitegeist/scentmark
来要求此包。
我们使用语义版本控制,因此每次重大更改都会增加主版本号。
贡献
我们乐于接受贡献。请发送给我们拉取请求。