fetchq-cron 基于webhook 的任务调度工具
fetchq-cron是基于nodejs+pg+webhook 的任务调度工具,使用上简单、灵活,提供了api以及openapi
是一个很不错的工具,同时对于调度支持基于延迟的以及基于cron 表达式的,同时包含了一个ui(目前比较简单)
以下是基于docker-compose 的运行
docker镜像
基于官方的dockerfile,基于多阶段构建,docker hub 为dalongrong/fetchq-cron:0.0.1
#
# Build Production Artifacts
# ==========================================
#
# this first step takes in the source files and build the artifacts
# (basicall all that need to be transpiled).
#
# We do install the NPM dependencies twice so to copy over to the
# production image only what is strictly needed to execute our app.
#
# NPM Install is the first step so to exploit Docker's cache mechanism
# and speed up the building process. We will re-install from NPM only
# if we touch the `package.json` file.
#
# Which doesn't happen so often.
# Hopefully.
#
FROM node:13.10-alpine AS builder
RUN npm config set registry https://registry.npm.taobao.org
# NPM Install for building
WORKDIR /usr/src/app-build
ADD package.json /usr/src/app-build
ADD package-lock.json /usr/src/app-build
RUN npm install --only=production
# Copy source files:
WORKDIR /usr/src/app-build
ADD src /usr/src/app-build/src
ADD public /usr/src/app-build/public
# Build:
WORKDIR /usr/src/app-build
RUN npm run build
# Remove dev dependencies
RUN npm prune --production
#
# Runner Image
# ==========================================
#
# In this step we start over with a fresh image and copy only what is
# strictly necessary in order to run a production build.
#
# The idea is to keep this image as small as possible.
#
FROM node:13.10-alpine AS runner
# Copy project specific assets:
WORKDIR /usr/src/app
COPY --from=builder /usr/src/app-build/node_modules ./node_modules
COPY --from=builder /usr/src/app-build/build ./build
ADD ssr /usr/src/app/ssr
# Default environment configuration:
EXPOSE 8080
ENV NODE_ENV=production
WORKDIR /usr/src/app
CMD node ssr/index.js
docker-compose 环境准备
因为fetchq-cron依赖pg,同时为了测试webhook,使用了benthos
version: "3"
services:
webhook:
image: jeffail/benthos
volumes:
- "./webhook.yaml:/benthos.yaml"
ports:
- "4195:4195"
postgres:
image: postgres:11.5
ports:
- 5432:5432
fetch-cron:
image: dalongrong/fetchq-cron:0.0.1
ports:
- "8080:8080"
environment:
- "DATABASE_URL=postgres://postgres@postgres:5432/postgres"
- webhook 配置
input:
type: broker
broker:
inputs:
- type: http_server
http_server:
path: /
processors:
- type: text
text:
operator: prepend
value: "get message: "
output:
type: stdout
启动&&测试
- 启动
docker-compose up -d
- 效果
- 创建任务
- 运行效果
docker-compose logs -f webhook
说明
fetchq-cron 是一个很不错的基于webhook 的任务工具,很多时候我们可以基于adnanh webhook 或者demo 中使用的工具,提供一个简单但是比较方便的任务
调度系统
参考资料
https://github.com/marcopeg/fetchq-cron
https://github.com/rongfengliang/fetchq-cron-docker-compose-learning
https://github.com/adnanh/webhook/
https://github.com/Jeffail/benthos
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
2019-04-04 使用deb 打包开发的postgres extension 另外一种方法
2019-04-04 使用deb 打包开发的postgres extension
2019-04-04 ubuntu deb pacakge 开发
2019-04-04 What’s New In GRANDstack?
2017-04-04 lua resty template && openresty 使用
2017-04-04 jekyll 安装使用