schedule

command module
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2022 License: BSD-3-Clause Imports: 5 Imported by: 0

README

Weplanx Schedule

GitHub go.mod Go version Go Report Card Release GitHub license

定时触发器

项目将以新的方式重新开发配套 weplanx ,新版本将以 v*.*.* 形式发布

部署服务

镜像源主要有:

  • ghcr.io/weplanx/schedule:latest
  • ccr.ccs.tencentyun.com/weplanx/schedule:latest(国内)

案例将使用 Kubernetes 部署编排,复制部署内容(需要根据情况做修改):

  1. 设置配置
apiVersion: v1
kind: ConfigMap
metadata:
  name: schedule.cfg
data:
  config.yml: |
    address: ":6000"
    tls: <TLS配置,非必须>
      cert:
      key:
    node: <节点标识>
    database:
      uri: mongodb://<username>:<password>@<host>:<port>/<database>?authSource=<authSource>
      name: <数据库名>
      collection: <默认集合>
    transfer:
      address: "transfer-svc:6000"
      topic: schedule
      tls:
        cert:
  1. 部署
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: schedule
  name: schedule-deploy
spec:
  selector:
    matchLabels:
      app: schedule
  template:
    metadata:
      labels:
        app: schedule
    spec:
      containers:
        - image: ccr.ccs.tencentyun.com/weplanx/schedule:latest
          imagePullPolicy: Always
          name: schedule
          ports:
            - containerPort: 6000
          volumeMounts:
            - name: config
              mountPath: "/app/config"
              readOnly: true
      volumes:
        - name: config
          configMap:
            name: schedule.cfg
            items:
              - key: "config.yml"
                path: "config.yml"
  1. 设置入口,服务网关推荐采用 traefik 做更多处理
apiVersion: v1
kind: Service
metadata:
  name: schedule-svc
spec:
  ports:
    - port: 6000
      protocol: TCP
  selector:
    app: schedule

滚动更新

复制模板内容,并需要自行定制触发条件,原理是每次patch将模板中 ${tag} 替换为版本执行

spec:
  template:
    spec:
      containers:
        - image: ccr.ccs.tencentyun.com/weplanx/schedule:${tag}
          name: schedule

例如:在 Github Actions 中 patch deployment schedule-deploy --patch "$(sed "s/\${tag}/${{steps.meta.outputs.version}}/" < ./config/patch.yml)",国内可使用Coding持续部署云效流水线等。

License

BSD-3-Clause License

FOSSA Status

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL