Looking for guidance with simple consul-integrated reverse proxy configuration

Hi there. I’ve got consul and nomad booted with acl’s. My goal is simple, I think - to publish applications and have them served to users via a simple dns name.

I’m overwhelmed by the amount of information presented in the consul docs and am struggling to make this simple connection. I’m unclear as to whether I need to set up a reverse proxy such as nginx, envoy, etc - and run as a service on each node, accepting requests by name and proxying to a node/port, or if there’s other more intelligent ways of doing this leveraging consul services.

So really, I want
user => web.example.com:80 => mycontainer.nomad-cluster:someport
as simply as I can.

Here’s what I think I’m supposed to be doing:

job "webby" {
  type = "service"
  datacenters = ["us-west-2a"]
  group "webby" {
    volume "webby" {
      type = "csi"
      source = "webby"
    }
    network {
      mode = "bridge"
      port "http" {
        to = 80
      }
    }
    service {
      name = "webby"
      tags = ["webby"]
      port = "http"
      connect {
         sidecar_service {
           proxy {
             upstreams {
               destination_name = "webby"
             }
           }
         }
      }    
    }    
    task "webby" {
      driver = "docker"
      resources {
        cpu = 100
        memory = 128
      }
      config {
        image = "docker.io/nginx"
      } 
      constraint {
        distinct_hosts = false
      }
      volume_mount {
        volume = "webby"
        destination = "/var/www/webby"
      }
    }
  }
}

I’d really appreciate the opportunity for an interactive discussion with someone who has experience with this.

Many thanks in advance.

2 Likes

Check out these tutorials on Learn for integrating various load balancers with Nomad.

I noticed you have a connect stanza in your job spec. If you’re using Consul service mesh, you can also use Consul’s ingress gateway which can be easily deployed and configured on Nomad using the gateway stanza. However, the other LB solutions may be more suitable depending on your requirements.

1 Like

I’m over the hump with fabio. And, over the moon. Thanks for the pointers.