Can I deploy the same service with different tags and ports?

Hi, for example I had a service like this

      service {
        tags = ["service discovery tags 1"]

        port = "regular"

I also wanted to start the service on a different port for secured https connection and different tags for another service discovery rules

how could I achieve that with nomad service stanza?

Hi @lyang24 you can declare as many services as you need, e.g.

  group "group" {
    network {
      port "http" {
        static = 8080
      }
      port "tls" {
        static = 443
      }
    }

    service {
      name     = "web"
      port     = "http"
      tags = ["insecure"]
      provider = "nomad"
    }

    service {
      name = "web"
      port = "tls"
      tags = ["secure"]
      provider = "nomad"
    }
...
2 Likes