Nomad:raw_exec安装nginx

问题描述 投票:0回答:1

我想运行raw_exec来安装nginx,这可能吗?或只能由raw_exec做到这一点。因为此代码将不会启动/运行。

job "raw-exec" {
  datacenters = ["dc1"]
  type        = "service"

  group "exec" {
    count = 1

    update {
       max_parallel      = 1
       min_healthy_time  = "10s"
       healthy_deadline  = "5m"
       progress_deadline = "10m"
       auto_revert       = true
     }

    task "raw-exec-test" {
      driver = "raw_exec"

      config {
        command = "/bin/apt"
        args = ["-y", "install", "nginx.service"]
      }

      resources {
        cpu    = 100
        memory = 125
      }

    }
  }
}
nginx driver ubuntu-18.04 nomad
1个回答
0
投票

没有工作状态,很难解决问题。nomad job status raw-exec将显示您的工作状态。它还将显示作业创建的分配。您可以检查Nomad由nomad alloc status YOUR-ALLOC-ID创建的分配有什么问题(作业中的任务集应在特定节点上运行。)

我运行了以下Nomad作业规范,并且在我的MacBook上运行良好。我在一个终端窗口中使用nomad agent -dev来游牧,然后在另一个终端窗口中创建文件test.job,然后运行nomad job run test.job,它在MacBook上安装了htop软件。

job "raw-exec" {
  datacenters = ["dc1"]
  type        = "batch"

  group "exec" {
    count = 1

    task "raw-exec-test" {
      driver = "raw_exec"

      config {
        command = "brew"
        args = ["install", "htop"]
      }

      resources {
        cpu    = 100
        memory = 125
      }
    }
  }
}
© www.soinside.com 2019 - 2024. All rights reserved.