github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/demo/csi/portworx-csi-plugin/portworx-csi-plugin.hcl (about)

     1  job "portworx" {
     2    type        = "service"
     3    datacenters = ["dc1"]
     4  
     5    group "portworx" {
     6      count = 3
     7  
     8      constraint {
     9        operator = "distinct_hosts"
    10        value    = "true"
    11      }
    12  
    13      # restart policy for failed portworx tasks
    14      restart {
    15        attempts = 3
    16        delay    = "30s"
    17        interval = "5m"
    18        mode     = "fail"
    19      }
    20  
    21      # how to handle upgrades of portworx instances
    22      update {
    23        max_parallel     = 1
    24        health_check     = "checks"
    25        min_healthy_time = "10s"
    26        healthy_deadline = "5m"
    27        auto_revert      = true
    28        canary           = 0
    29        stagger          = "30s"
    30      }
    31  
    32      network {
    33        port "portworx" {
    34          static = "9015"
    35        }
    36      }
    37  
    38      task "px-node" {
    39        driver       = "docker"
    40        kill_timeout = "120s"    # allow portworx 2 min to gracefully shut down
    41        kill_signal  = "SIGTERM" # use SIGTERM to shut down the nodes
    42  
    43        # consul service check for portworx instances
    44        service {
    45          name = "portworx"
    46          check {
    47            port     = "portworx"
    48            type     = "http"
    49            path     = "/health"
    50            interval = "10s"
    51            timeout  = "2s"
    52          }
    53        }
    54  
    55        # setup environment variables for px-nodes
    56        env {
    57          AUTO_NODE_RECOVERY_TIMEOUT_IN_SECS = "1500"
    58          PX_TEMPLATE_VERSION                = "V4"
    59          CSI_ENDPOINT                       = "unix://var/lib/osd/csi/csi.sock"
    60        }
    61  
    62        csi_plugin {
    63          id        = "portworx"
    64          type      = "monolith"
    65          mount_dir = "/var/lib/osd/csi"
    66        }
    67  
    68        # container config
    69        config {
    70          image        = "portworx/oci-monitor:2.8.0"
    71          network_mode = "host"
    72          ipc_mode     = "host"
    73          privileged   = true
    74  
    75          args = [
    76            "-c", "px-cluster-nomadv1",
    77            "-a",
    78            "-b",
    79            "-k", "consul://127.0.0.1:8500",
    80            "--endpoint", "0.0.0.0:9015"
    81          ]
    82  
    83          volumes = [
    84            "/var/cores:/var/cores",
    85            "/var/run/docker.sock:/var/run/docker.sock",
    86            "/run/containerd:/run/containerd",
    87            "/etc/pwx:/etc/pwx",
    88            "/opt/pwx:/opt/pwx",
    89            "/proc:/host_proc",
    90            "/etc/systemd/system:/etc/systemd/system",
    91            "/var/run/log:/var/run/log",
    92            "/var/log:/var/log",
    93            "/var/run/dbus:/var/run/dbus"
    94          ]
    95        }
    96  
    97        # resource config
    98        resources {
    99          cpu    = 1024
   100          memory = 2048
   101        }
   102      }
   103    }
   104  }