【问题标题】:Waiting on Nomad server在 Nomad 服务器上等待
【发布时间】:2018-06-03 05:24:40
【问题描述】:

我目前正在尝试使用 Nomad 构建一些集成测试。

为此我尝试:

nomad agent -dev -config=test.conf&
nomad run test.nomad

这当然会失败,因为它会在服务器运行之前尝试提交作业。 不好的选择是插入睡眠。 我的问题是,是否有更好的方法来等待服务器启动并接受作业。

【问题讨论】:

    标签: nomad


    【解决方案1】:

    所以一个半途而废的解决方案是:

    wait_for_agent() {
      while test -z $(curl -s http://127.0.0.1:4646/v1/agent/health)
      do
        sleep 1
      done
    }
    

    【讨论】:

      【解决方案2】:

      另一个 hack :-)

      nomad agent -dev -config=test.conf && nomad run test.nomad
      

      【讨论】:

        猜你喜欢
        • 2015-05-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-10-25
        • 2021-04-21
        • 1970-01-01
        • 2017-06-28
        • 1970-01-01
        相关资源
        最近更新 更多