Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow passed in network namespace #38

Merged
merged 2 commits into from
Jun 30, 2020
Merged

allow passed in network namespace #38

merged 2 commits into from
Jun 30, 2020

Conversation

drewbailey
Copy link
Contributor

@drewbailey drewbailey commented Jun 29, 2020

pr allows running connect job through docker network namespace

job "countdash" {
  datacenters = ["dc1"]

  group "api" {
    network {
      mode = "bridge"
    }

    service {
      name = "count-api"
      port = "9001"

      connect {
        sidecar_service {}
      }
    }

    task "web" {
      driver = "podman"

      config {
        image = "hashicorpnomad/counter-api:v1"
      }
    }
  }

  group "dashboard" {
    network {
      mode = "bridge"

      port "http" {
        static = 9002
        to     = 9002
      }
    }

    service {
      name = "count-dashboard"
      port = "9002"

      connect {
        sidecar_service {
          proxy {
            upstreams {
              destination_name = "count-api"
              local_bind_port  = 8081
            }
          }
        }
      }
    }

    task "dashboard" {
      driver = "podman"

      env {
        COUNTING_SERVICE_URL = "http://${NOMAD_UPSTREAM_ADDR_count_api}"
      }

      config {
        image = "hashicorpnomad/counter-dashboard:v1"
      }
    }
  }
}

podman.hcl

plugin_dir = "/opt/nomad/plugins"
bind_addr  = "192.168.1.54"
client {
  enabled               = true
}

plugin "nomad-driver-podman" {
  config {
    volumes {
      enabled = true
    }
  }
}

sudo env PATH=$PATH nomad agent -dev-connect -config=podman.hcl
consul agent -dev -advertise="192.168.1.54"

Copy link
Collaborator

@towe75 towe75 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@drewbailey nice! What about adding a note/feature to the readme.md?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants