Nomad-Consul Semver Issue

job "mongodb-db" {
  datacenters = ["dc1"]
  type        = "service"

  group "mongodb" {
    count = 1

    network {
      port "mongodb" {
        static = 27017
        to     = 27017
      }
    }
    
      service {
        name = "mongodb"
        port = "mongodb"

        check {
          type     = "tcp"
          port     = "mongodb"
          interval = "10s"
          timeout  = "2s"
        }
      }

    task "mongodb" {
      driver = "docker"
      
       env = {
          MONGO_INITDB_ROOT_USERNAME = "admin"
          MONGO_INITDB_ROOT_PASSWORD = "adminpass"
          MONGO_INITDB_DATABASE      = "mydatabase"
          MONGO_INITDB_USERNAME      = "myuser"
          MONGO_INITDB_PASSWORD      = "mypassword"
       }

      config {
        image = "mongo:latest"
        ports = ["mongodb"]


        volumes = [
          "local/mongodb_data:/data/db"
        ]
      }

      resources {
        cpu    = 500
        memory = 1024
      }
    }
  }
}

I keep getting this error when i include the service block in my nomad job file:

Scheduler dry-run

mongodb

1 unplaced

  • Constraint ${attr.consul.version} semver >= 1.8.0 filtered 3 nodes

how can i fix this issue

Hi. Install and run and configure consul, or remove service { consul service definition from your job.

The Constraint ${attr.consul.version} semver >= 1.8.0 filtered 3 nodes means that none of the 3 nomad clients have consul installed with version greater or equal to 1.8.0.

1 Like