【问题标题】:Progressive migration from delayed_job to Sidekiq wents messy by require Ruby file从 delayed_job 到 Sidekiq 的渐进式迁移因需要 Ruby 文件而变得混乱
【发布时间】:2023-01-31 18:42:59
【问题描述】:

我正在尝试从 Delayed_Job 迁移到 Sidekiq。通过在 kubernetes 中运行 Sidekiq,出现了一个无法识别的错误:

==================================================================
  Please point Sidekiq to a Rails application or a Ruby file  
  to load your job classes with -r [DIR|FILE].
==================================================================

Kubernetes 部署 SN-P:

      ...
      containers:
        - name: sidekiq
          image: {{ application_registry }}
          imagePullPolicy: Always
          command:
            - bundle
          args:
            - exec
            - sidekiq
            - -r # not included in the original setting.
            - /app/config/application.rb # not included in the original setting.
            - "-C"
            - "/app/config/sidekiq.yml"
          resources:
            ...

PS:很多现有的作业仍然放在 DelayJob 上,一些我们计划逐步迁移。所以我们在每个作业中包含 Sidekiq,而不是在全局范围内:

class FirstJob < ApplicationJob
      self.queue_adapter = :sidekiq

      ...

按照Here 描述的一些指南进行操作。我试图在 -r 标志下要求 config/application.rb,但没有修复。

【问题讨论】:

    标签: ruby-on-rails kubernetes sidekiq


    【解决方案1】:

    摆脱

            - -r # not included in the original setting.
            - /app/config/application.rb # not included in the original setting.
            - "-C"
            - "/app/config/sidekiq.yml"
    

    您需要将当前工作目录设置为/app。

    【讨论】:

    • 嗨,我仍然阻止了同样的错误。我所做的任何更改都不会影响失败的情况。我试图从 K8t 文件中删除这一行。并将 workingDir 提到 /app。但仍然失败。
    【解决方案2】:

    最后,我通过为 sidekiq.yml 配置文件安装不同的卷来完成此操作。

    ...
    command:
      - bundle
    args:
      - exec
      - sidekiq
      - "-C"
      - "/config/sidekiq.yml"
    ...
    volumeMounts:
      - name: sidekiq-yml
        mountPath: /config
    

    【讨论】:

      猜你喜欢
      • 2018-05-05
      • 1970-01-01
      • 1970-01-01
      • 2014-02-09
      • 1970-01-01
      • 1970-01-01
      • 2016-09-15
      • 2017-12-15
      相关资源
      最近更新 更多